Flash Loans and Callbacks
Learn how Lotus flash loans and operation callbacks enable atomic strategies like leveraged positions, refinancing, collateral swaps, and liquidation flows.
Flash loans
┌─────────────────────────────────────────────────────────────────────┐
│ Flash Loan Flow │
└─────────────────────────────────────────────────────────────────────┘
User Lotus Core User Callback
│ │ │
│ flashLoan() │ │
├────────────────────►│ │
│ │ Transfer assets │
│◄────────────────────┤ │
│ │ │
│ │ Invoke callback │
│ ├─────────────────────►│
│ │ │
│ │ Execute strategy
│ │ (swap, supply, etc.)
│ │ │
│ │ Return success │
│ │◄─────────────────────┤
│ │ │
│ │ Verify repayment │
│ │ Pull assets │
│ │ │
│ Success │ │
│◄────────────────────┤ │
Callback Support:
─────────────────
• supply() - optional callback
• repay() - optional callback
• liquidate() - optional callback
• flashLoan() - required callback
• supplyCollateral() - optional callback
Constraints:
────────────
✓ Callback must succeed
✓ Must repay flash loan (exact amount, no fee)
✓ No reentrancy allowed
✓ Atomic: reverts on failureLast updated

