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.
To deposit reward assets, RewardsManager.depositRewardAssets
or RewardsManager.depositRewardAssetsWithoutTransfer
can be used:
RewardsManager.depositRewardAssets
requires the depositor to have approved RewardsManager
to a spend sufficient amount of their RewardsManager.rewardPools(rewardPoolId).asset
balance.
RewardsManager.depositRewardAssetsWithoutTransfer
requires the RewardsManager.rewardPools(rewardPoolId).asset
amount being deposited to be transferred to the Rewards Manager beforehand.
Using CozyRouter to deposit assets
Using the CozyRouter may be preferable in cases where integrators would like to batch several Safety Module / Rewards Manager related function calls into a single transaction (e.g. wrap ETH to WETH and deposit).
To deposit assets using the CozyRouter, integrators can use CozyRouter.depositRewardAssets
:
This method will:
Transfer the underlying reward assets from the
msg.sender
to the Rewards Manager.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.
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