# Loan Manager

> Pluggable component handling the borrowing side of the carry trade. Abstracts protocol-specific logic for loans, collateral, and health monitoring.

## Deployed Implementations

- **Active vaults** (`wbtc-llamalend`, `wsteth-llamalend`) — **LlamaLend**, borrow **crvUSD**.
- **Legacy vaults** (`wbtc-pmusd`, `wsteth-pmusd`, `xaut-pmusd`) — **Aave V3**, borrow **USDT**.

## ILoanManager Interface

Key functions exposed to the vault:

- `getCurrentLTV()` — current loan-to-value (1e18 precision, ÷ 1e16 for %)
- `getCurrentDebt()` — outstanding debt in debt asset decimals
- `getCurrentCollateral()` — collateral supplied
- `getHealth()` — health factor (protocol-specific)
- Borrow/repay/adjust collateral operations (vault-only)

## Aave V3 Loan Manager

- Collateral supplied to Aave pool; USDT borrowed against it.
- Standard over-collateralized loans with liquidation threshold.
- Battle-tested; high liquidity.

## LlamaLend Loan Manager

- Curve Finance lending with **soft liquidations** via LLAMMA.
- Native crvUSD borrowing; capital-efficient bands-based liquidation.
- Newer than Aave; LLAMMA mechanism is complex.

**Soft liquidation** (LlamaLend): gradual collateral→debt conversion across price bands vs Aave's instant liquidation.

## Health and Rebalancing

ViewHelper exposes `isRebalanceNeeded(vault)` when LTV drifts outside target ± `DEADBAND_SPREAD`. Anyone can call `rebalance()` on the vault to restore target LTV.