VotingReward

Overview

The VotingReward contract used by FeesVotingReward and BribeVotingReward allows to distribute rewards to users, earned through voting for a pool.

VotingReward Methods

getReward

Claim the rewards earned by a voter for a given token.

function getReward(
    address _user,
    address _token
) external
Input Parameter
Type
Description

_user

address

The address of the user voting.

_token

address

The token to claim rewards of.

getReward

Claim the rewards earned by a voter for a given token.

function getReward(
    address _user,
    address[] calldata _tokens
) external
Input Parameter
Type
Description

_user

address

The address of the user voting.

_tokens

address[] calldata

The array of tokens to claim rewards of.

_deposit

Deposit an amount into the rewards contract to earn future rewards.

Internal notation used as only callable internally by Voter.

function _deposit(
    uint256 _amount,
    address _user
) external
Input Parameter
Type
Description

_amount

uint256

The amount deposited for the user.

_user

address

The address of the user.

_withdraw

Withdraw an amount from the rewards contract associated to a voter.

Internal notation used as only callable internally by Voter.

function _withdraw(
    uint256 _amount,
    address _user
) external
Input Parameter
Type
Description

_amount

uint256

The amount withdrawn for the user.

_user

address

The address of the user.

View Methods

dao

Return the address of DAO.

function dao() external view returns (address)

DURATION

Return the epoch duration constant (7 days).

function DURATION() external view returns (uint256)

voter

Return the address of Voter.sol.

function voter() external view returns (address)

poolId

Return the identifier of the pool this contrat is associated with.

function poolId() external view returns (uint160)

totalSupply

Return the total amount currently deposited via _deposit().

function totalSupply() external view returns (uint256)

balanceOf

Return the current amount deposited by given user.

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

tokenRewardsPerEpoch

Return the amount of tokens to reward depositors for a given epoch.

function tokenRewardsPerEpoch(
    address _token,
    uint256 _epochStart
) external view returns (uint256)

lastEarn

Return the most recent timestamp a user has claimed their rewards for given tokens.

function lastEarn(
    address _token,
    address _user
) external view returns (uint256)

rewards

Return the token address stored at the given index in the list of rewards token.

function rewards(uint256 _index) external view returns (address)

rewardsListLength

Return the number of rewards tokens.

function rewardsListLength() external view returns (uint256)

getAllRewards

Return the list of rewards tokens.

function getAllRewards() external view returns (address[])

isReward

Return wether a token is or has been an active reward token.

function isReward(address _token) external view returns (bool)

daoFee

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

function daoFee() external view returns (uint256)

numCheckpoints

Return the number of checkpoints for each user address.

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

supplyNumCheckpoints

Return the total number of checkpoints.

function supplyNumCheckpoints() external view returns (uint256)

getPriorBalanceIndex

Return the prior balance for an account as of a block number.

function getPriorBalanceIndex(
    address _user,
    uint256 _timestamp
) external view returns (uint256);
Input Parameter
Type
Description

_user

address

The address of the user.

_timestamp

uint256

The timestamp to get the balance at.

Block number must be a finalized block or else this function will revert to prevent misinformation.

getPriorSupplyIndex

Return the prior index of supply staked by a given timestamp.

function getPriorSupplyIndex(uint256 _timestamp) external view returns (uint256)
Input Parameter
Type
Description

_timestamp

uint256

The timestamp to get the index at.

Timestamp must be <= current timestamp

earned

Return how much in rewards are earned for a specific token and voter.

function earned(
    address _token,
    address _user
) external view returns (uint256)
Input Parameter
Type
Description

_token

address

The token to fetch rewards of.

_user

address

The address of the user to check.

Last updated