Delegate Token Select
DelegateTokenSelect is an electoral mandate that conducts an election based on delegated token weight. It assigns roles to the top nominees who have received the most delegated votes from an ERC20Votes token.
Overview
Section titled “Overview”This mandate automates the election process by:
- Fetching a list of nominees from a
Nomineescontract. - Calculating the voting power (delegated votes) for each nominee using an
ERC20Votestoken. - Ranking the nominees by their voting power.
- Revoking the role from all current holders.
- Assigning the role to the top N nominees, where N is the configured maximum number of role holders.
This mechanism ensures that the role holders always reflect the current delegation preferences of token holders.
Configuration
Section titled “Configuration”When adopting a DelegateTokenSelect instance, the following parameters are required:
VotesToken(address): The address of the ERC20Votes governance token used for calculating voting power.NomineesContract(address): The address of the Nominees helper contract that maintains the list of candidates.RoleId(uint256): The role ID to be assigned to the winners (and revoked from losers/previous holders).MaxRoleHolders(uint256): The maximum number of candidates to elect (the top N).
Proposing an Action
Section titled “Proposing an Action”This mandate does not require any input parameters. When called, it automatically performs the election logic based on the current state of the token and nominee list.
Execution Flow
Section titled “Execution Flow”-
State Retrieval
- Retrieves all current holders of the target
RoleId. - Retrieves the list of current nominees from the
NomineesContract.
- Retrieves all current holders of the target
-
Ranking Logic
- Queries the
VotesTokento get the current voting power (getVotes) for each nominee. - Sorts the nominees in descending order of voting power.
- Selects the top
MaxRoleHoldersnominees as the winners.
- Queries the
-
Role Updates
- Revocation: Generates
revokeRolecalls for all current role holders. - Assignment: Generates
assignRolecalls for the new set of winners. - Optimization: The mandate effectively resets the role membership to match the election results exactly.
- Revocation: Generates
Technical Specifications
Section titled “Technical Specifications”Functions
Section titled “Functions”initializeMandate
Section titled “initializeMandate”function initializeMandate( uint16 index, string memory nameDescription, bytes memory inputParams, bytes memory config) public override- Initializes the mandate configuration.
- Sets input parameters to empty (none required).
handleRequest
Section titled “handleRequest”function handleRequest(...) public view override returns (...)- Performs the sorting and selection logic.
- Returns the batch of revocation and assignment calls.
Error Conditions
Section titled “Error Conditions”- Configuration Errors
- Invalid contract addresses for
VotesTokenorNomineesContract.
- Invalid contract addresses for
Current Deployments
Section titled “Current Deployments”| Chain ID | Chain Name | Address |
|---|---|---|