Vaults Adapter

Guide to integrating Morpho Vault V2 with Lotus protocol via the LotusV2Adapter for allocation, deallocation, and position tracking across tranches.

Lotus integrates with Morpho’s Vault V2 via a LotusV2Adapter that turns lending vault allocations into Lotus supply/withdraw actions.

When to use:

  • You manage pooled assets and want to allocate across Lotus tranches.

  • Your vault’s denomination asset matches the Lotus market’s loan token.

Key behaviors:

  • Allocation calls supply assets to the specified market tranche.

  • Deallocation withdraws back to the adapter, then to the vault.

  • The adapter tracks active positions to compute realAssets().

┌─────────────────────────────────────────────────────────────────────┐
│            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)

Constraints and safety:

  • Only use markets protected against initial-supply inflation attacks.

  • Do not use IRMs that can re-enter the adapter or parent vault.

  • Small rounding losses can occur on supply/withdraw.

See also:

  • Learn → Advanced → Lending Vaults for mechanics and constraints.

  • Reference → Contract Addresses to locate adapter and Lotus deployments.

Last updated