Voter
Last updated
Last updated
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 byowner
. Other WOM emissions are deteremined byvotes
of veWOM holders. Flow to distribute reward: 1.Voter.distribute(lpToken)
is called 2. WOM index (baseIndex
andvoteIndex
) 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 viaMasterWombat.notifyRewardAmount(IERC20 _lpToken, uint256 _amount)
4. MasterWombat will update the correspondingpool.rewardRate
andpool.periodFinish
Bribe Bribe is natively supported byVoter
. 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 toMultiRewarderPerSec
. 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
***Voter.DistributeReward(lpToken, amount) ***
Arguments
***Voter.Initialized(version) ***
Details: Triggered when the contract has been initialized or reinitialized.
Arguments
***Voter.OwnershipTransferred(previousOwner, newOwner) ***
Arguments
***Voter.Paused(account) ***
Details: Emitted when the pause is triggered by
account
.
Arguments
***Voter.Unpaused(account) ***
Details: Emitted when the pause is lifted by
account
.
Arguments
***Voter.UpdateEmissionPartition(baseAllocation, votePartition) ***
Arguments
***Voter.UpdateVote(user, lpToken, amount) ***
Arguments
***Voter.add(_gaugeManager, _lpToken, _bribe) ***
Notice: Add LP token into the Voter
Arguments
Voter.baseAllocation() view
Outputs
Voter.baseIndex() view
Outputs
***Voter.claimBribes(_lpTokens) ***
Notice: Claim bribes for LP tokens
Details: This function looks safe from re-entrancy attack
Arguments
Outputs
***Voter.distribute(_lpToken) ***
Details: This function looks safe from re-entrancy attack
Arguments
***Voter.emergencyWomWithdraw() ***
Notice: In case we need to manually migrate WOM funds from Voter Sends all remaining wom from the contract to the owner
Voter.firstEpochStartTime() view
Outputs
Voter.getUserVotes(_user, _lpToken) view
Notice: getter function to return vote of a LP token for a user
Arguments
Outputs
Voter.infos() view
Arguments
Outputs
***Voter.initialize(_wom, _veWom, _womPerSec, _startTimestamp, _firstEpochStartTime, _baseAllocation) ***
Arguments
Voter.lastRewardTimestamp() view
Outputs
Voter.lpTokenLength() view
Notice: returns LP tokens length
Outputs
Voter.lpTokens() view
Arguments
Outputs
Voter.owner() view
Details: Returns the address of the current owner.
Outputs
***Voter.pauseAll() ***
Notice: Pause vote accumulation of WOM tokens for all assets Users can still vote/unvote and receive bribes.
***Voter.pauseVoteEmission(_lpToken) ***
Notice: Pause vote emission of WOM tokens for the gauge. Users can still vote/unvote and receive bribes.
Arguments
Voter.paused() view
Details: Returns true if the contract is paused, and false otherwise.
Outputs
Voter.pendingBribes(_lpTokens, _user) view
Notice: Get pending bribes for LP tokens
Arguments
Outputs
Voter.pendingWom(_lpToken) view
Notice: Amount of pending WOM for the LP token
Arguments
Outputs
***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.
***Voter.resumeAll() ***
Notice: Resume vote accumulation of WOM tokens for all assets
***Voter.resumeVoteEmission(_lpToken) ***
Notice: Resume vote accumulation of WOM tokens for the gauge.
Arguments
***Voter.setAllocPoint(_lpToken, _allocPoint) ***
Arguments
***Voter.setBaseAllocation(_baseAllocation) ***
Notice: update the base and vote partition
Arguments
***Voter.setBribe(_lpToken, _bribe) ***
Notice: get bribe address for LP token
Arguments
***Voter.setGauge(_lpToken, _gaugeManager) ***
Notice: get gaugeManager address for LP token
Arguments
***Voter.setWomPerSec(_womPerSec) ***
Arguments
Voter.totalAllocPoint() view
Outputs
Voter.totalWeight() view
Outputs
***Voter.transferOwnership(newOwner) ***
Details: Transfers ownership of the contract to a new account (
newOwner
). Can only be called by the current owner.
Arguments
Voter.veWom() view
Outputs
***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
Outputs
Voter.voteAllocation() view
Notice: Read-only functions
Outputs
Voter.voteIndex() view
Outputs
Voter.votes(, ) view
Arguments
Outputs
Voter.weights() view
Arguments
Outputs
Voter.wom() view
Outputs
Voter.womPerSec() view
Outputs