Skip to main content
The health factor (HF) measures how safe a position is from liquidation. Sonar computes it the same way the lending protocol does — an Aave-style, Zest-native formula:

Inputs (all read live from mainnet)

Collateral & debt

Per-reserve balances from get-user-reserve-data and the aToken balance.

Liquidation threshold

From get-reserve-state — e.g. sBTC = 0.75 (75%).

Oracle price

From the reserve’s on-chain oracle — e.g. stx-btc-oracle-v1-4.

Decimals

Per-asset fixed-point scaling from get-reserve-state.

Worked example

A position with 0.5 sBTC collateral and 21,000borrowed,atalivesBTCpriceof21,000** borrowed, at a live sBTC price of **64,472 and a liquidation threshold of 0.75:
If sBTC falls to $56,000, the health factor hits 1.0 and the position becomes liquidatable. Sonar alerts well before that point.