Flash Actions
Step-by-step guide to building atomic strategies with Lotus flash loans and callbacks, including leveraged positions, refinancing, and collateral swaps.
┌─────────────────────────────────────────────────────────────────────┐
│ Flash Loan and Callback Sequence │
└─────────────────────────────────────────────────────────────────────┘
Caller Contract Lotus Core Caller Callback
─────────────── ────────── ───────────────
│ │ │
│ flashLoan(...) │ │
├─────────────────────►│ │
│ │ │
│ │ Transfer assets │
│◄─────────────────────┤ │
│ │ │
│ │ onFlashLoan(...) │
│ ├──────────────────────►│
│ │ │
│ │ Execute custom logic:
│ │ - Swap assets
│ │ - Supply collateral
│ │ - Borrow from tranche
│ │ - Arbitrage
│ │ │
│ │ Return control │
│ │◄──────────────────────┤
│ │ │
│ │ Verify repayment │
│ Repay exact amount │ (no fee) │
├─────────────────────►│ │
│ │ │
│ Success ✓ │ │
│◄─────────────────────┤ │
│ │ │Last updated

