ElectionRegistry_Tally
ElectionRegistry_Tally is an integration mandate that concludes an election, calculates the winners, and updates the role assignments accordingly.
Overview
Section titled “Overview”This mandate is the final step in the PowerLabs election lifecycle. Once an election period has ended, this mandate can be called to:
- Verify that the election is officially closed.
- Retrieve the ranked list of nominees from the
ElectionRegistrycontract based on votes cast. - Revoke the role from all current holders (effectively clearing the slate).
- Assign the role to the top N candidates from the election, where N is the configured maximum.
Configuration
Section titled “Configuration”When adopting an ElectionRegistry_Tally instance, the following parameters are required:
electionContract(address): The address of the ElectionRegistry helper contract.RoleId(uint256): The role ID to be updated based on the election results.MaxRoleHolders(uint256): The maximum number of winners to elect (the top candidates).
Proposing an Action
Section titled “Proposing an Action”When calling the mandate, one parameter must be provided:
Title(string): The title of the election. The unique election ID is derived from this title and the Powers contract address.
Execution Flow
Section titled “Execution Flow”-
Verification
- Computes the unique
electionId. - Calls
isElectionOpen(electionId)on the ElectionRegistry contract. Reverts with"Election is still open"if it returns true.
- Computes the unique
-
Tallying
- Retrieves the nominee ranking from the ElectionRegistry.
- Selects the top candidates up to
MaxRoleHolders.
-
Role Updates
- Generates
revokeRolecalls for all existing role holders. - Generates
assignRolecalls for the newly elected candidates. - Returns the batch of updates for execution.
- Generates
Technical Specifications
Section titled “Technical Specifications”Functions
Section titled “Functions”initializeMandate
Section titled “initializeMandate”function initializeMandate(...) public override- Initializes the tally configuration.
- Sets input parameters to
(string Title).
handleRequest
Section titled “handleRequest”function handleRequest(...) public view override returns (...)- Performs the validation, tallying, and state transition logic.
Current Deployments
Section titled “Current Deployments”| Chain ID | Chain Name | Address |
|---|---|---|