Health Factor
A lending position's risk-adjusted collateral divided by its debt. Above 1 the position is safe; below 1 anyone can liquidate it.
The health factor is the single number a lending protocol uses to decide whether a borrower's position is safe. It divides the position's collateral, weighted for risk, by its debt. A health factor above 1 means the collateral still covers the debt with the margin the protocol requires. At or below 1, the position can be liquidated: someone else repays part of the debt and takes collateral in exchange, usually at a discount.
Protocols name it differently; Euler v1, for example, called it the health score. The mechanics are the same: weight each collateral asset by its collateral factor, add them up, and compare the result with what the account owes.
How the health factor is calculated
In its simplest form, the health factor is the sum of each collateral balance times its price times its collateral factor, divided by the value of the debt. Some designs also apply a borrow factor to the debt side, so riskier borrowed assets need more collateral. Because prices move, the health factor moves with them, even when the borrower does nothing.
A falling price is the case everyone plans for. The case that breaks protocols is a user action that lowers the health factor without the protocol noticing: a withdrawal, a transfer of collateral tokens, a donation, or any new function that reduces collateral or adds debt.
The health check after every risky action
Lending protocols defend the health factor with a check at the end of every function that can weaken an account. If the account's health factor is below 1 when the function finishes, the whole transaction reverts. This check has to run after every such action, not most of them.
The Euler Finance hack is the textbook case. Euler v1's withdraw and mint both ended with checkLiquidity(account), but donateToReserves, added later as part of a fix, lowered the donor's collateral and never ran it. The attacker used it to push their own account below 1 on purpose, then liquidated it themselves.
Testing it
A useful invariant for any lending protocol is that no sequence of user calls can take a healthy account below a health factor of 1 unless prices change. Invariant testing with random sequences of calls is one way to find the function that forgets the check, before it becomes bad debt.
Articles Using This Term
Learn more about Health Factor in these articles:
Related Terms
Collateral Factor
The percentage of a collateral asset's value that can be borrowed against in a pooled-liquidity lending protocol like Compound V2. Set per market by governance. A 75% collateral factor on ETH means users can borrow up to 75% of their ETH collateral's value.
Liquidation Discount
The share of a position's collateral value a liquidator keeps as a reward for repaying its debt; some protocols raise it as the position gets riskier.
Self-Liquidation
Liquidating a lending position you control from another account you also control, so you collect the liquidation reward yourself.
Bad Debt
Debt left in a lending market after the collateral behind it has been seized and sold and still did not cover it. The lenders, or the protocol's reserves, carry the loss.
Protocol Solvency
Mathematical guarantee that protocol maintains sufficient reserves to honor all obligations, verified through invariant testing and formal methods.
Need expert guidance on Health Factor?
Our team at Zealynx has deep expertise in blockchain security and DeFi protocols. Whether you need an audit or consultation, we're here to help.
Get a Quote