Technical ReferenceContract Functions

Voter

Overview

The Voter contract records pool voting weights for veNFTs and creates and claims pool voting rewards. A position is identified by its vote-escrow contract address (_ve) and NFT identifier (_tokenId). Voting power is obtained through the governance registry's voting-escrow aggregator, which applies the registered weight of each escrow.

Gauge voting and the voting-incentives marketplace are paused under SGP-20. Weekly emissions and the rebase are zero. SGP-19 routes the pool swap-fee share allocated through the ve(3,3) path to the DAO treasury. Protocol proposal voting remains active; see the governance guide.

Pool IDs are uint160 identifiers that distinguish pools across networks. Obtain them from GovernanceRegistry.getPoolId().

Voting, resetting and claiming require the NFT owner or an address approved by the vote-escrow contract. Manage NFT approvals on the vote-escrow contract. poke is permissionless.

Voter Methods

vote

Allocate the NFT's voting power proportionally across the supplied pool weights.

function vote(
    address _ve,
    uint256 _tokenId,
    uint160[] calldata _poolVote,
    uint256[] calldata _weights
) external
Input ParameterTypeDescription
_veaddressThe registered vote-escrow contract containing the NFT.
_tokenIduint256The NFT to vote with.
_poolVoteuint160[]The pool identifiers to vote for.
_weightsuint256[]Relative weights, in the same order as _poolVote.

The arrays must have equal lengths and contain no more than maxVotingNum() pools. Each selected pool must have voting rewards deployed and voting authorized. Duplicate pools and allocations that round down to zero revert.

An NFT can vote or deposit into a managed NFT once per epoch. Voting is unavailable during the epoch's initial distribution window. During the final voting window, only whitelisted NFTs can vote. Deactivated managed NFTs cannot vote.

poke

Recalculate an NFT's existing pool allocations using its current weighted voting power. This updates the balances recorded in the associated fee and bribe reward contracts without selecting new pools.

function poke(address _ve, uint256 _tokenId) external

Anyone can call this method. It is unavailable during the epoch's initial distribution window and requires existing allocations to remain valid.

reset

Remove the NFT's pool allocations and the corresponding balances in fee and bribe reward contracts.

function reset(address _ve, uint256 _tokenId) external

The caller must own or be approved for the NFT. Resetting is unavailable in the epoch in which the NFT last voted or deposited into a managed NFT, and during the initial distribution window. After a successful reset, the NFT can vote again in the current epoch.

depositManaged

Deposit an NFT into a managed NFT in the same vote-escrow contract, then update the managed NFT's pool voting balances.

function depositManaged(
    address _ve,
    uint256 _tokenId,
    uint256 _mTokenId
) external
Input ParameterTypeDescription
_veaddressThe registered vote-escrow contract.
_tokenIduint256The NFT to deposit.
_mTokenIduint256The managed NFT receiving the deposit.

The caller must own or be approved for _tokenId. The managed NFT must be active. The once-per-epoch restriction and initial distribution window apply; deposits are also unavailable during the final voting window. An NFT withdrawn from a managed NFT is locked again for the maximum lock duration.

withdrawManaged

Withdraw an NFT from its managed NFT and update the managed NFT's pool voting balances.

function withdrawManaged(address _ve, uint256 _tokenId) external

The caller must own or be approved for the NFT. Withdrawal is unavailable in the same epoch as its deposit and during the initial distribution window. The withdrawn NFT is locked again for the maximum lock duration.

claimBribes

Claim voting incentives from multiple bribe reward contracts for one NFT. Rewards are transferred to the NFT's current owner.

function claimBribes(
    address[] memory _bribes,
    address[][] memory _tokens,
    address _ve,
    uint256 _tokenId
) external
Input ParameterTypeDescription
_bribesaddress[]The BribeVotingReward contracts to claim from.
_tokensaddress[][]Reward token addresses for each contract, in matching order.
_veaddressThe vote-escrow contract containing the NFT.
_tokenIduint256The NFT whose recorded rewards are claimed.

