Lending Vaults

Technical reference for the LotusV2Adapter connecting Vault V2 instances to Lotus markets, covering allocation, deallocation, position tracking, and skim.

Lotus Lending Vaults are Vault V2arrow-up-right instances that allocate into Lotus market tranches through the LotusV2Adapter. Vault V2 provides the framework (deposits, withdrawals, allocator workflow, adapter system); the LotusV2Adapter bridges vault allocations to Lotus supply() / withdraw() calls.


LotusV2Adapter

One adapter is deployed per vault. It detects the vault's denomination asset on construction, sets approvals to Lotus and the vault, and reports a stable adapter ID for position tracking.


Supported positions

A “Lotus position” inside the adapter is defined by:

  • marketParams

  • trancheIndex

The adapter enforces that the Lotus market's loanToken equals the vault's asset — a vault can only allocate into markets denominated in its own token.


Allocation into Lotus tranches

allocate()

Supplies the vault asset into a Lotus tranche. Only the parent vault can call allocate, and data must decode into a LotusPosition. Returns Vault V2 IDs and the allocation delta.

deallocate()

Withdraws from Lotus with shouldAccrueInterest = true and returns the same IDs and delta.


Adapter ids

The adapter reports three IDs for each Lotus position: the adapter ID, a collateral token ID, and a position ID derived from marketParams and tranche index.


Tracking active positions

The adapter maintains an internal list of active Lotus positions (_lotusPositions). A position is:

  • added when its allocation moves from 0 → >0

  • removed when its allocation moves from >0 → 0

This list drives efficient iteration: only positions with non-zero allocations are queried, avoiding the cost of scanning all possible market/tranche pairs.


realAssets() calculation

The realAssets() function computes the adapter's total asset value by iterating over all active Lotus positions and converting each position's supply shares to assets at the current exchange rate.


Skimming stray tokens

The adapter includes a skim mechanism to recover tokens that end up in the adapter outside the normal flow.

  • the vault owner sets skimRecipient

  • only skimRecipient can call skim(token)

  • skim(token) transfers the adapter’s full balance of token to skimRecipient


Usage constraints

Usage constraints:

  • It must be used with Lotus markets protected against inflation attacks via an initial supply.

  • It must not be used with an IRM that can re-enter the parent vault or the adapter.

  • Rounding error losses on supply/withdraw are realizable.

  • Lotus positions are removed from the tracked list when allocation reaches zero.

Last updated