Loan Manager

The loan manager is a pluggable component that handles the borrowing side of the carry trade. It abstracts away protocol-specific logic for creating loans, managing collateral, and monitoring health.

Overview

The ILoanManager interface allows the Zenji vault to work with different lending protocols without modification. Currently, two loan managers are supported:
Aave
Aave V3

Battle-tested lending protocol with deep liquidity and competitive rates. Uses standard over-collateralized loans.

✓ High liquidity
✓ Stable rates
✓ Proven track record
🦙
LlamaLend

Curve Finance's lending protocol with soft liquidations and native crvUSD support. Uses LLAMMA (lending-liquidating AMM).

✓ Soft liquidations
✓ Native crvUSD
✓ Capital efficient

ILoanManager Interface

All loan managers implement a standard interface:

Aave V3 Loan Manager

The AaveLoanManagerV2 integrates with Aave V3's lending pools.

How it Works

1. Collateral Deposit: Collateral is supplied to Aave's pool 2. Borrow: USDT is borrowed at variable rate 3. Health Monitoring: Continuously monitors Aave's health factor 4. Oracle: Uses Chainlink price feed for the collateral asset

Key Features

- Variable interest rates: Borrow costs fluctuate with market demand - Instant liquidation: If health factor < 1.0, position can be liquidated by anyone - High liquidation threshold: Collateral typically has a 75-80% LTV threshold on Aave - Deep liquidity: Billions in TVL ensure borrowing capacity

Borrow Rate Example

Typical Aave USDT variable borrow rates: - Low utilization: 2-4% APR - Medium utilization: 4-8% APR - High utilization: 8%+ APR The vault's conservative target LTV (65-70%) provides a buffer against liquidation even if rates spike.

Contract Details

// Aave Pool interface
interface IPool {
  function supply(address asset, uint256 amount, address onBehalfOf, uint16 referralCode);
  function borrow(address asset, uint256 amount, uint256 interestRateMode, uint16 referralCode, address onBehalfOf);
  function repay(address asset, uint256 amount, uint256 interestRateMode, address onBehalfOf);
  function withdraw(address asset, uint256 amount, address to);
}

LlamaLend Loan Manager

The LlamaLendLoanManager integrates with Curve Finance's lending protocol (formerly known as Curve Lending).

How it Works

1. Collateral Deposit: Collateral is deposited into a lending market 2. Borrow: crvUSD is borrowed using LLAMMA (Lending-Liquidating AMM Algorithm) 3. Soft Liquidations: Uses a soft liquidation mechanism to prevent instant liquidations 4. Bands: Collateral is spread across multiple price bands for gradual deleveraging

Key Features

- Soft liquidations: Instead of instant liquidation, collateral is gradually converted to debt as price falls - LLAMMA algorithm: Converts collateral ↔ debt automatically across price bands - Native crvUSD: Direct borrowing of crvUSD (no swap needed) - Capital efficiency: Can potentially maintain higher LTV safely

Soft Liquidation Explained

Unlike Aave's instant liquidation, LlamaLend uses soft liquidation: Traditional (Aave): - Price falls → health < 1.0 → instant liquidation penalty (5-10%) Soft Liquidation (LlamaLend): - Price falls → collateral gradually swapped to debt across bands - No instant penalty - Position can recover if price rebounds - More forgiving during volatility

Bands

Collateral is spread across multiple price bands (typically 4-10): - Higher bands: Collateral remains in original form - Active band: Partial conversion happening - Lower bands: Mostly converted to crvUSD The vault configures the number of bands based on risk tolerance.

Swapper Contracts

The loan manager and strategy rely on swapper contracts to convert between assets (e.g. USDT ↔ crvUSD via Curve). The swapper is the only component that can be changed via timelocked governance. The vault validates swapper output — if a swapper returns fewer tokens than expected (based on oracle pricing and slippage bounds), the transaction reverts. This prevents a malicious swapper from draining funds. - Swapper change flow: proposeSwapper() → 1-week timelock → executeSwapper() - Output validation: Vault checks that swapped amounts are within acceptable bounds - The loan manager and yield strategy themselves are immutable per vault deployment

Oracles and Price Feeds

All loan managers use Chainlink oracles for price data: - Collateral/USD: Each vault uses a Chainlink oracle for its collateral asset (e.g. BTC/USD, ETH/USD) - Update frequency: ~1 hour (or 1% price deviation) - Staleness check: Reverts if data > 1 hour old The loan manager enforces oracle freshness to prevent stale price exploitation.