The Physics of Lending: Health Factors & Liquidations

Why interest rates behave like asymptotes. The math of Health Factors, Liquidation Thresholds, and the 'Kink' in the Utilization Curve.

Intermediate 45 min read Expert Version →

🎯 What You'll Learn

  • Deconstruct the Health Factor Formula
  • Analyze the 'Kink' in Interest Rate Models
  • Trace a Liquidation Event (Dutch Auction vs Fixed Spread)
  • Calculate the accrual of interest via Index Math
  • Compare Isolation Mode vs Cross-Collateralization

Introduction

In Traditional Finance, credit is based on Trust (FICO Score). In DeFi, credit is based on Physics (Over-Collateralization).

The protocol does not trust you. It trusts the Liquidation Engine. If your Health Factor drops below 1.0000, a bot will instantly seize your collateral, sell it at a discount, and pay off your debt. This lesson explores the ruthless math that keeps DeFi solvent.


The Physics: Health Factor (HfH_f)

You deposit ETH. You borrow USDC. When do you die?

Hf=(Collaterali×Thresholdi)TotalDebtH_f = \frac{\sum (Collateral_i \times Threshold_i)}{Total Debt}

  • Collateral: $1000 ETH.
  • Liquidation Threshold (LtL_t): 80% (0.8).
  • Borrowing Power: $800 USDC.
  • Total Debt: $500 USDC.
  • Result: Hf=1000×0.8500=1.6H_f = \frac{1000 \times 0.8}{500} = 1.6.

Physics: If Hf<1.0H_f < 1.0, you are insolvent relative to the protocol’s risk parameters. Liquidation is essentially instantaneous.


Deep Dive: The Interest Rate Model (The Kink)

Why do stablecoin rates spike to 50%? Because of the Utilization Rate (UU).

U=TotalBorrowsTotalLiquidityU = \frac{Total Borrows}{Total Liquidity}

The Interest Rate curve has a “Kink” at an optimal point (usually 80% or 90%).

  • Below Kink: Rates are low (slope is gentle). Encourages borrowing.
  • Above Kink: Rates shoot to infinity (slope is steep). Encourages repayments.

Physics of the Kink: If UU hits 100%, lenders cannot withdraw. The protocol is insolvent (Bank Run). The Kink is a defense mechanism to force borrowers to repay before the pool runs dry.


The Mechanism: Liquidation Engines

How does Aave sell your collateral? It doesn’t use an Order Book. It offers an Arb Opportunity.

Fixed Spread Liquidation (Aave V2):

  1. Your Debt: $100 USDC.
  2. Your Collateral: $110 ETH.
  3. Bonus: Protocol offers your ETH to liquidators at a 5% discount.
  4. Liquidator: Pays 100USDC.Receives100 USDC. Receives 105 worth of ETH. Profits $5 instantly.

Dutch Auction (MakerDAO): Protocol slowly lowers the price of your collateral until a bidder steps in.


Code: Interest Accrual (Index Math)

Interest is not calculated per second per user (too much gas). It is calculated using a global Liquidity Index.

def accrue_interest(pool, current_time):
    time_delta = current_time - pool.last_update_time
    rate = pool.current_interest_rate
    
    # Simple Interest Factor for this period
    interest_factor = rate * time_delta
    
    # Update Global Index
    # Index grows like: 1.0 -> 1.01 -> 1.0201 ...
    pool.liquidity_index = pool.liquidity_index * (1 + interest_factor)
    pool.last_update_time = current_time

def get_user_balance(user, pool):
    # Principal * (CurrentIndex / UserIndex)
    growth = pool.liquidity_index / user.last_index
    return user.principal_balance * growth

Practice Exercises

Exercise 1: The Margin Call (Beginner)

Scenario: ETH 2000.Lt802000. L_t 80%. Borrowed 1000 USDC. Task: At what ETH price does Hf=1.0H_f = 1.0? (Answer: Price×0.8=1000Price=1250Price \times 0.8 = 1000 \rightarrow Price = 1250).

Exercise 2: The Spiral (Intermediate)

Scenario: A Whale is liquidated. The liquidator sells the ETH on Uniswap. Task: What happens to the ETH price? (Drops). What happens to your Health Factor? (Drops). This is a Liquidation Cascade.

Exercise 3: Utilization Spike (Advanced)

Scenario: UU jumps from 80% to 95%. Task: Calculate the new APR if the slope after the Kink is 100%. (Rates might jump from 4% to 50% instantly).


Knowledge Check

  1. What does a Health Factor of 1.1 mean?
  2. Why does the Interest Rate curve have a Kink?
  3. Who executes liquidations?
  4. Why is “Isolation Mode” safer for new assets?
  5. Does the protocol hold your tokens?
Answers
  1. Safety. You are 10% away from liquidation.
  2. Liquidity Risk. To prevent 100% utilization (Bank Run) by making borrowing painfully expensive.
  3. Third-party Bots. They are incentivized by the liquidation bonus.
  4. Contagion Control. Borrowing against a risky asset shouldn’t threaten the solvency of the main USDC pool.
  5. Yes. But they are usually wrapped in aTokens/cTokens which represent your claim on the pool.

Summary

  • HF < 1: Death.
  • Kink: The line between cheap leverage and liquidity crisis.
  • Liquidators: The immune system of DeFi.

Questions about this lesson? Working on related infrastructure?

Let's discuss