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

Withdrawals

Explore the withdraw function

By calling withdrawTo, the user burns IbAlluo in return for tokens of their choice. This happens in the opposite way as depositing:

  1. Burn the correct amount of IbAlluos

  2. If the token the user wants to receive is in the list of supported tokens, withdraw this from the handler to the user

  3. If the token the user wants to receive is NOT in the list of supported tokens, the handler converts the amount in asset value to the target token and sends it to the user.

Using IbAlluoUSD as an example, if you called withdrawTo("Bob's Address", "USDC address", "$100"):

  1. Burn $100 worth of IbAlluos

  2. As USDC is supported in IbAlluoUSD, send $100 USD to the user.

Using IbAlluoUSD as an example, if you called withdrawTo("Bob's Address", "EURS address", "$100"):

  1. Burn $100 worth of IbAlluos

  2. As EURS is not supported in IbAlluoUSD, the handler converts $100 into EURS tokens and sends that amount to the user

The _amount parameter is the amount in the native asset value of the IbAlluo you are interacting with. For example, USD for IbAlluoUSD or EUR for IbAlluoEUR. Then if the _targetToken is not part of the supported tokens like in the second example above, you are withdrawing $100 USD worth of EUR tokens, not €100!

IbAlluo.sol
/// @notice  Withdraws accuratel
/// @dev When called, immediately check for new interest index. Then find the adjusted amount in IbAlluo tokens
///      Then burn appropriate amount of IbAlluo tokens to receive asset token
/// @param _targetToken Asset token
/// @param _amount Amount (parsed 10**18) in asset value

function withdrawTo(
    address _recipient,
    address _targetToken,
    uint256 _amount
) public {
    updateRatio();
    uint256 adjustedAmount = (_amount * multiplier) / growingRatio;
    _burn(_msgSender(), adjustedAmount);
    ILiquidityHandler handler = ILiquidityHandler(liquidityHandler);
    if (supportedTokens.contains(_targetToken) == false) {
        (address liquidToken,) = ILiquidityHandler(liquidityHandler).getAdapterCoreTokensFromIbAlluo(address(this));
        // This just is used to revert if there is no active route.
        require(IExchange(exchangeAddress).buildRoute(liquidToken, _targetToken).length > 0, "!Supported");
        handler.withdraw(
        _recipient,
        liquidToken,
        _amount,
        _targetToken
        );
    } else {
        handler.withdraw(
        _recipient,
        _targetToken,
        _amount
        );
    }

    emit TransferAssetValue(_msgSender(), address(0), adjustedAmount, _amount, growingRatio);
    emit BurnedForWithdraw(_msgSender(), adjustedAmount);
}

For more information about how the liquidity handler works, explore the LiquidityHandler and adapters page

PreviousDepositingNextIbAlluo on different chains

Last updated 2 years ago

πŸ‘¨β€πŸ”¬