Skip to main content

MISOMasterChef

The MISOMasterChef contract is in charge of alll the rewards in MISO... he's kind of a big deal.

The full contract can be found here.

Functions

getInitData

function getInitData(
address _rewards,
uint256 _rewardsPerBlock,
uint256 _startBlock,
address _divaddr,
address _accessControls
)
external
pure
returns (bytes memory _data)

Generates the init data for Farm Factory.

Parameters

NameTypeDescription
_rewardsaddressrewards token address
_rewardsPerBlockuint256rewards per block for whole farm
_startBlockuint256starting block
_divaddraddressany donations if set are sent here
_accessControlsaddressaddress of accessControls

Returns

NameTypeDescription
_databytesabi-encoded parameters

setBonus

function setBonus(
uint256 _bonusEndBlock,
uint256 _bonusMultiplier
) public

Sets the bonus rewards for the farm. Can only be called by the owner of the contract. !!

Parameters

NameTypeDescription
_bonusEndBlockuint256block to end the bonus on
_rewardsPerBlockuint256amount of bonus per block to award

poolLength

function poolLength() external view returns (uint256)

View function that returns how many pools are in the farm. !!

addToken

function addToken(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public

Adds a new LP to the pool. Can only be called by the owner of the contract.

Note: Do NOT add the same LP token more than once; rewards will be messed up if you do!

Parameters

NameTypeDescription
_allocPointuint256allocation point for the LP
_lpTokenIERC20the LP token to be added
_withUpdateboolboolean of whether update has started or not

set

function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public

Updates the given pool's token allocation point. Can only be called by the owner of the contract.

Parameters

NameTypeDescription
_piduint256pool ID that you want to change the allocation point for
_allocPointuint256LP allocation point to change to
_withUpdateboolboolean of whether update has started or not

getMultiplier

function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256)

Returns the reward multiplier over the given _from to _to block.

Parameters

NameTypeDescription
_fromuint256block to start calculating the reward multiplier from
_touint256block to stop calculating the reward multiplier up to

pendingRewards

function pendingRewards(uint256 _pid, address _user) external view returns (uint256)

View function to see pending token rewards on the frontend.

Parameters

NameTypeDescription
_piduint256pool ID of pool to check rewards from
_useraddressaddress of user to check rewards for

massUpdatePools

function massUpdatePools() public

Updates the reward variables for all pools.

Note: Be careful of gas spending!

updatePool

function updatePool(uint256 _pid) public

Updates the reward variables of a given pool to be up-to-date.

Parameters

NameTypeDescription
_piduint256pool ID of pool to update rewards for

deposit

function deposit(uint256 _pid, uint256 _amount) public

Deposits LP tokens to MasterChef for rewards allocation.

Parameters

NameTypeDescription
_piduint256pool ID of pool to deposit LP tokens from
_amountuint256amount of LP tokens to deposit

withdraw

function withdraw(uint256 _pid, uint256 _amount) public

Withdraws LP tokens from MasterChef.

Parameters

NameTypeDescription
_piduint256pool ID of pool to withdraw LP tokens from
_amountuint256amount of LP tokens to withdraw

emergencyWithdraw

function emergencyWithdraw(uint256 _pid) public

Withdraws LP without caring for rewards. Use in EMERGENCIES only

Parameters

NameTypeDescription
_piduint256pool ID of pool to emergency withdraw from

safeRewardsTransfer

function safeRewardsTransfer(address _to, uint256 _amount) internal

An internal safe rewards transfer function, used in case of rounding errors causing a pool to not have enough tokens.

Parameters

NameTypeDescription
_toaddressaddress to transfer tokens to
_amountuint256amount of tokens to transfer

tokensRemaining

function tokensRemaining() public view returns(uint256)

View function that returns how many tokens the farm is holding. !!

tokenDebt

function tokenDebt() public view returns(uint256)

View function that returns the total amount of token debt. !!

blocksRemaining

function blocksRemaining() public view returns (uint256)

View function that returns the number of blocks remining with the current rewards balance.

claimTips

function claimTips() public

Claims any rewards for the developers, if set.

dev

function dev(address _devaddr) public

Update the developer address, by the previous dev (ie, can only be set by the previous devaddr).

Parameters

NameTypeDescription
_devaddraddressnew dev address to set to

setDevPercentage

function setDevPercentage(uint256 _devPercentage) public

Updates the developer percentage, if applicable.

Parameters

NameTypeDescription
_devPercentageuint256dev percentage to update to