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: Interest Bearing {asset} token

Depositing

Exploring how the deposit function works

Deposits

Using IbAlluoUSD as an example, users can call the deposit function using one of the stablecoins in the list of supported tokens.

IbAlluo.sol
function getListSupportedTokens() public view returns (address[] memory) {
    return supportedTokens.values();
}

    
function deposit(address _token, uint256 _amount) external {
    if (supportedTokens.contains(_token) == false) {
        ///Case 2, read below
        IERC20Upgradeable(_token).safeTransferFrom(_msgSender(), address(this), _amount);
        (, address primaryToken) = ILiquidityHandler(liquidityHandler).getAdapterCoreTokensFromIbAlluo(address(this));
        IERC20Upgradeable(_token).safeIncreaseAllowance(exchangeAddress, _amount);
        _amount = IExchange(exchangeAddress).exchange(_token, primaryToken, _amount, 0);
        _token = primaryToken;
        IERC20Upgradeable(primaryToken).safeTransfer(address(liquidityHandler), _amount);
    } else {
        /// Case 1, read below
        IERC20Upgradeable(_token).safeTransferFrom(_msgSender(),address(liquidityHandler),_amount);
    }
    updateRatio();
    ILiquidityHandler(liquidityHandler).deposit(_token, _amount);
    uint256 amountIn18 = _amount * 10**(18 - AlluoERC20Upgradable(_token).decimals());
    uint256 adjustedAmount = (amountIn18 * multiplier) / growingRatio;
    _mint(_msgSender(), adjustedAmount);
    emit TransferAssetValue(address(0), _msgSender(), adjustedAmount, amountIn18, growingRatio);
    emit Deposited(_msgSender(), _token, _amount);
}

Case 1: If you deposit a token that is a 'supported' token:

If you deposit a supported token, it is sent to our liquidity handler and then the correct amount of IbAlluos are minted to the caller.

Case 2: If you deposit a token that is NOT a 'supported' token:

If you deposit a non-supported token, it is exchanged for the primaryToken for the IbAlluo through the Alluo Exchange and then the rest of the deposit process is completed.

Case 3: If you deposit a non-supported token and it is not supported by the Alluo Exchange:

If the deposit token is not supported and it is not added to the Alluo Exchange, the function call will revert.

PreviousTech deep dive: Interest Bearing {asset} tokenNextWithdrawals

Last updated 2 years ago

πŸ‘¨β€πŸ”¬