Redeem rewards
Here we explore how rewards can be withdrawn in CVX-ETH LPs or any ERC20 supported by the Alluo Exchange
There are two ways you can withdraw your rewards accumulated through your principal:
1. Withdraw the actual CVX-ETH LP token that is generating yield in the Alluo Pool.
/// @notice Allows users to claim their rewards
/// @dev Withdraws all reward tokens from the alluo pool and sends it to the user.
/// @return Uint256 value of total reward tokens
function claimRewards() public returns (uint256) {
_distributeReward(_msgSender());
uint256 rewardTokens = rewards[_msgSender()];
if (rewardTokens > 0) {
rewards[_msgSender()] = 0;
IAlluoPool(alluoPool).withdraw(rewardTokens);
rewardToken.safeTransfer(_msgSender(), rewardTokens);
}
return rewardTokens;
}
2. Withdraw in non CVX-ETH LP tokens:
This function simply takes one extra step to exchange the CVX-ETH LP reward tokens into the ERC20 token of the user's choosing before sending it to them.
Last updated