MasterWombatV3

contracts/wombat-governance/MasterWombatV3.sol

Title: MasterWombatV3

Notice: MasterWombat is a boss. He is not afraid of any snakes. In fact, he drinks their venoms. So, veWom holders boost their (boosted) emissions. This contract rewards users in function of their amount of lp staked (base pool) factor (boosted pool) Factor and sumOfFactors are updated by contract VeWom.sol after any veWom minting/burning (veERC20Upgradeable hook). Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once Wombat is sufficiently distributed and the community can show to govern itself.

Details: Updates: - Compatible with gauge voting

event Add

***MasterWombatV3.Add(pid, lpToken, rewarder) ***

Arguments

name

type

description

pid

uint256

indexed

lpToken

address

indexed

rewarder

address

not indexed

event Deposit

***MasterWombatV3.Deposit(user, pid, amount) ***

Arguments

name

type

description

user

address

indexed

pid

uint256

indexed

amount

uint256

not indexed

event DepositFor

***MasterWombatV3.DepositFor(user, pid, amount) ***

Arguments

name

type

description

user

address

indexed

pid

uint256

indexed

amount

uint256

not indexed

event EmergencyWithdraw

***MasterWombatV3.EmergencyWithdraw(user, pid, amount) ***

Arguments

name

type

description

user

address

indexed

pid

uint256

indexed

amount

uint256

not indexed

event EmergencyWomWithdraw

***MasterWombatV3.EmergencyWomWithdraw(owner, balance) ***

Arguments

name

type

description

owner

address

not indexed

balance

uint256

not indexed

event Harvest

***MasterWombatV3.Harvest(user, pid, amount) ***

Arguments

name

type

description

user

address

indexed

pid

uint256

indexed

amount

uint256

not indexed

event Initialized

***MasterWombatV3.Initialized(version) ***

Details: Triggered when the contract has been initialized or reinitialized.

Arguments

name

type

description

version

uint8

not indexed

event OwnershipTransferred

***MasterWombatV3.OwnershipTransferred(previousOwner, newOwner) ***

Arguments

name

type

description

previousOwner

address

indexed

newOwner

address

indexed

event Paused

***MasterWombatV3.Paused(account) ***

Details: Emitted when the pause is triggered by account.

Arguments

name

type

description

account

address

not indexed

event SetRewarder

***MasterWombatV3.SetRewarder(pid, rewarder) ***

Arguments

name

type

description

pid

uint256

indexed

rewarder

address

not indexed

event Unpaused

***MasterWombatV3.Unpaused(account) ***

Details: Emitted when the pause is lifted by account.

Arguments

name

type

description

account

address

not indexed

event UpdateEmissionPartition

***MasterWombatV3.UpdateEmissionPartition(user, basePartition, boostedPartition) ***

Arguments

name

type

description

user

address

indexed

basePartition

uint256

not indexed

boostedPartition

uint256

not indexed

event UpdateVeWOM

***MasterWombatV3.UpdateVeWOM(user, oldVeWOM, newVeWOM) ***

Arguments

name

type

description

user

address

indexed

oldVeWOM

address

not indexed

newVeWOM

address

not indexed

event UpdateVoter

***MasterWombatV3.UpdateVoter(user, oldVoter, newVoter) ***

Arguments

name

type

description

user

address

indexed

oldVoter

address

not indexed

newVoter

address

not indexed

event Withdraw

***MasterWombatV3.Withdraw(user, pid, amount) ***

Arguments

name

type

description

user

address

indexed

pid

uint256

indexed

amount

uint256

not indexed

function ACC_TOKEN_PRECISION

MasterWombatV3.ACC_TOKEN_PRECISION() view

Outputs

name

type

description

uint256

function REWARD_DURATION

MasterWombatV3.REWARD_DURATION() view

Outputs

name

type

description

uint256

function add

***MasterWombatV3.add(_lpToken, _rewarder) ***

Notice: Add a new lp to the pool. Can only be called by the owner.

