Alluo Explained
Search
⌃K

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.

Alluo Vault
1
/// @notice Allows users to claim their rewards
2
/// @dev Withdraws all reward tokens from the alluo pool and sends it to the user.
3
/// @return Uint256 value of total reward tokens
4
function claimRewards() public returns (uint256) {
5
_distributeReward(_msgSender());
6
uint256 rewardTokens = rewards[_msgSender()];
7
if (rewardTokens > 0) {
8
rewards[_msgSender()] = 0;
9
IAlluoPool(alluoPool).withdraw(rewardTokens);
10
rewardToken.safeTransfer(_msgSender(), rewardTokens);
11
}
12
return rewardTokens;
13
}
14
​
Remember that CRV,CVX and any bonus reward tokens from staking LPs are being concurrently generated in both the Vault (through the principal LP token) and the Alluo Pool (through the staked CVX-ETH LP purchased with rewards generated by the principal)

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.
AlluoStEthEthVault.sol
1
/// @notice Allows users to claim their rewards in an ERC20 supported by the Alluo exchange
2
/// @dev Withdraws all reward tokens from the alluo pool and sends it to the user after exchanging it.
3
/// @return Uint256 value of total reward tokens in exitTokens
4
function claimRewardsInNonLp(address exitToken) public returns (uint256) {
5
_distributeReward(_msgSender());
6
uint256 rewardTokens = rewards[_msgSender()];
7
if (rewardTokens > 0) {
8
rewards[_msgSender()] = 0;
9
IAlluoPool(alluoPool).withdraw(rewardTokens);
10
rewardToken.safeIncreaseAllowance(address(exchange),rewardTokens);
11
rewardTokens = exchange.exchange(address(rewardToken), exitToken, rewardTokens,0);
12
IERC20MetadataUpgradeable(exitToken).safeTransfer(_msgSender(), rewardTokens);
13
}
14
return rewardTokens;
15
}
16
​