Definition
Collateral and debt values use USD-WAD (10^18). Each supply position uses its
stored liquidation-threshold snapshot. Thresholds use BPS (10_000 = 100%):
i128::MAX. With no debt, the result is
also i128::MAX, representing an unbounded HF. An account is liquidatable when
HF < 1e18.
Each position value comes from its scaled balance, market index, and token price.
Valuation for risk gates floors collateral at each step and ceils debt. The
read-only get_total_borrow_usd view uses half-up rounding, so its displayed
total is not the debt input used by the solvency gate.
Borrowing power
Loan-to-value (LTV) limits the debt an account may keep after borrowing, indebted withdrawal, or account-strategy finalization. The controller refreshes listed supply LTVs before these checks. A stored liquidation threshold can remain below a refreshed LTV, so the effective weight uses their minimum:ltv_collateral_usd to meet the configured
minimum-borrow-collateral floor when it is nonzero. The default is $5 WAD.
If debt remains, each supply position below 3 decimals must also hold at least
two token base units. At 2 decimals, that minimum is 0.02 token. Such a market
must be the account’s only supply market. Debt-free accounts skip these post-operation
risk gates. Ordinary repayment and liquidation do not apply this base-unit floor.
The checks use the post-operation positions and market indexes within the same
transaction. A failed check reverts the operation. See
Accounts and risk
for snapshot updates and Risk parameters
for parameter constraints.
Worked example
An account supplies $1,000 of collateral with a 78% liquidation threshold (7800 BPS) and borrows $500:
1.56. If collateral value halves while debt remains $500,
HF falls to 0.78, making the account liquidatable. This example establishes
liquidation eligibility; an additional borrow must still pass the separate LTV
and minimum-collateral gates.
Interpreting the view
get_health_factor(account_id) returns the raw WAD integer. Divide by 10^18
for display and handle i128::MAX as a sentinel. Debt-free withdrawals skip
account valuation but still require authority, permitted exit flags, cash, and
the applicable pool utilization check.
Any operation that needs account valuation requires a complete usable price
snapshot. Missing or invalid prices revert valuation; they do not count as zero.
See Oracles.
Continue with Liquidations for liquidation
execution and Liquidation math for sizing
and dust rules.