Details: Reverts if the same LP token is added more than once.

Arguments

name

type

description

_lpToken

address

the corresponding lp token

_rewarder

address

the rewarder

function basePartition

MasterWombatV3.basePartition() view

Outputs

name

type

description

uint16

function boostedPartition

MasterWombatV3.boostedPartition() view

Outputs

name

type

description

uint256

function calRewardPerUnit

MasterWombatV3.calRewardPerUnit(_pid) view

Arguments

name

type

description

_pid

uint256

Outputs

name

type

description

accWomPerShare

uint256

accWomPerFactorShare

uint256

function deposit

***MasterWombatV3.deposit(_pid, _amount) ***

Notice: Deposit LP tokens to MasterChef for WOM allocation.

Details: it is possible to call this function with _amount == 0 to claim current rewards

Arguments

name

type

description

_pid

uint256

the pool id

_amount

uint256

amount to deposit

Outputs

name

type

description

reward

uint256

additionalRewards

uint256[]

function depositFor

***MasterWombatV3.depositFor(_pid, _amount, _user) ***

Notice: Deposit LP tokens to MasterChef for WOM allocation on behalf of user

Details: user must initiate transaction from masterchef

Arguments

name

type

description

_pid

uint256

the pool id

_amount

uint256

amount to deposit

_user

address

the user being represented

function emergencyWithdraw

***MasterWombatV3.emergencyWithdraw(_pid) ***

Notice: Withdraw without caring about rewards. EMERGENCY ONLY.

Arguments

name

type

description

_pid

uint256

the pool id

function emergencyWomWithdraw

***MasterWombatV3.emergencyWomWithdraw() ***

Notice: In case we need to manually migrate WOM funds from MasterChef Sends all remaining wom from the contract to the owner

function getAssetPid

MasterWombatV3.getAssetPid(asset) view

Arguments

name

type

description

asset

address

Outputs

name

type

description

uint256

function initialize

***MasterWombatV3.initialize(_wom, _veWom, _voter, _basePartition) ***

Arguments

name

type

description

_wom

address

_veWom

address

_voter

address

_basePartition

uint16

function lastTimeRewardApplicable

MasterWombatV3.lastTimeRewardApplicable(_periodFinish) view

Arguments

name

type

description

_periodFinish

uint256

Outputs

name

type

description

uint256

function massUpdatePools

***MasterWombatV3.massUpdatePools() ***

Notice: Update reward variables for all pools.

Details: Be careful of gas spending!

function migrate

***MasterWombatV3.migrate(_pids) ***

Notice: Helper function to migrate fund from multiple pools to the new MasterWombat.user must initiate transaction from masterchef

Details: Assume the orginal MasterWombat has stopped emisions hence we skip IVoter(voter).distribute() to save gas cost

Arguments

name

type

description

_pids

uint256[]

function multiClaim

***MasterWombatV3.multiClaim(_pids) ***

Notice: claims rewards for multiple pids

Arguments

name

type

description

_pids

uint256[]

array pids, pools to claim

Outputs

name

type

description

reward

uint256

amounts

uint256[]

additionalRewards

uint256[][]

function notifyRewardAmount

***MasterWombatV3.notifyRewardAmount(_lpToken, _amount) ***

Notice: Distribute WOM over a period of 7 days

Details: Refer to synthetix/StakingRewards.sol notifyRewardAmount Note: This looks safe from reentrancy.

Arguments

name

type

description

_lpToken

address

_amount

uint256

function owner

MasterWombatV3.owner() view

Details: Returns the address of the current owner.

Outputs

name

type

description

address

function pause

***MasterWombatV3.pause() ***

Details: pause pool, restricting certain operations

function paused

MasterWombatV3.paused() view

Details: Returns true if the contract is paused, and false otherwise.

Outputs

name

type

description

bool

function pendingTokens

MasterWombatV3.pendingTokens(_pid, _user) view

Notice: View function to see pending WOMs on frontend.

Arguments

