Yield Protocol - Masterchef

More deets on the loveable Masterchef.

A caller will deposit crypto into a Masterchef smart contract. The Masterchef will emit rewards to each caller based on their allocation of crypto & the amount of time that has passed. Pending rewards need to be claimed by the caller by interacting with the Masterchef again.

The Masterchef smart contract exposes two functions: function deposit(uint256 _pid, uint256 _amount) external; function withdraw(uint256 _pid, uint256 _amount) external;

When deposit is called, two things will happen: Claim any pending rewards by transferring the reward tokens to the caller. Transfer the _amount of token from the caller into the masterchef. The token transferred is specified by _pid It’s important to note that for Masterchefs, claiming rewards is done by calling deposit with an amount of 0. Other “stake & earn” protocols may have a separate claimRewards function.

When withdraw is called, two things will happen: Claim any pending rewards. Transfer the _amount of tokens from the masterchef to the caller.

Last updated