ElectionList_Tally
ElectionList_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
ElectionListcontract 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 ElectionList_Tally instance, the following parameters are required:
electionContract(address): The address of the ElectionList 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, the inputs must identify the specific election to tally:
Title(string): The title of the election.StartBlock(uint48): The start block of the election.EndBlock(uint48): The end block of the election.
Execution Flow
Section titled “Execution Flow”-
Verification
- Computes the unique
electionId. - Checks the
ElectionListcontract to ensure the election is closed (current block >EndBlock). Reverts if the election is still ongoing.
- Computes the unique
-
Tallying
- Retrieves the nominee ranking from the ElectionList.
- 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, uint48 StartBlock, uint48 EndBlock).
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 |
|---|---|---|