name

type

description

_pid

uint256

the pool id

_user

address

the user address

Outputs

name

type

description

pendingRewards

uint256

bonusTokenAddresses

address[]

bonusTokenSymbols

string[]

pendingBonusRewards

uint256[]

function poolInfo

MasterWombatV3.poolInfo(_pid) view

Notice: [Deprecated] A backward compatible function to return the PoolInfo struct in MasterWombatV2

Arguments

name

type

description

_pid

uint256

Outputs

name

type

description

lpToken

address

allocPoint

uint96

rewarder

address

sumOfFactors

uint256

accWomPerShare

uint104

accWomPerFactorShare

uint104

lastRewardTimestamp

uint40

function poolInfoV3

MasterWombatV3.poolInfoV3() view

Arguments

name

type

description

uint256

Outputs

name

type

description

lpToken

address

rewarder

address

periodFinish

uint40

sumOfFactors

uint128

rewardRate

uint128

accWomPerShare

uint104

accWomPerFactorShare

uint104

lastRewardTimestamp

uint40

function poolLength

MasterWombatV3.poolLength() view

Notice: returns pool length

Outputs

name

type

description

uint256

function renounceOwnership

***MasterWombatV3.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 rewarderBonusTokenInfo

MasterWombatV3.rewarderBonusTokenInfo(_pid) view

Notice: Get bonus token info from the rewarder contract for a given pool, if it is a double reward farm

Arguments

name

type

description

_pid

uint256

the pool id

Outputs

name

type

description

bonusTokenAddresses

address[]

bonusTokenSymbols

string[]

function setNewMasterWombat

***MasterWombatV3.setNewMasterWombat(_newMasterWombat) ***

Arguments

name

type

description

_newMasterWombat

address

function setRewarder

***MasterWombatV3.setRewarder(_pid, _rewarder) ***

Notice: Update the given pool's rewarder

Arguments

name

type

description

_pid

uint256

the pool id

_rewarder

address

the rewarder

function setVeWom

***MasterWombatV3.setVeWom(_newVeWom) ***

Notice: updates veWom address

Arguments

name

type

description

_newVeWom

address

the new VeWom address

function setVoter

***MasterWombatV3.setVoter(_newVoter) ***

Notice: updates voter address

Arguments

name

type

description

_newVoter

address

the new Voter address

function transferOwnership

***MasterWombatV3.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 unpause

***MasterWombatV3.unpause() ***

Details: unpause pool, enabling certain operations

function updateEmissionPartition

***MasterWombatV3.updateEmissionPartition(_basePartition) ***

Notice: updates emission partition

Arguments

name

type

description

_basePartition

uint16

the future base partition

function updateFactor

***MasterWombatV3.updateFactor(_user, _newVeWomBalance) ***

Notice: updates factor after any veWom token operation (minting/burning)

Details: can only be called by veWom

Arguments

name

type

description

_user

address

the user to update

_newVeWomBalance

uint256

the amount of veWOM

function updatePool

***MasterWombatV3.updatePool(_pid) ***

Notice: Update reward variables of the given pool

Arguments

name

type

description

_pid

uint256

the pool id

function userInfo

MasterWombatV3.userInfo(, ) view

Arguments

name

type

description

uint256

address

Outputs

name

type

description

amount

uint128

factor

uint128

rewardDebt

uint128

pendingWom

uint128

function veWom

MasterWombatV3.veWom() view

Outputs

name

type

description

address

function voter

MasterWombatV3.voter() view

Outputs

name

type

description

address

function withdraw

***MasterWombatV3.withdraw(_pid, _amount) ***

Notice: Withdraw LP tokens from MasterWombat.Automatically harvest pending rewards and sends to user

Arguments

name

type

description

_pid

uint256

the pool id

_amount

uint256

the amount to withdraw

Outputs

name

type

description

reward

uint256

additionalRewards

uint256[]

function wom

MasterWombatV3.wom() view

Outputs

name

type

description

address

Last updated