ElectionList_Vote
ElectionList_Vote is an integration mandate that allows users to cast votes in a specific election instance.
Overview
Section titled “Overview”This mandate is typically deployed dynamically (via ElectionList_CreateVoteMandate) for each new election. It serves as the interface for casting votes. By encapsulating the voting logic in a separate mandate, the system can enforce specific access controls (e.g., only voterRoleId can call it) and parameters (e.g., maxVotes) unique to that election event.
Configuration
Section titled “Configuration”When adopting an ElectionList_Vote instance, the following parameters are required:
ElectionListContract(address): The address of the ElectionList helper contract.maxVotes(uint256): The maximum number of nominees a voter can select in a single ballot.electionId(uint256): The unique identifier of the election this mandate is bound to.
Proposing an Action
Section titled “Proposing an Action”When calling the mandate, one parameter must be provided:
vote(bool[]): An array of booleans corresponding to the list of nominees in the election.true: Vote for this nominee.false: Do not vote for this nominee.
The length of the array must exactly match the number of nominees in the election.
Execution Flow
Section titled “Execution Flow”-
Validation
- Checks if the election is still open.
- Verifies that the
votearray length matches the nominee count. - Counts the number of
truevotes and ensures it does not exceedmaxVotes.
-
Cast Vote
- Calls
vote(electionId, caller, vote)on theElectionListcontract. - The
ElectionListcontract handles the recording of votes and prevention of double-voting.
- Calls
Technical Specifications
Section titled “Technical Specifications”Functions
Section titled “Functions”initializeMandate
Section titled “initializeMandate”function initializeMandate(...) public override- Initializes the election context.
- Fetches the nominee list to generate a dynamic input description (e.g., listing nominee addresses).
handleRequest
Section titled “handleRequest”function handleRequest(...) public view virtual override returns (...)- Performs validation.
- Generates the vote call.
Current Deployments
Section titled “Current Deployments”| Chain ID | Chain Name | Address |
|---|---|---|