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.
🎯 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
📚 Prerequisites
Before this lesson, you should understand:
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 ()
You deposit ETH. You borrow USDC. When do you die?
- Collateral: $1000 ETH.
- Liquidation Threshold (): 80% (0.8).
- Borrowing Power: $800 USDC.
- Total Debt: $500 USDC.
- Result: .
Physics: If , 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 ().
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 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):
- Your Debt: $100 USDC.
- Your Collateral: $110 ETH.
- Bonus: Protocol offers your ETH to liquidators at a 5% discount.
- Liquidator: Pays 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 1000 USDC. Task: At what ETH price does ? (Answer: ).
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: 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
- What does a Health Factor of 1.1 mean?
- Why does the Interest Rate curve have a Kink?
- Who executes liquidations?
- Why is “Isolation Mode” safer for new assets?
- Does the protocol hold your tokens?
Answers
- Safety. You are 10% away from liquidation.
- Liquidity Risk. To prevent 100% utilization (Bank Run) by making borrowing painfully expensive.
- Third-party Bots. They are incentivized by the liquidation bonus.
- Contagion Control. Borrowing against a risky asset shouldn’t threaten the solvency of the main USDC pool.
- 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