Withdraw Rewards
Withdrawing rewards from a Rewards Manager
To allow depositors to reclaim unutilized incentives, the Rewards Manager supports withdrawals of undripped reward assets. A depositor can withdraw rewards they have previously contributed to a reward pool, provided those rewards have not yet dripped.
Depositors may call RewardsManager.withdrawRewardAssets directly:
/// @notice Withdraw undripped reward assets.
/// @param rewardPoolId_ The ID of the reward pool to withdraw from.
/// @param rewardAssetAmount_ The amount of reward assets to withdraw.
/// @param receiver_ The address that will receive the withdrawn assets.
function withdrawRewardAssets(
uint16 rewardPoolId_,
uint256 rewardAssetAmount_,
address receiver_
) external;This method will:
Preview withdrawable rewards: Check the caller’s current withdrawable rewards using
_previewCurrentWithdrawableRewards.Validate request: Revert if
rewardAssetAmount_exceeds the caller’s withdrawable rewards.Update accounting: Reduce the caller’s
depositorRewardsbalance and the pool’sundrippedRewardsand asset totals.Transfer assets: Send the specified reward assets to the
receiver_.Emit event: Log the withdrawal in a
Withdrawnevent.
To withdraw on behalf of another user, you may use RewardsManager.withdrawRewardAssetsBySig
The owner must sign a digest that matches the above.
Fetch Domain Separator via external
domainSeparator()getter and nonce via externaleip712Nonces(owner, actionKey)(actionKey is the relevant typehash) getter. Both are exposed in IRewardsManager.The above
withdrawRewardAssetsBySigfunction is truncated to only show the relevant structure of the digest.
Before withdrawing, users may use previewCurrentWithdrawableRewards to determine how many rewards a depositor is eligible to withdraw:
This function accounts for:
Epoch changes: If the depositor’s rewards belong to an expired epoch, withdrawable rewards are set to 0.
Drip updates: If rewards have dripped since the last update, withdrawable rewards are scaled down accordingly.
Stable snapshots: If no drip has occurred since the depositor’s last update, withdrawable rewards remain unchanged.
Last updated