Skip to main content

MiniChef

The MiniChef contract plays the same role as the MasterChef contract does, with the main exception being that they are deployed across L2's, whereas MasterChef is deployed on the Ethereum mainnet.

The full contract can be found here.

Functions

poolLength

function poolLength() public view returns (uint256 pools)

View function that returns the number of MiniChef pools.

add

function add(uint256 allocPoint, IERC20 _lpToken, IRewarder _rewarder) public onlyOwner

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
_allocPointuint256number of allocation points assigned to pool
_lpTokenIERC20address of ERC20 token that will be staked
_rewarderIRewarderimplementation of rewarder contract

set

function set(uint256 _pid, uint256 _allocPoint, IRewarder _rewarder, bool overwrite) public onlyOwner

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

Parameters

NameTypeDescription
_piduint256pool ID of pool to update
_allocPointuint256number of allocation points assigned to pool
_rewarderIRewarderimplementation of rewarder contract
overwritebooltrue if _rewarder should be set, otherwise false

setSushiPerSecond

function setSushiPerSecond(uint256 _sushiPerSecond) public onlyOwner

Sets the SUSHI per second to be distributed. Can only be called by the owner of the contract.

Parameters

NameTypeDescription
_sushiPerSeconduint256amount of SUSHI to distribute per second

setMigrator

function setMigrator(IMigratorChef _migrator) public onlyOwner

Sets the migrator contract. Can only be called by the owner of the contract.

Parameters

NameTypeDescription
_migratorIMigratorChefcontract address of migrator to set

migrate

function migrate(uint256 _pid) public

Migrates an LP token to another LP contract through the migrator contract.

Parameters

NameTypeDescription
_piduint256pool ID to migrate an LP to

pendingSushi

function pendingSushi(uint256 _pid, address _user) external view returns (uint256 pending)

View function to see pending SUSHI on the frontend and returns the pending SUSHI rewards for a given user.

Parameters

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

Returns

NameTypeDescription
pendinguint256amount of pending SUSHI rewards the given user has

massUpdatePools

function massUpdatePools(uint256[] calldata pids) external

Updates the reward variables for all of the pools. Be careful of gas spending!

Parameters

NameTypeDescription
pidsuint256[]pool IDs of pools to update

updatePool

function updatePool(uint256 pid) public returns (PoolInfo memory pool)

Updates rewards variables for the given pool and returns the pool that was updated.

Parameters

NameTypeDescription
piduint256pool ID of pool to update

Returns

NameTypeDescription
poolPoolInfopool that was updated

deposit

function deposit(uint256 pid, uint256 amount, address to) public

Deposits LP tokens to the MiniChef for SUSHI allocation. !!

Parameters

NameTypeDescription
piduint256pool ID of pool to to deposit LP tokens from
amountuint256amount of LP tokens to deposit
toaddressaddress of the receiver of the LP tokens

withdraw

function withdraw(uint256 pid, uint256 amount, address to) public

Withdraws LP tokens from the MiniChef. !!

Parameters

NameTypeDescription
piduint256pool ID of pool to to withdraw LP tokens from
amountuint256amount of LP tokens to withdraw
toaddressaddress of the receiver of the LP tokens

harvest

function harvest(uint256 pid, address to) public

Harvests SUSHI rewards for transaction sender to to.

Parameters

NameTypeDescription
piduint256pool ID of pool to harvest from
toaddressaddress of the receiver of the harvested SUSHI rewards

withdrawAndHarvest

function withdrawAndHarvest(uint256 pid, uint256 amount, address to) public

Withdraws LP tokens from the MiniChef and harvests SUSHI rewards for transaction sender to to.

Parameters

NameTypeDescription
piduint256pool ID of pool to to withdraw LP tokens from
amountuint256amount of LP tokens to withdraw
toaddressaddress of the receiver of the LP tokens and SUSHI rewards

emergencyWithdraw

function emergencyWithdraw(uint256 pid, address to) public

Withdraws LP tokens without caring about rewards. To be used in emergencies only.

Parameters

NameTypeDescription
piduint256pool ID of pool to withdraw LP tokens from
toaddressaddress of the receiver of the LP tokens