Position health
Collateral and borrow value, LTV against liquidation threshold, health factor, max borrow, liquidation price and the withdraw limit.
The narrative is on how it works. Try the numbers first:
LTV 60% · liquidation threshold 65% · bonus 8% · borrow APR 0.500%
Values in USD
Health checks convert both sides to USD scaled by , rounding down at every step:
Where:
- — the oracle price, with decimals; is USD per whole token × .
- — the collateral in the Position,
Position.totalCollateral(), with decimals (18). A Position holds its market's collateral token and nothing else. - — the borrower's debt, (shares), with decimals (USDG: 6).
- , — loan-to-value and liquidation threshold, WAD.
- , — the most debt value the collateral supports for borrowing, and before liquidation.
Source: IsHealthy · 0x9259…F9a1. Prices come from the TokenDataStream. It
keeps serving the last price while the market is closed, so health can be computed over a weekend,
and it reverts in the fault states (stale in session, past the hard cap, paused, invalid) — see
oracles and market hours.
Two limits
A borrow, or a collateral withdrawal from a Position with debt, must leave
or it reverts ExceedsMaxLTV (IsHealthy · 0x9259…F9a1). Both checks use the
debt after accrual. With no debt, the check passes.
A position is liquidatable when
strictly (IsHealthy · 0x9259…F9a1). A position exactly at the threshold is not
liquidatable. Because is enforced at market creation, a position that
just borrowed can never be liquidatable in the same transaction.
Health factor
The contracts do not compute a health factor. The usual one is
with in USD per whole token. Liquidatable exactly when . With no debt, HF is unbounded.
Max borrow
A new borrow also has to pass the market's max utilisation (100%: the vault cannot be lent out entirely) and, if set, its borrow cap; neither binds for the position in the example below. Debt keeps growing between the moment you read it and the moment a transaction lands, so borrowing the whole room can revert — leave a margin.
Liquidation price
The collateral price at which :
The contracts have no such function; it is derived from the inequality above. The distance to it is . A position borrowed right up to its LTV sits above its liquidation price: 7.7% for NVDA/USDG, 6.7% for SPY/USDG, 6.25% for WETH/USDG, 10% for SPCX/USDG, TSLA/USDG and AMD/USDG, 7.1% for QQQ/USDG; MSFT/USDG, AAPL/USDG and GOOGL/USDG are NVDA/USDG's 7.7%.
A second price matters to lenders: below
a full liquidation takes all the collateral and still leaves debt — see bad debt.
Withdraw limit
With debt, the collateral left behind must still satisfy the LTV limit (not the liquidation threshold):
and, on every market, the withdrawal needs Fresh prices while the Position has debt — see
market hours. With no debt, all collateral can be withdrawn at any time.
Source: Position, LendingPoolRouter.
Worked example
The illustrative Position on NVDA/USDG: 20 NVDA collateral and
2400000000 borrow shares, with 20010000000 and
20000000000. NVDA at $226.43088402, its mainnet price at block 86868761; USDG at $1. The amounts
are illustrative; the price and parameters are mainnet's.
| Raw | Human | |
|---|---|---|
20000000000000000000 | 20 NVDA | |
226430884020000000000 | $226.43088402 | |
4528617680400000000000 | $4,528.6176804 | |
| (60%) | 2717170608240000000000 | $2,717.17060824 |
| (65%) | 2943601492260000000000 | $2,943.60149226 |
| , stored totals | 2401200000 | 2,401.200000 USDG |
| , after pending interest | 2402294128 | 2,402.294128 USDG |
The second row books the market's pending 9.117741 USDG of interest from accrual first, as every check does. With that debt:
| Value | |
|---|---|
| Health factor | (1.22589 on stored totals) |
| Room to borrow | USDG |
| Liquidation price | , an 18.39% fall from $226.43 |
| Bad-debt price | |
17682320872416945779, 17.682320 NVDA | |
| Withdrawable | 2.317679 NVDA |
The calculator above starts at these inputs.