Wombat Exchange
Wombat Exchange
Search
⌃K
Links

Voter

contracts/wombat-governance/gauge/Voter.sol
Notice: Voter can handle gauge voting. WOM rewards are distributed to different gauges (MasterWombat->LpToken pair) according to the base allocation & voting weights. veWOM holders can participate in gauge voting to determine voteAllocation() of the WOM emission. They can allocate their vote (1 veWOM = 1 vote) to one or more gauges. WOM accumulation to a gauge is proportional to the amount of vote it receives. Real-time WOM accumulation and epoch-based WOM distribution: Voting gauges accumulates WOM seconds by seconds according to the voting weight. When a user applies new allocation for their votes, accumulation rate of WOM of the gauge updates immediately. Note that only whitelisted gauges are able to accumulate WOM from users' votes. Accumulated WOM is distributed to LP in the next epoch at an even rate. 1 epoch last for 7 days. Base Allocation: baseAllocation of WOM emissions is distributed to gauges according to the allocation by owner. Other WOM emissions are deteremined by votes of veWOM holders. Flow to distribute reward: 1. Voter.distribute(lpToken) is called 2. WOM index (baseIndex and voteIndex) is updated and corresponding WOM accumulated over this period (GaugeInfo.claimable) is updated. 3. At the beginning of each epoch, GaugeInfo.claimable amount of WOM is sent to the respective gauge via MasterWombat.notifyRewardAmount(IERC20 _lpToken, uint256 _amount) 4. MasterWombat will update the corresponding pool.rewardRate and pool.periodFinish Bribe Bribe is natively supported by Voter. Third Party protocols can bribe to attract more votes from veWOM holders to increase WOM emissions to their tokens. Flow of bribe: 1. When users vote/unvote, bribe.onVote is called. The bribe contract works similar to MultiRewarderPerSec. Note: This should also works with boosted pool. But it doesn't work with interest rate model Note 2: Please refer to the comment of MasterWombatV3.notifyRewardAmount for front-running risk

event DistributeReward

***Voter.DistributeReward(lpToken, amount) ***
Arguments
name
type
description
lpToken
address
not indexed
amount
uint256
not indexed

event Initialized

***Voter.Initialized(version) ***
Details: Triggered when the contract has been initialized or reinitialized.
Arguments
name
type
description
version
uint8
not indexed

event OwnershipTransferred

***Voter.OwnershipTransferred(previousOwner, newOwner) ***
Arguments
name
type
description
previousOwner
address
indexed
newOwner
address
indexed

event Paused

***Voter.Paused(account) ***
Details: Emitted when the pause is triggered by account.
Arguments
name
type
description
account
address
not indexed

event Unpaused

***Voter.Unpaused(account) ***
Details: Emitted when the pause is lifted by account.
Arguments
name
type
description
account
address
not indexed

event UpdateEmissionPartition

***Voter.UpdateEmissionPartition(baseAllocation, votePartition) ***
Arguments
name
type
description
baseAllocation
uint256
not indexed
votePartition
uint256
not indexed

event UpdateVote

***Voter.UpdateVote(user, lpToken, amount) ***
Arguments
name
type
description
user
address
not indexed
lpToken
address
not indexed
amount
uint256
not indexed

function add

***Voter.add(_gaugeManager, _lpToken, _bribe) ***
Notice: Add LP token into the Voter
Arguments
name
type
description
_gaugeManager
address
_lpToken
address
_bribe
address

function baseAllocation

Voter.baseAllocation() view
Outputs
name
type
description
uint16

function baseIndex

Voter.baseIndex() view
Outputs
name
type
description
uint104

function claimBribes

***Voter.claimBribes(_lpTokens) ***
Notice: Claim bribes for LP tokens
Details: This function looks safe from re-entrancy attack
Arguments
name
type
description
_lpTokens
address[]
Outputs
name
type
description
bribeRewards
uint256[][]

function distribute

***Voter.distribute(_lpToken) ***
Details: This function looks safe from re-entrancy attack
Arguments
name
type
description
_lpToken
address

function emergencyWomWithdraw

***Voter.emergencyWomWithdraw() ***
Notice: In case we need to manually migrate WOM funds from Voter Sends all remaining wom from the contract to the owner

function firstEpochStartTime

Voter.firstEpochStartTime() view
Outputs
name
type
description
uint40

function getUserVotes

Voter.getUserVotes(_user, _lpToken) view
Notice: getter function to return vote of a LP token for a user
Arguments
name
type
description
_user
address
_lpToken
address
Outputs
name
type
description
uint256

function infos

Voter.infos() view
Arguments
name
type
description
address
Outputs
name
type
description
supplyBaseIndex
uint104
supplyVoteIndex
uint104
nextEpochStartTime
uint40
claimable
uint128
whitelist
bool
gaugeManager
address
bribe
address

