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 V2 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.
The LotusV2Adapter bridges Vault V2 allocations to Lotus supply/withdraw calls, letting vaults allocate across multiple markets and tranches.
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:
marketParamstrancheIndex
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 → >0removed 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.
Example: a vault holds USDC and allocates to 3 Lotus market tranches:
A
USDC/WETH market, tranche 0
10,000
9,800
B
USDC/WETH market, tranche 2
5,000
4,900
C
USDC/WBTC market, tranche 1
3,000
2,950
Step-by-step:
A
9,800
10,050
B
4,900
5,020
C
2,950
3,010
Total
18,080 USDC
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
skimRecipientonly
skimRecipientcan callskim(token)skim(token)transfers the adapter’s full balance oftokentoskimRecipient
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.
The adapter must only be used with Lotus markets protected against inflation attacks and must not be paired with IRMs that can re-enter the adapter or parent vault.
See Also
Learn → Lotus Vaults for the user-facing vault overview
Build → Vaults Adapter for integration guide
Reference → Vault Factory for deployment API
Last updated

