Skip to content

ElectionRegistry_CreateVoteMandate

ElectionRegistry_CreateVoteMandate is an integration mandate that initiates a new election by deploying a dedicated “Vote Mandate”.

In the PowerLabs election system, voting rights and logic are encapsulated in a temporary mandate (an instance of ElectionRegistry_Vote). This mandate factory handles the creation of these instances. When executed, it:

  1. Calculates a unique ID for the new election based on the proposal details.
  2. Deploys/Adopts a new ElectionRegistry_Vote mandate configured for that specific election.
  3. Configures the new mandate to be accessible only by a specific voterRoleId.

This separation ensures that each election is isolated and access-controlled.

When adopting an ElectionRegistry_CreateVoteMandate instance, the following parameters are required:

  1. ElectionRegistry (address): The address of the ElectionRegistry helper contract.
  2. ElectionRegistry_Vote (address): The address of the ElectionRegistry_Vote mandate implementation (used as a template).
  3. maxVotes (uint256): The maximum number of votes a voter can cast in the spawned elections.
  4. voterRoleId (uint256): The role ID that will be granted permission to call (vote in) the spawned mandate.

When calling the mandate, one parameter must be provided:

  1. Title (string): A descriptive title for the election. The unique election ID is derived from this title and the Powers contract address.
  1. Initialization

    • Computes a unique electionId as keccak256(powers + title).
    • Prepares the initialization data (MandateInitData) for a new ElectionRegistry_Vote mandate.
    • Sets the configuration of the new mandate to point to the correct ElectionRegistry and electionId.
    • Sets the allowedRole condition of the new mandate to the configured voterRoleId.
  2. Adoption

    • Generates a call to IPowers.adoptMandate to install the new vote mandate.
    • Returns the adoption call for execution.
function initializeMandate(...) public override
  • Initializes the factory configuration.
  • Sets input parameters to (string Title).
function handleRequest(...) public view override returns (...)
  • Constructs the MandateInitData for the new vote mandate.
  • Encodes the adoption call.
Chain IDChain NameAddress