Alluo Explained
Search
⌃K

FraxConvex Vaults

Depositing into Frax Convex Vault is different from other Vaults because it operates with locking cycles of 7 days.
Alluo Locked Vaults architecture

Depositing

Depositing works the same way as with other vaults, it may be done in underlying pool LPs or in other Alluo Vault supported tokens.
All deposits made are locked into Frax Convex and start earning rewards that will be available for withdrawal at the end of the locking period (every 7 days).

Withdrawing

To withdraw funds from Alluo Frax Vault a user has to go through 2 steps:
  1. 1.
    Request withdrawal.
  2. 2.
    Claim the requested amount once the funds are unlocked.
_withdraw()executes withdrawal requests by adding the user to the queue:
```solidity
/// @notice Puts a withdrawal request to be satisfied after the next farming cycle
/// @dev Called by withdraw() and redeem()
function _withdraw(
address caller,
address receiver,
address owner,
uint256 assets,
uint256 shares
) internal virtual override {
_distributeReward(_msgSender());
if (caller != owner) {
_spendAllowance(owner, caller, shares);
}
require(
userWithdrawals[owner].withdrawalRequested + assets <=
previewRedeem(maxRedeem(owner))
);
​
if (userWithdrawals[owner].withdrawalRequested == 0) {
withdrawalqueue.push(owner);
userWithdrawals[owner].id = withdrawalqueue.length; // will alsways be > 0
}
​
userWithdrawals[owner].withdrawalRequested += assets;
emit Withdraw(caller, receiver, owner, assets, shares); //should we keep event here?
}
```
claim() transfers unlocked requested amount of LPs to the user in the form of a chosen exitToken.
```solidity
/// @notice Claims the unlocked funds previously requested for withdrawal
/// @dev Unwraps claimed lp tokens, exchanges them to the exit token and sends to the user
/// @param exitToken the token to be transferred to the user
/// @param receiver Recipient of the tokens
function claim(address exitToken, address receiver)
external
virtual
returns (uint256 amount)
{
amount = userWithdrawals[receiver].withdrawalAvailable;
if (amount > 0) {
totalRequestedWithdrawals -= amount;
delete userWithdrawals[receiver];
IConvexWrapper(stakingToken).withdrawAndUnwrap(amount);
if (exitToken != asset()) {
IERC20MetadataUpgradeable(asset()).safeIncreaseAllowance(
address(EXCHANGE),
amount
);
amount = EXCHANGE.exchange(asset(), exitToken, amount, 0);
}
IERC20MetadataUpgradeable(exitToken).safeTransfer(receiver, amount);
}
}
```

Rewards

The rewards stop accumulating after the funds are unlocked if there was a prior withdrawal request. A user can withdraw rewards in any exitToken by calling claimRewards()
/// @notice Allows users to claim their rewards in an ERC20 supported by the Alluo exchange
/// @dev Withdraws all reward tokens from the alluo pool and sends it to the user after exchanging it.
/// @return rewardTokens value of total reward tokens in exitTokens
function claimRewards(address exitToken)
external
returns (uint256 rewardTokens)
{
_distributeReward(_msgSender());
rewardTokens = rewards[_msgSender()];
if (rewardTokens > 0) {
rewards[_msgSender()] = 0;
IAlluoPool(alluoPool).withdraw(rewardTokens);
if (exitToken != address(rewardToken)) {
rewardToken.safeIncreaseAllowance(
address(EXCHANGE),
rewardTokens
);
rewardTokens = EXCHANGE.exchange(
address(rewardToken),
exitToken,
rewardTokens,
0
);
}
IERC20MetadataUpgradeable(exitToken).safeTransfer(
_msgSender(),
rewardTokens
);
}
}

Token transfers

Users can transfer Vault tokens whenever they want, provided they have not put a withdrawal request. The amount that has been requested for withdrawal cannot be transferred.