Skip to content

MplRewards

Satyam Agrawal edited this page Jul 16, 2021 · 2 revisions

Maple's liquidity mining program will use a fork of Synthetix liquidity mining. The code was modified to be in accordance with Maple protocol's style standards and to remove reentrancy checks that were not relevant to Maple's use case.

The diff between the modifications can be found here.

Also, a MplRewardsFactory was added and will be used to deploy MplRewards contracts.

MplRewards implements ERC2258 interface to avail the custodial ownership functionality. ERC2258 provides a way to keep the ownership to the original token holder while allows the holder to custody their tokens to someone else without losing the ownership rights. This specific functionality has proven very handy within the maple protocol because pool-lp tokens are FDT in nature that allows claiming the benefits (i.e interest) on the basis of ownership rights, So if the tokens get transferred to the MplRewards contract for the liquidity mining then there is a no way to claim the benefits for the user while MplRewards contract gets eligible for those benefits. To avoid this problem we choose to use ERC2258 that allows LP miners to custody their tokens to the MplRewards contract whilst collecting the benefits from the pool as well.

Below API gets used to increase the allowance provided to the custodian i.e MplRewards contract in the case of liquidity mining.

function increaseCustodyAllowance(address _custodian, uint256 _amount) external;

Whenever the pool-lp token holder stake into the MplRewards contract using stake() function then during this call execution custody allowance get verified whether the MplRewards has sufficient allowance or not.

Using withdraw() function call custody get released using the below API for the ERC2258.

function transferByCustodian(address _tokenHolder, address _receiver, uint256 _amount) external;