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

Managing withdrawal requests in IERC4626

PreviousFraxConvex VaultsNextπŸ—³οΈ Trustless governance and execution

Last updated 2 years ago

Managing withdrawal queue

To request a withdrawal a user calls withdraw(uint256 assets, address receiver, address owner) specifying the amount of LP tokens they want to withdraw. At this point they are added to the queue.

Every ~7 days Alluo Booster Pool calls loopRewards() , where the following steps are executed:

  1. funds are unlocked from Frax

  2. _processWithdrawalRequests() keeps the amount of LPs requested for withdrawals and burns the shares of users who are in the withdrawal queue

  3. _relockToFrax() relocks the remaing funds into Frax Convex again

  4. current rewards per share are updated

Keeping totalAssets() consistent

Since shares are minted 1:1 ot deposited assets, total supply of shares should always be equal to total amount of assets in the vault. Total assets comprise the following:

  • underlying pool lp token

  • wrapped lp token

  • funds locked in frax convex

When shares are burnt during a harvest, factual amount of assets does not change until users claim their withdrawals. Up until then to balance out burnt shares the contract keeps track of unsatisfied withdrawal requests in totalRequestedWithdrawals which is included into totalAssets() calculation.

Example

  1. Imagine you deposit $100. userWithdrawals.withdrawalRequested=0, userWithdrawals.withdrawalAvailable=0, balanceOf() = 100

  2. you withdraw() $50 userWithdrawals.withdrawalRequested=50, userWithdrawals.withdrawalAvailable=0, balanceOf() = 100

  3. you decide to withdraw $20 more, you call withdraw(20). userWithdrawals.withdrawalRequested=70, userWithdrawals.withdrawalAvailable=0, balanceOf() = 100

  4. Funds are unlocked by resolver. userWithdrawals.withdrawalRequested=0, userWithdrawals.withdrawalAvailable=70, balanceOf() = 30

  5. You put another request to withdraw $10. userWithdrawals.withdrawalRequested=10, userWithdrawals.withdrawalAvailable=70, balanceOf() = 30

  6. Funds are unlocked after the next cycle. userWithdrawals.withdrawalRequested=0, userWithdrawals.withdrawalAvailable=80, balanceOf() = 20

  7. You finally claim() and $80 are transferred to you. userWithdrawals.withdrawalRequested=0, userWithdrawals.withdrawalAvailable=0, balanceOf() = 20

πŸ‘¨β€πŸ”¬
Deposits and withdrawals flow with corresponding changes of contract storage variables