Vaults Adapter
Guide to integrating Morpho Vault V2 with Lotus protocol via the LotusV2Adapter for allocation, deallocation, and position tracking across tranches.
┌─────────────────────────────────────────────────────────────────────┐
│ Vault V2 ↔ Adapter ↔ Lotus Flow │
└─────────────────────────────────────────────────────────────────────┘
ALLOCATION FLOW (Vault → Lotus):
════════════════════════════════
Vault V2 LotusV2Adapter Lotus Core
──────── ────────────── ──────────
│ │ │
│ allocate( │ │
│ assets, │ │
│ positionData) │ │
├───────────────────►│ │
│ │ │
│ │ Decode position: │
│ │ - marketParams │
│ │ - trancheIndex │
│ │ │
│ │ supply( │
│ │ marketParams, │
│ │ trancheIndex, │
│ │ assets) │
│ ├───────────────────►│
│ │ │
│ │ Mint shares │
│ │ Update state │
│ │◄───────────────────┤
│ │ │
│ │ Track position: │
│ │ Add to active list│
│ │ if new (0 → >0) │
│ │ │
│ Return delta │ │
│◄───────────────────┤ │
│ │ │
DEALLOCATION FLOW (Lotus → Vault):
══════════════════════════════════
│ │ │
│ deallocate( │ │
│ assets, │ │
│ positionData) │ │
├───────────────────►│ │
│ │ │
│ │ withdraw( │
│ │ marketParams, │
│ │ trancheIndex, │
│ │ assets, │
│ │ shouldAccrue=T) │
│ ├───────────────────►│
│ │ │
│ │ Burn shares │
│ │ Transfer assets │
│ │◄───────────────────┤
│ │ │
│ │ Track position: │
│ │ Remove if empty │
│ │ (>0 → 0) │
│ │ │
│ Transfer assets │ │
│◄───────────────────┤ │
│ │ │
realAssets() = Σ(supply balance across all active positions)Last updated

