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 determinevoteAllocation()
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
name | type | description |
lpToken | address | not indexed |
amount | uint256 | not indexed |
***Voter.Initialized(version) ***
Details: Triggered when the contract has been initialized or reinitialized.
Arguments
name | type | description |
version | uint8 | not indexed |
***Voter.OwnershipTransferred(previousOwner, newOwner) ***
Arguments
name | type | description |
previousOwner | address | indexed |
newOwner | address | indexed |
***Voter.Paused(account) ***
Details: Emitted when the pause is triggered byaccount
.
Arguments
name | type | description |
account | address | not indexed |
***Voter.Unpaused(account) ***
Details: Emitted when the pause is lifted byaccount
.
Arguments
name | type | description |
account | address | not indexed |
***Voter.UpdateEmissionPartition(baseAllocation, votePartition) ***
Arguments
name | type | description |
baseAllocation | uint256 | not indexed |
votePartition | uint256 | not indexed |
***Voter.UpdateVote(user, lpToken, amount) ***
Arguments
name | type | description |
user | address | not indexed |
lpToken | address | not indexed |
amount | uint256 | not indexed |
***Voter.add(_gaugeManager, _lpToken, _bribe) ***
Notice: Add LP token into the Voter
Arguments
name | type | description |
_gaugeManager | address | |
_lpToken | address | |
_bribe | address | |
Voter.baseAllocation() view
Outputs
name | type | description |
| uint16 | |
Voter.baseIndex() view
Outputs
name | type | description |
| uint104 | |
***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[][] | |
***Voter.distribute(_lpToken) ***
Details: This function looks safe from re-entrancy attack
Arguments
name | type | description |
_lpToken | address | |
***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
name | type | description |
| uint40 | |
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 | |
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 | |
***Voter.initialize(_wom, _veWom, _womPerSec, _startTimestamp, _firstEpochStartTime, _baseAllocation) ***
Arguments
name | type | description |
_wom | address | |
_veWom | address | |
_womPerSec | uint88 | |
_startTimestamp | uint40 | |
_firstEpochStartTime | uint40 | |
_baseAllocation | uint16 | |
Voter.lastRewardTimestamp() view
Outputs
name | type | description |
| uint40 | |
Voter.lpTokenLength() view
Notice: returns LP tokens length
Outputs
name | type | description |
| uint256 | |
Voter.lpTokens() view
Arguments
name | type | description |
| uint256 | |
Outputs
name | type | description |
| address | |
Voter.owner() view
Details: Returns the address of the current owner.
Outputs
name | type | description |
| address | |
***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
name | type | description |
_lpToken | address | |
Voter.paused() view
Details: Returns true if the contract is paused, and false otherwise.
Outputs
name | type | description |
| bool | |
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[][] | |
Voter.pendingWom(_lpToken) view
Notice: Amount of pending WOM for the LP token
Arguments
name | type | description |
_lpToken | address | |
Outputs
name | type | description |
| uint256 | |
***Voter.renounceOwnership() ***
Details: Leaves the contract without owner. It will not be possible to callonlyOwner
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
name | type | description |
_lpToken | address | |
***Voter.setAllocPoint(_lpToken, _allocPoint) ***
Arguments
name | type | description |
_lpToken | address | |
_allocPoint | uint128 | |
***Voter.setBaseAllocation(_baseAllocation) ***
Notice: update the base and vote partition
Arguments
name | type | description |
_baseAllocation | uint16 | |
***Voter.setBribe(_lpToken, _bribe) ***
Notice: get bribe address for LP token
Arguments
name | type | description |
_lpToken | address | |
_bribe | address | |
***Voter.setGauge(_lpToken, _gaugeManager) ***
Notice: get gaugeManager address for LP token
Arguments
name | type | description |
_lpToken | address | |
_gaugeManager | address | |
***Voter.setWomPerSec(_womPerSec) ***
Arguments
name | type | description |
_womPerSec | uint88 | |
Voter.totalAllocPoint() view
Outputs
name | type | description |
| uint128 | |
Voter.totalWeight() view
Outputs
name | type | description |
| uint128 | |
***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 | |
Voter.veWom() view
Outputs
name | type | description |
| address | |
***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[][] | |
Voter.voteAllocation() view
Notice: Read-only functions
Outputs
name | type | description |
| uint256 | |
Voter.voteIndex() view
Outputs
name | type | description |
| uint104 | |
Voter.votes(, ) view
Arguments
name | type | description |
| address | |
| address | |
Outputs
name | type | description |
| uint256 | |
Voter.weights() view
Arguments
name | type | description |
| address | |
Outputs
name | type | description |
allocPoint | uint128 | |
voteWeight | uint128 | |
Voter.wom() view
Outputs
name | type | description |
| address | |
Voter.womPerSec() view
Outputs
name | type | description |
| uint88 | 4c5d8d635e8645fc848a12d25d5f5c97 |
Last modified 2mo ago