get_liquidation_estimate
for concrete amounts; this reference explains the calculations and their
rounding constraints.
USD values and health factors use WAD (1e18), indexes and scaled shares use
RAY (1e27), and rates use BPS (10000). Token amounts use each asset’s native
decimals. Formulas below describe ratios; fixed-point operations apply the
rounding stated alongside them.
Liquidation curve
There is no fixed close factor. The account’s health factor and its spoke’s curve determine the bonus and ideal repayment. Read live values withget_spoke(spoke_id).
Bonus calculation
The collateral-weighted liquidation threshold controls how much bonus can be paid while preserving health:liquidation_bonus, capped at the threshold-derived maximum. To calculate that
maximum, round proportion_seized up to BPS and clamp it to [1, BPS]:
(1 + bonus) * proportion_seized at 1. A zero seizure proportion
has a zero maximum.
The bonus increases as health factor falls. With the bonus factor expressed as
a ratio, the ramp is:
hf_for_max_bonus, the scale is 1. The result is subject to a final
HF-preserving cap:
An ideal equal to the entire debt does not require the offered budgets to cover
all debt. Smaller offers can succeed, subject to token rounding and the final
plan checks.
Repayment limit
The ideal repayment restores the target health factor at the selected bonus. It is bounded by both total debt and the collateral’s repayment capacity:refunds. A final full-close plan pulls
the entire merged offer and the pool refunds excess. Other plans pull only
accepted amounts. Authorize the complete offer when a full-close plan is possible;
interest accrual and state changes can alter the plan before execution.
Low-decimal collateral
Assets with 0, 1, or 2 decimals can be supplied but cannot be listed as borrowable. Their listing must use zero liquidation fees. A liquidation quantum is one base unit: 1 token at 0 decimals, 0.1 token at 1 decimal, or 0.01 token at 2 decimals. For a solvent partial quote with one low-decimal collateral leg, the planner can raise the ideal to fund one base unit. Partial seizure rounds down to base units. The planner releases repayment that the dropped fractions no longer back. If the plan repays all debt, partial collateral seizure rounds up, capped at the held claim. A plan with no accepted repayment fails withInvalidPayments.
The two-base-unit collateral floor applies at post-risk validation gates. It
means 2, 0.2, or 0.02 tokens at 0, 1, or 2 decimals. Normal liquidation does not
enforce that floor.
Seizure and fees
The planned gross seizure value includes the liquidation bonus:
The Transfer fee cap prevents fees from consuming repayment principal. Token rounding can still
remove a small liquidation’s profit. Rounding depends on token decimals, prices,
indexes, and position size; simulate the complete transaction and enforce a net
proceeds bound.
If the debt transfer delivers less than planned, every seizure is reduced
proportionally with floor rounding.
LiquidationEvent.repaid_usd_wad reports
the measured repayment, capped at each planned debt leg’s USD value.
Estimates report gross seizure and fees separately. In Transfer mode their
units are native collateral tokens; in Credit mode they are RAY-scaled supply
shares. A full Transfer payout floors the held claim, while the estimate can
round that claim half up. For example, a claim worth 1.6 base units can appear as
2 in the estimate and pay 1 before fees. Clamp estimated gross to the floor of
the held claim before subtracting fees or valuing profit.
For Credit proceeds, subtract fee shares from seized shares before converting
the net shares once through the supply index. Credit position events report
token-unit representations with different rounding, so gross-minus-net event
amounts do not give exact fees.
See liquidation reconciliation.
Bad-debt accounting
Bad-debt cleanup realizes losses through the affected debt market’s supply index. The index reduction applies to all outstanding supply-share claims in that market, including unclaimed protocol revenue shares. After capping the loss at the market’s supplied value, the pool computes:SUPPLY_INDEX_FLOOR_RAW = RAY / 1_000 (0.001).
Each debt loss affects its own market. An account with debt in several markets
can cause a write-down in each of them. See
cleanup eligibility and calls
and interest and revenue for the
surrounding accounting model.
