Peer Select
PeerSelect is an electoral mandate that allows members of a group to vote on a slate of nominees, directly assigning or revoking roles based on the collective selection.
Overview
Section titled “Overview”This mandate enables a more granular and interactive selection process than DelegateTokenSelect. Instead of relying on token weight, it allows authorized callers (usually holding a specific “voter” role via the mandate’s permissions) to:
- View the list of current nominees (from a
Nomineescontract). - Submit a selection (a set of votes) for multiple nominees.
- Directly assign the role to selected nominees who don’t have it.
- Directly revoke the role from selected nominees who already have it.
This is effectively a “toggle” mechanism where the voter can curate the list of role holders, subject to a maximum cap on total holders.
Configuration
Section titled “Configuration”When adopting a PeerSelect instance, the following parameters are required:
maxRoleHolders(uint256): The absolute maximum number of accounts that can hold the role at any time. Assignments that would exceed this limit will revert.roleId(uint256): The role ID to be assigned or revoked.maxVotes(uint8): The maximum number of nominees a voter can select in a single transaction.NomineesContract(address): The address of the Nominees helper contract providing the list of candidates.
Proposing an Action
Section titled “Proposing an Action”When calling the mandate, one parameter must be provided:
selection(bool[]): An array of booleans corresponding to the list of nominees fetched from theNomineesContract.true: Select this nominee (Assign if they don’t have the role, Revoke if they do).false: Do nothing for this nominee.
The length of this array must match the current number of nominees.
Execution Flow
Section titled “Execution Flow”-
Validation
- Verifies that the
selectionarray length matches the nominee list. - Verifies that the number of
trueselections is between 1 andmaxVotes.
- Verifies that the
-
Processing Selections
- Iterates through the selections.
- For each selected nominee:
- If they have the role: Revokes it.
- If they don’t have the role: Assigns it (incrementing the holder count).
-
Capacity Check
- If any assignments are made, checks if the new total of role holders would exceed
maxRoleHolders. If so, reverts.
- If any assignments are made, checks if the new total of role holders would exceed
-
Execution
- Batches all
assignRoleandrevokeRolecalls and returns them for execution by the Powers contract.
- Batches all
Technical Specifications
Section titled “Technical Specifications”Functions
Section titled “Functions”initializeMandate
Section titled “initializeMandate”function initializeMandate(...) public override- Initializes configuration.
- Fetches the nominee list to generate the input parameter description (UI hint).
handleRequest
Section titled “handleRequest”function handleRequest(...) public view virtual override returns (...)- Implements the toggle logic and validation.
Error Conditions
Section titled “Error Conditions”- Validation Errors
- “Invalid selection length.”: Input array doesn’t match nominee count.
- “Must select at least one nominee.”
- “Too many selections. Exceeds maxVotes limit.”
- “Too many assignments. Would exceed max role holders.”
Current Deployments
Section titled “Current Deployments”| Chain ID | Chain Name | Address |
|---|---|---|