The caller must own or be approved for the NFT. Supply one token list for each reward contract.

claimFees

Claim pool fee rewards from multiple fee reward contracts for one NFT. Rewards are transferred to the NFT's current owner.

function claimFees(
    address[] memory _fees,
    address[][] memory _tokens,
    address _ve,
    uint256 _tokenId
) external
Input ParameterTypeDescription
_feesaddress[]The FeesVotingReward contracts to claim from.
_tokensaddress[][]Reward token addresses for each contract, in matching order.
_veaddressThe vote-escrow contract containing the NFT.
_tokenIduint256The NFT whose recorded rewards are claimed.

The caller must own or be approved for the NFT. Supply one token list for each reward contract. These methods claim pool voting rewards; rebases use the separate RewardsDistributor.

createVotingRewards

Create the fee and bribe reward contracts for a registered pool. Anyone can call this method, and only one pair can be created per pool. Creation also authorizes voting for the pool.

function createVotingRewards(uint160 _poolId)
    external
    returns (address fees, address bribe)
ParameterTypeDescription
_poolIduint160The registered pool identifier.
feesaddressThe created FeesVotingReward contract.
bribeaddressThe created BribeVotingReward contract.

Administration Methods

These methods are restricted by the contract's AccessManager authority.

function forceReset(address _ve, uint256 _tokenId) external
function setMaxVotingNum(uint256 _maxVotingNum) external
function whitelistNFT(address _ve, uint256 _tokenId, bool _bool) external
function whitelistToken(address _token, bool _bool) external
function banVote(uint160 _poolId) external
function reauthorizeVote(uint160 _poolId) external
function setGovernanceRegistry(address _governanceRegistry) external

forceReset removes an NFT's allocations under the same epoch and distribution-window restrictions as reset. setMaxVotingNum changes the maximum pool count and requires a value of at least 10. whitelistNFT controls access to the final voting window; whitelistToken controls whether a new token can be added as a bribe reward. banVote and reauthorizeVote change whether a pool with deployed voting rewards accepts votes.

View Methods

governanceRegistry

Return the governance registry address.

function governanceRegistry() external view returns (address)

totalWeight

Return the total weight currently allocated across pools.

function totalWeight() external view returns (uint256)

maxVotingNum

Return the maximum number of pools an NFT can vote for in one call.

function maxVotingNum() external view returns (uint256)

poolIds

Return the pool identifier at an index in the list of pools with voting rewards.

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

length

Return the number of pools with voting rewards. Enumerate them with poolIds(index).

function length() external view returns (uint256)

hasVotingRewards

Return whether fee and bribe reward contracts have been created for a pool.

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

poolToFees

Return the fee reward contract associated with a pool.

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

poolToBribe

Return the bribe reward contract associated with a pool.

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

weights

Return the total weight currently allocated to a pool.

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

votes

Return the weight allocated by an NFT to a pool.

function votes(address _ve, uint256 tokenId, uint160 poolId)
    external view returns (uint256)

poolVote

Return the pool identifier at an index in an NFT's current pool allocations.

function poolVote(address _ve, uint256 tokenId, uint256 index)
    external view returns (uint160)

usedWeights

Return the total weight currently allocated by an NFT.

function usedWeights(address _ve, uint256 tokenId) external view returns (uint256)

lastVoted

Return the timestamp when an NFT last voted or deposited into a managed NFT.

function lastVoted(address _ve, uint256 tokenId) external view returns (uint256)

isWhitelistedToken

Return whether a token is whitelisted for addition as a new bribe reward token.

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

isWhitelistedNFT

Return whether an NFT can vote during the final voting window.

function isWhitelistedNFT(address _ve, uint256 tokenId) external view returns (bool)

isVoteAuthorized

Return whether voting is authorized for a pool.

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

On this page