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.

function vote(
    address _user,
    uint160[] calldata _poolVote,
    uint256[] calldata _weights
) external
Input ParameterTypeDescription

_user

address

The address of the user voting.

_poolVote

uint160[] calldata

The array of identifiers of pools that are voted for.

_weights

uint256[] calldata

The weights of pools.

poke

Called by users to update voting balances in voting rewards contracts.

function poke(
    address _user
) external
Input ParameterTypeDescription

_user

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.

function batchVote(
    address[] calldata _users,
    uint160[] calldata _poolVote,
    uint256[] calldata _weights
) external
Input ParameterTypeDescription

_users

address[] calldata

The addresses of the users voting.

_poolVote

uint160[] calldata

The array of identifiers of pools that are voted for.

_weights

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.

function batchPoke(
    address[] calldata _users
) external
Input ParameterTypeDescription

_users

address[] calldata

The addresses of the users whose balance are to be updated.

reset

Called by users to reset voting state.

function reset(
    address _user
) external
Input ParameterTypeDescription

_user

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.

claimBribes(
    address[] calldata _bribes,
    address[][] calldata _tokens,
    address _user
) external
Input ParameterTypeDescription

_bribes

address[] calldata

The array of BribeVotingReward contracts to collect from.

_tokens

address[][] calldata

The array of tokens that are used as bribes.

_user

address

The address of the user to claim bribe rewards for.

claimFees

Bulk claim fees for a given user address.

claimFees(
    address[] calldata _fees,
    address[][] calldata _tokens,
    address _user
) external
Input ParameterTypeDescription

_fees

address[] calldata

The array of FeesVotingReward contracts to collect from.

_tokens

address[][] calldata

The array of tokens that are used as bribes.

_user

address

The address of the user to claim fees rewards for.

claimPoolsVotingRewards

Bulk claim bribes and fees for a given user address.

function claimPoolsVotingRewards(
    uint160[] calldata _poolIds,
    address[][] calldata _bribeTokens,
    address[][] calldata _feeTokens,
    address _user
) external
Input ParameterTypeDescription

_poolIds

uint160[] calldata

The array of pool identifiers to collect associated bribes and fees from.

_bribeTokens

address[][] calldata

The array of list of tokens that are used as bribes for each pool.

_feeTokens

address[][] calldata

The array of list of tokens that are used as fees rewards for each pool.

_user

address

The address of the user to claim bribe and fees rewards for.

createVotingRewards

Create voting rewards for a pool (unpermissioned).

function createVotingRewards(
    address _poolId
) external returns (address fees, address bribe)
Input ParameterTypeDescription

_poolId

uint160

The identifier of the pool.

Return ParameterTypeDescription

fees

address

The address of created FeesVotingReward.

bribe

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.

function setApprovalForAll(
    address _operator,
    bool _approved
) external
Input ParameterTypeDescription

_operator

address

The address to set approval for.

_approved

bool

True to approve operator, false otherwise.

View Methods

dao

Return the address of DAO.

function dao() external view returns (address)

forwarder

Return the address of trusted forwarder.

function forwarder() external view returns (address)

ve

Return the address of the ve token that governs these contracts.

function ve() external view returns (address)

governanceRegistry

Return the address of GovernanceRegistry.

function governanceRegistry() external view returns (address)

totalWeight

Return the total voting weight.

function totalWeight() external view returns (uint256)

maxVotingNum

Return the max number of pools one voter can vote for at once.

function maxVotingNum() external view returns (uint256)

defaultFeesRewardsDaoFee

Return the default share of fees voting rewards to be sent to the DAO, in basis points.

function defaultFeesRewardsDaoFee() external view returns (uint256)

defaultBribeRewardsDaoFee

Return the default share of bribe voting rewards to be sent to the DAO, in basis points.

function defaultBribeRewardsDaoFee() external view returns (uint256)

poolIds

Return the pool identifier stored at the given index in the list of identifiers of pools supporting voting rewards.

function poolIds(address _index) external view returns (uint160)

length

Return the number of pools with associated voting rewards.

function length() external view returns (uint256)

getAllPoolIds

Return the list of all pool identifiers for pools with associated voting rewards.

function getAllPoolIds() external view returns (uint160[])

hasVotingRewards

Return wether voting rewards are deployed for a given pool.

function hasVotingRewards(uint160 _poolId) external view returns (bool)

poolToFees

Return the FeesVotingRewards contract associated with given pool.

function poolToFees(uint160 _poolId) external view returns (address)

poolToBribe

Return the BribeVotingRewards contract associated with given pool.

function poolToBribe(uint160 _poolId) external view returns (address)

weights

Return the total voting weight for a given pool.

function weights(uint160 _poolId) external view returns (uint256)

votes

Return the voting weight attributed by a given user to a given pool.

function votes(address _user, uint160 _poolId) external view returns (uint256)

usedWeights

Return the total used voting weight of a given user.

function usedWeights(address _user) external view returns (uint256)

lastVoted

Return the timestamp of last votefor a given user.

function lastVoted(address _user) external view returns (uint256)

isWhitelistedBribeToken

Return wether a token is whitelisted as a possible bribe reward.

function isWhitelistedBribeToken(address token) external view returns (bool)

isWhitelistedUser

Return wether a user is whitelisted to vote outside of voting periods.

function isWhitelistedUser(address _user) external view returns (bool)

isVoteAuthorized

Return wether voting authorized for a given pool.

function isVoteAuthorized(uint160 _poolId) external view returns (bool)

voted

Return wether a given user currently has a voting position.

function voted(address _user) external view returns (bool)

restricted

Return wether a given user is restricted from voting.

function restricted(address _user) external view returns (bool)

Last updated