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

Deposit into the Vault

While there is only 1 underlying LP token per vault, Alluo enables you to deposit and withdraw in any token supported by the Alluo Exchange

There are two ways you can Deposit:

1. Deposit with the underlying LP token

You can either use the standard ERC4626 Deposit and Mint functions

Alluo Vault
/// @notice Deposits an amount of LP underlying and mints shares in the vault.
/// @dev Read the difference between deposit and mint at the start of the contract. Makes sure to distribute rewards before any actions occur
/// @param assets Amount of assets deposited
/// @param receiver Recipient of shares
/// @return New amount of shares minted
function deposit(uint256 assets, address receiver) public override returns(uint256) {
    //// 
    // Rewards are distributed BEFORE new shares are minted to ensure that correct reward distribution is achieved
    //
    _distributeReward(_msgSender());
    require(assets <= maxDeposit(receiver), "ERC4626: deposit more than max");
    uint256 shares = previewDeposit(assets);
    _deposit(_msgSender(), receiver, assets, shares);
    return shares;
}

Deposit is adding an exact amount of underlying LP tokens for a certain amount of shares in the Vault. Mint is adding enough underlying LP tokens to mint an exact amount of shares in the vault.

2. Deposit with non LP tokens:

You can use the function below to deposit a quantity of your ERC20 token for shares in the Vault.

For this specific StEth-Eth example, there are extra steps to be compatible with native ETH but all Vaults follow this fundamental logic when depositing ERC20 tokens that are not the underlying LP token.

  1. Swap the entryToken to one of the poolTokens supported by the Curve Pool.

  2. Get the LP and mint the correct amount of shares

AlluoStEthEthVault.sol
/// @notice Deposits an amount of any ERC20 and mints shares in the vault.
/// @dev Read the difference between deposit and mint at the start of the contract. Makes sure to distribute rewards before any actions occur
///      Converts all the entry tokens to a token eligible for adding liquidity. Then carry out same deposit procedure
/// @param assets Amount of assets deposited
/// @param entryToken Recipient of shares
/// @return New amount of shares minted
function depositWithoutLP(uint256 assets, address entryToken) public  returns(uint256) {
    _distributeReward(_msgSender());
    IERC20MetadataUpgradeable(entryToken).safeTransferFrom(_msgSender(), address(this), assets);
    IERC20MetadataUpgradeable(entryToken).safeIncreaseAllowance(address(exchange), assets);
    assets = exchange.exchange(entryToken,asset(),assets,0);
    require(assets <= _nonLpMaxDeposit(assets), "ERC4626: deposit more than max");
    uint256 shares = _nonLpPreviewDeposit(assets);
    _mint(_msgSender(), shares);
    emit Deposit(_msgSender(), _msgSender(), assets, shares);
    return shares;
}
PreviousTech deep dive: Boosting yield by compounding rewardsNextWithdraw from the Vault

Last updated 2 years ago

πŸ‘¨β€πŸ”¬