Learning Objectives:

  • Understand decentralized lending protocols

  • Master collateralization and liquidation mechanics

  • Learn about interest rate models

  • Analyze lending protocol risks


5.3.1: DeFi Lending Overview

How DeFi Lending Works:

DeFi lending protocols allow users to lend assets to earn interest and borrow assets using collateral.

text
Lending Protocol Flow:

┌─────────────────────────────────────────────────────────────────────┐
│                    DeFi Lending Protocol                           │
│                                                                   │
│  Lenders:                                                         │
│  ┌─────────────────────────────────────────────────────────────┐   │
│  │  User deposits DAI into lending pool                      │   │
│  │  User receives aDAI (interest-bearing token)              │   │
│  │  Earns interest from borrower fees                        │   │
│  └─────────────────────────────────────────────────────────────┘   │
│                              │                                    │
│  Borrowers:                                                       │
│  ┌─────────────────────────────────────────────────────────────┐   │
│  │  User deposits ETH as collateral                           │   │
│  │  User borrows DAI (up to LTV limit)                       │   │
│  │  Pays interest on borrowed amount                          │   │
│  └─────────────────────────────────────────────────────────────┘   │
│                              │                                    │
│  Protocol:                                                       │
│  ┌─────────────────────────────────────────────────────────────┐   │
│  │  Matches lenders and borrowers                            │   │
│  │  Manages collateral                                        │   │
│  │  Liquidates undercollateralized positions                 │   │
│  │  Distributes interest                                      │   │
│  └─────────────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────────────┘

Key Players:

 
 
Participant Role Example
Lender Deposits assets User providing DAI
Borrower Uses collateral User borrowing USDC
Protocol Manages pools Aave, Compound
Liquidator Repays debt Automated bots

5.3.2: Collateralization and LTV

Collateralization Mechanism:

text
LTV (Loan-to-Value Ratio):

LTV = Borrowed_Amount / Collateral_Value × 100%

Example:
- Collateral: 1 ETH ($3,000)
- Borrowed: 1,500 DAI
- LTV = 1,500 / 3,000 × 100 = 50%

LTV Limits:
┌─────────────────────────────────────────────────────────────────────┐
│  Asset      | Max LTV | Liquidation Threshold                    │
│  ETH       | 80%     | 85%                                       │
│  WBTC      | 75%     | 80%                                       │
│  USDC      | 90%     | 95%                                       │
│  stETH     | 75%     | 80%                                       │
│  AAVE      | 65%     | 70%                                       │
└─────────────────────────────────────────────────────────────────────┘

5.3.3: Interest Rate Models

Interest Rate Mechanics (Aave):

text
Interest Rate Model:

Utilization Rate (U) = Borrowed_Amount / Total_Pool

Optimal Utilization (U_optimal) = 80% (for most assets)

Interest Rate:
If U < U_optimal:
    Rate = Base + (U / U_optimal) × Slope1

If U >= U_optimal:
    Rate = Base + Slope1 + ((U - U_optimal) / (1 - U_optimal)) × Slope2

Example (USDC):
- Base: 0%
- Slope1: 4%
- Slope2: 50%
- U = 60%: Rate = 0 + (0.6/0.8) × 4 = 3%
- U = 90%: Rate = 0 + 4 + ((0.9-0.8)/0.2) × 50 = 29%

5.3.4: Liquidation Mechanics

Liquidation Process:

text
Liquidation Example:

Position:
- Collateral: 10 ETH ($30,000)
- Borrowed: 20,000 DAI ($20,000)
- LTV: 66.7%

Price Drop:
- ETH drops to $2,000
- Collateral: $20,000
- Borrowed: $20,000
- LTV: 100%
- Liquidation triggered

Liquidation Process:
1. Liquidator pays debt (20,000 DAI)
2. Receives collateral (10 ETH) + bonus (5-10%)
3. Position closed
4. User loses collateral

5.3.5: Popular Lending Protocols

Aave:

 
 
Feature Description
aTokens Interest-bearing tokens
Flash Loans Uncollateralized loans
Reserve Factor Protocol revenue
Safety Module Insurance mechanism

Compound:

 
 
Feature Description
cTokens Interest-bearing tokens
Comptroller Risk management
Governance COMP token

MakerDAO:

 
 
Feature Description
CDPs Collateralized debt positions
DAI Decentralized stablecoin
DSR Dai Savings Rate

5.3.6: Lending Protocol Risks

 
 
Risk Description Mitigation
Liquidation Risk Collateral devaluation Monitor positions
Oracle Manipulation Price manipulation Use multiple oracles
Smart Contract Risk Protocol bugs Audits, insurance
Market Risk System-wide crashes Diversification
Liquidity Risk Insufficient liquidity Monitor pools