Alluo Explained
  • Welcome
    • 🧭 The Basics
  • Getting Started
    • πŸ’» The DeFi Web App
      • ❓ Connecting to the app
      • 🚜 Depositing into the farms
      • πŸ™Œ Other basics
      • 🏦 Importing your Mobile app wallet to Metamask
      • 🧬 Add the polygon network manually in Metamask.
      • ⛓️ Bridging Stablecoins from another chain
    • πŸ“±The Mobile app
      • πŸ—οΈ Setting up your account
      • 🏦 Depositing money into the app
      • πŸ™Œ Other basics
      • πŸ” Exporting your private key
    • πŸ“–Tech deep dive: Contract Address Library
  • Understanding Alluo
    • πŸ’΅ How does Alluo get the yield?
      • 🐰 Going deeper into the Alluo protocol rabbit hole
    • 🧐 FAQ
  • Tokens & Tokenomics
    • πŸͺ™ The tokens
    • πŸ‘¨β€πŸ”¬Tech deep dive: Interest Bearing {asset} token
      • Depositing
      • Withdrawals
      • IbAlluo on different chains
      • StIbAlluo and Superfluid
        • A closer look at the integration between IbAlluo and StIbAlluo
      • Using the IbAlluo contract directly to create streams
      • Liquidity Handler and adapters
        • Deposit process with the Liquidity Handler
        • Withdraw process with the Liquidity Handler
    • πŸ“ˆ Tokenomics
    • πŸ‘¨β€πŸ”¬Tech deep dive: Boosting yield by compounding rewards
      • Deposit into the Vault
      • Withdraw from the Vault
      • Redeem rewards
      • Automatic boosting with Alluo
      • FraxConvex Vaults
      • Managing withdrawal requests in IERC4626
  • Decentralisation and Trust
    • πŸ—³οΈ Trustless governance and execution
    • πŸ‘¨β€πŸ”¬Tech deep dive: Vote Executor Architecture
      • Off chain votes to on chain data
      • Onchain data verifcation
      • Automated execution of votes
        • Tokenomics
        • Liquidity Direction
        • Setting APYs on farms
      • Cross chain execution of votes
      • Manually submitting vote results onchain
    • ↔️Alluo Exchange
      • Interacting with the Exchange
    • vlAlluo Architecture
    • Contracts upgrades
    • Investment strategies
      • πŸ“ˆFrax Convex Finance
        • Adding new pools into the strategy
        • Investing into a pool
  • More Advanced Features
    • πŸ” Repeat payments, streaming IbAlluo
  • Product Updates
    • πŸ‘Œ Product Roadmap: Building the right products
    • πŸ’» Web App releases
    • πŸ“± Mobile App releases
    • 🏎️ Alluo Boost
  • tutorial projects
    • Example: USDC to streaming 1 IbAlluo per second
    • Example: Using IbAlluoUSD and Ricochet to do capital efficient DCA into ETH
Powered by GitBook
On this page
  1. Tokens & Tokenomics
  2. Tech deep dive: Boosting yield by compounding rewards

FraxConvex Vaults

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

PreviousAutomatic boosting with AlluoNextManaging withdrawal requests in IERC4626

Last updated 2 years ago

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. Request withdrawal.

  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.

πŸ‘¨β€πŸ”¬
Alluo Locked Vaults architecture