Skip to main content
Source: programs/vanna_credit_layer/src/math/ and constants.rs.

Scales

Utilization and borrow rate

Each reserve stores a RateCurve { linear_coeff_wad, jump_coeff_wad, rate_multiplier_wad }. Every coefficient must be greater than zero and at most 10 × WAD.
The rate is gentle at low utilization, then steepens sharply as u approaches 1 (the u^32 and u^64 terms).

Accrual

The remainders (interest_remainder_wad, fee_remainder) carry forward, so frequent accruals neither overcharge borrowers nor shortchange the treasury. now < last_update is rejected (TimestampRegression).

Lender shares

The reserve counts its own shares (total_supply_shares), so share tokens burned outside Vanna don’t change anyone’s claim. The first deposit locks MIN_INITIAL_SHARES that nobody can redeem.

Debt shares

Borrow shares and debt round up. Lender shares and redeem assets round down.

USD value and health

The oracle rounds collateral down and liabilities up. LTV and liquidation threshold are stored and validated on each asset, but the health factor itself is unweighted.

Liquidation

Require seized ≥ min_seized. While the margin is solvent, the bonus never exceeds its equity, so a liquidation never turns a solvent margin into bad debt.

Write-off

admin_write_off clears every debt of a margin whose collateral is at most $1 and below its debt, with no venue position open. Each reserve’s accrued_protocol_fees absorb the loss first. Lender assets fall by the rest.