Deposit Rewards

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

Depositors receive receipt tokens, which can be exchanged for undripped rewards (see Redeem Undripped Rewards), not dripped rewards.

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 assets into a `rewardsManager_` reward pool. Mints `depositReceiptTokenAmount_` to `receiver_`
/// by depositing 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_,
    address receiver_
) external payable returns (uint256 depositReceiptTokenAmount_);

This method will:

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

  • Drip any pending rewards in the reward pool by calling RewardsManager.dripRewardPool.

  • Call RewardsManager.depositRewardAssetsWithoutTransfer.

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

Note: Directly calling RewardsManager.depositRewardAssets or RewardsManager.depositRewardAssetsWithoutTransfer may have different behavior than going through CozyRouter because those functions do not automatically drip the reward pool on the rewards deposit. Depending on the mechanics of your drip model, this may affect when and how much rewards drip and hence the rewards APY.

Deposit mechanics

RewardsManager.depositRewardAssetsWithoutTransfer 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.

  • Mint the receiver_ address deposit receipt tokens.

  • Emit a Deposited event.

Last updated