How It Works
This document explains the complete flow of interacting with Unbound, from deposit to withdrawal.Deposit Flow
Step 1: User Initiates Deposit
The user callsdeposit_and_leverage with:
assets: Amount of wBTC to depositflash_loan_amount: Amount of USDC to flash loanmin_collateral_out: Minimum wBTC expected from swap (slippage protection)avnu_calldata: Pre-computed swap calldata from AVNU API
Step 2: Flash Loan Request
on_flash_loan callback.
Step 3: Executor Operations
Inside the flash loan callback, Executor performs:Step 4: Share Minting
After the flash loan completes, the Vault:- Calculates shares based on deposited assets
- Mints vault shares (uBTC) to the user
Deposit Flow Diagram
Withdrawal Flow
Step 1: User Initiates Withdrawal
The user callswithdraw_all to close their entire position.
Step 2: Share Burning
Vault calculates the user’s share of the position and burns their vault tokens.Step 3: Flash Loan for Deleveraging
Step 4: Executor Unwind
Inside the callback:Withdrawal Flow Diagram
Position State
After a successful deposit, the vault has:| Component | Location |
|---|---|
| Collateral (wBTC) | Vesu Pool (as collateral in position) |
| Debt (USDC) | Vesu Pool (borrowed amount) |
| Shares (uBTC) | User’s wallet |
