ElectionRegistry_CreateVoteMandate
ElectionRegistry_CreateVoteMandate is an integration mandate that initiates a new election by deploying a dedicated “Vote Mandate”.
Overview
Section titled “Overview”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:
- Calculates a unique ID for the new election based on the proposal details.
- Deploys/Adopts a new
ElectionRegistry_Votemandate configured for that specific election. - Configures the new mandate to be accessible only by a specific
voterRoleId.
This separation ensures that each election is isolated and access-controlled.
Configuration
Section titled “Configuration”When adopting an ElectionRegistry_CreateVoteMandate instance, the following parameters are required:
ElectionRegistry(address): The address of the ElectionRegistry helper contract.ElectionRegistry_Vote(address): The address of theElectionRegistry_Votemandate implementation (used as a template).maxVotes(uint256): The maximum number of votes a voter can cast in the spawned elections.voterRoleId(uint256): The role ID that will be granted permission to call (vote in) the spawned mandate.
Proposing an Action
Section titled “Proposing an Action”When calling the mandate, one parameter must be provided:
Title(string): A descriptive title for the election. The unique election ID is derived from this title and the Powers contract address.
Execution Flow
Section titled “Execution Flow”-
Initialization
- Computes a unique
electionIdaskeccak256(powers + title). - Prepares the initialization data (
MandateInitData) for a newElectionRegistry_Votemandate. - Sets the configuration of the new mandate to point to the correct
ElectionRegistryandelectionId. - Sets the
allowedRolecondition of the new mandate to the configuredvoterRoleId.
- Computes a unique
-
Adoption
- Generates a call to
IPowers.adoptMandateto install the new vote mandate. - Returns the adoption call for execution.
- Generates a call to
Technical Specifications
Section titled “Technical Specifications”Functions
Section titled “Functions”initializeMandate
Section titled “initializeMandate”function initializeMandate(...) public override- Initializes the factory configuration.
- Sets input parameters to
(string Title).
handleRequest
Section titled “handleRequest”function handleRequest(...) public view override returns (...)- Constructs the
MandateInitDatafor the new vote mandate. - Encodes the adoption call.
Current Deployments
Section titled “Current Deployments”| Chain ID | Chain Name | Address |
|---|---|---|