Deposit Rewards

To incentivize stakers, users can deposit rewards into a Rewards Manager.

Using CozyRouter to deposit assets

Using the CozyRouter is the preferable way to deposit reward assets. To deposit assets using the CozyRouter, integrators can use CozyRouter.depositRewardAssets:

/// @notice Deposits exactly `rewardAssetAmount_` of the reward pool's underlying tokens into the `rewardsManager_`.
/// The specified amount of assets are transferred from the caller to the `rewardsManager_`.
/// @dev This will revert if the router is not approved for at least `rewardAssetAmount_` of the reward pool's
/// underlying asset.
function depositRewardAssets(IRewardsManager rewardsManager_, uint16 rewardPoolId_, uint256 rewardAssetAmount_)
    external
    payable;

This method will:

  • Transfer the underlying reward assets from the msg.sender to the Rewards Manager.

  • Call RewardsManager.depositRewardAssetsWithoutTransfer.

**Note that fee on transfer tokens are not supported.

Prior to calling this function, the user must have approved CozyRouter to a spend sufficient amount of their RewardsManager.rewardPools(rewardId).asset balance.

Deposit mechanics

RewardsManager.depositRewardAssetsWithoutTransferarrow-up-right assumes that the assets to be deposited has already been transferred to the Rewards Manager. Any excess assets transferred will be kept by the Rewards Manager.

On deposit, high-level the Rewards Manager does the following:

  • Check if the Rewards Manager is PAUSED. If so, revert.

  • Check the Rewards Manager's asset balance to determine if the total deposit amount was transferred. If not, revert.

  • Update the relevant reward pool's internal rewardPool.undrippedRewards value.

  • Emit a Deposited event.

Last updated