function initialize

***Voter.initialize(_wom, _veWom, _womPerSec, _startTimestamp, _firstEpochStartTime, _baseAllocation) ***
Arguments
name
type
description
_wom
address
_veWom
address
_womPerSec
uint88
_startTimestamp
uint40
_firstEpochStartTime
uint40
_baseAllocation
uint16

function lastRewardTimestamp

Voter.lastRewardTimestamp() view
Outputs
name
type
description
uint40

function lpTokenLength

Voter.lpTokenLength() view
Notice: returns LP tokens length
Outputs
name
type
description
uint256

function lpTokens

Voter.lpTokens() view
Arguments
name
type
description
uint256
Outputs
name
type
description
address

function owner

Voter.owner() view
Details: Returns the address of the current owner.
Outputs
name
type
description
address

function pauseAll

***Voter.pauseAll() ***
Notice: Pause vote accumulation of WOM tokens for all assets Users can still vote/unvote and receive bribes.

function pauseVoteEmission

***Voter.pauseVoteEmission(_lpToken) ***
Notice: Pause vote emission of WOM tokens for the gauge. Users can still vote/unvote and receive bribes.
Arguments
name
type
description
_lpToken
address

function paused

Voter.paused() view
Details: Returns true if the contract is paused, and false otherwise.
Outputs
name
type
description
bool

function pendingBribes

Voter.pendingBribes(_lpTokens, _user) view
Notice: Get pending bribes for LP tokens
Arguments
name
type
description
_lpTokens
address[]
_user
address
Outputs
name
type
description
bribeTokenAddresses
address[][]
bribeTokenSymbols
string[][]
bribeRewards
uint256[][]

function pendingWom

Voter.pendingWom(_lpToken) view
Notice: Amount of pending WOM for the LP token
Arguments
name
type
description
_lpToken
address
Outputs
name
type
description
uint256

function renounceOwnership

***Voter.renounceOwnership() ***
Details: Leaves the contract without owner. It will not be possible to call onlyOwner functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.

function resumeAll

***Voter.resumeAll() ***
Notice: Resume vote accumulation of WOM tokens for all assets

function resumeVoteEmission

***Voter.resumeVoteEmission(_lpToken) ***
Notice: Resume vote accumulation of WOM tokens for the gauge.
Arguments
name
type
description
_lpToken
address

function setAllocPoint

***Voter.setAllocPoint(_lpToken, _allocPoint) ***
Arguments
name
type
description
_lpToken
address
_allocPoint
uint128

function setBaseAllocation

***Voter.setBaseAllocation(_baseAllocation) ***
Notice: update the base and vote partition
Arguments
name
type
description
_baseAllocation
uint16

function setBribe

***Voter.setBribe(_lpToken, _bribe) ***
Notice: get bribe address for LP token
Arguments
name
type
description
_lpToken
address
_bribe
address

function setGauge

***Voter.setGauge(_lpToken, _gaugeManager) ***
Notice: get gaugeManager address for LP token
Arguments
name
type
description
_lpToken
address
_gaugeManager
address

function setWomPerSec

***Voter.setWomPerSec(_womPerSec) ***
Arguments
name
type
description
_womPerSec
uint88

function totalAllocPoint

Voter.totalAllocPoint() view
Outputs
name
type
description
uint128

function totalWeight

Voter.totalWeight() view
Outputs
name
type
description
uint128

function transferOwnership

***Voter.transferOwnership(newOwner) ***
Details: Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.
Arguments
name
type
description
newOwner
address

function veWom

Voter.veWom() view
Outputs
name
type
description
address

function vote

***Voter.vote(_lpVote, _deltas) ***
Notice: Vote and unvote WOM emission for LP tokens. User can vote/unvote a un-whitelisted pool. But no WOM will be emitted. Bribes are also distributed by the Bribe contract. Amount of vote should be checked by veWom.vote(). This can also used to distribute bribes when _deltas are set to 0
Arguments
name
type
description
_lpVote
address[]
address to LP tokens to vote
_deltas
int256[]
change of vote for each LP tokens
Outputs
name
type
description
bribeRewards
uint256[][]

function voteAllocation

Voter.voteAllocation() view
Notice: Read-only functions
Outputs
name
type
description
uint256

function voteIndex

Voter.voteIndex() view
Outputs
name
type
description
uint104

function votes

Voter.votes(, ) view
Arguments
name
type
description
address
address
Outputs
name
type
description
uint256

function weights

Voter.weights() view
Arguments
name
type
description
address
Outputs
name
type
description
allocPoint
uint128
voteWeight
uint128

function wom

Voter.wom() view
Outputs
name
type
description
address

function womPerSec

Voter.womPerSec() view
Outputs
name
type
description
uint88
4c5d8d635e8645fc848a12d25d5f5c97
Last modified 2mo ago