Voter
Overview
The Voter
contract allows to vote for the proportion of weekly emissions that go to each pool LPs, as well as and voting rewards creation. Votes can be cast once per epoch, and earn voters both bribes and fees from the pool they voted for.
Given that votes for pools across all supported networks are managed on Ethereum, each pool is identified by a unique ID, in order to prevent address collusion, which may occur if two pools on different networks happen to share the same address.
Pool IDs can be obtained from GovernanceRegistry
's getPoolId()
function.
Voter Methods
vote
Handles the execution of command sequence.
Input Parameter | Type | Description |
---|---|---|
| address | The address of the user voting. |
| uint160[] calldata | The array of identifiers of pools that are voted for. |
| uint256[] calldata | The weights of pools. |
poke
Called by users to update voting balances in voting rewards contracts.
Input Parameter | Type | Description |
---|---|---|
| address | Address of the user whose balance are to be updated. |
batchVote
Called by approved address to vote for multiple users for pools. For each user, votes are distributed proportionally based on weights.
Input Parameter | Type | Description |
---|---|---|
| address[] calldata | The addresses of the users voting. |
| uint160[] calldata | The array of identifiers of pools that are voted for. |
| uint256[] calldata | The weights of pools. |
Each user can only vote once per epoch.
Users can only vote for registered pools with deployed voting rewards.
Weights are distributed proportionally to the sum of the weights in the array.
Throws if length of _poolVote and _weights do not match.
batchPoke
Called by approved address to update voting balances for multiple users in voting rewards contracts.
Input Parameter | Type | Description |
---|---|---|
| address[] calldata | The addresses of the users whose balance are to be updated. |
reset
Called by users to reset voting state.
Input Parameter | Type | Description |
---|---|---|
| address | Address of the user reseting. |
Can vote again after reset.
Cannot reset in the same epoch that you voted in.
claimBribes
Bulk claim bribes for a given user address.
Input Parameter | Type | Description |
---|---|---|
| address[] calldata | The array of BribeVotingReward contracts to collect from. |
| address[][] calldata | The array of tokens that are used as bribes. |
| address | The address of the user to claim bribe rewards for. |
claimFees
Bulk claim fees for a given user address.
Input Parameter | Type | Description |
---|---|---|
| address[] calldata | The array of FeesVotingReward contracts to collect from. |
| address[][] calldata | The array of tokens that are used as bribes. |
| address | The address of the user to claim fees rewards for. |
claimPoolsVotingRewards
Bulk claim bribes and fees for a given user address.
Input Parameter | Type | Description |
---|---|---|
| uint160[] calldata | The array of pool identifiers to collect associated bribes and fees from. |
| address[][] calldata | The array of list of tokens that are used as bribes for each pool. |
| address[][] calldata | The array of list of tokens that are used as fees rewards for each pool. |
| address | The address of the user to claim bribe and fees rewards for. |
createVotingRewards
Create voting rewards for a pool (unpermissioned).
Input Parameter | Type | Description |
---|---|---|
| uint160 | The identifier of the pool. |
Return Parameter | Type | Description |
---|---|---|
| address | The address of created FeesVotingReward. |
| address | The address of created BribeVotingReward. |
Only one pair of voting rewards can be created for any pool. See Voter
's hasVotingRewards()
.
Pool needs to be registered in governance registry. See GovernanceRegistry
's isPoolRegistered()
.
setApprovalForAll
Give or take back approval for an operator to manage voting and rewards claiming on behalf of sender.
Input Parameter | Type | Description |
---|---|---|
| address | The address to set approval for. |
| bool | True to approve operator, false otherwise. |
View Methods
dao
Return the address of DAO.
forwarder
Return the address of trusted forwarder.
ve
Return the address of the ve token that governs these contracts.
governanceRegistry
Return the address of GovernanceRegistry.
totalWeight
Return the total voting weight.
maxVotingNum
Return the max number of pools one voter can vote for at once.
defaultFeesRewardsDaoFee
Return the default share of fees voting rewards to be sent to the DAO, in basis points.
defaultBribeRewardsDaoFee
Return the default share of bribe voting rewards to be sent to the DAO, in basis points.
poolIds
Return the pool identifier stored at the given index in the list of identifiers of pools supporting voting rewards.
length
Return the number of pools with associated voting rewards.
getAllPoolIds
Return the list of all pool identifiers for pools with associated voting rewards.
hasVotingRewards
Return wether voting rewards are deployed for a given pool.
poolToFees
Return the FeesVotingRewards contract associated with given pool.
poolToBribe
Return the BribeVotingRewards contract associated with given pool.
weights
Return the total voting weight for a given pool.
votes
Return the voting weight attributed by a given user to a given pool.
usedWeights
Return the total used voting weight of a given user.
lastVoted
Return the timestamp of last votefor a given user.
isWhitelistedBribeToken
Return wether a token is whitelisted as a possible bribe reward.
isWhitelistedUser
Return wether a user is whitelisted to vote outside of voting periods.
isVoteAuthorized
Return wether voting authorized for a given pool.
voted
Return wether a given user currently has a voting position.
restricted
Return wether a given user is restricted from voting.
Last updated