DeFi Lending and Borrowing
Decentralized Credit Markets
Introduction
Traditional lending requires credit checks, paperwork, and institutional intermediaries. Interest rates are set by banks, and access depends on your credit history and relationship with financial institutions. DeFi lending protocols take a fundamentally different approach.
In DeFi, lending and borrowing occur through smart contracts without credit checks or institutions. Overcollateralization replaces credit assessment—borrowers must deposit assets worth more than they borrow. Interest rates adjust algorithmically based on supply and demand.
This lesson explores how DeFi lending works, the mechanics of major protocols, and the opportunities and risks involved in decentralized credit markets.
How DeFi Lending Works
DeFi lending protocols operate through liquidity pools managed by smart contracts.
For Lenders:
- Deposit assets (ETH, stablecoins, etc.) into protocol
- Receive interest-bearing tokens representing deposit
- Interest accrues continuously
- Withdraw anytime (usually)
For Borrowers:
- Deposit collateral into protocol
- Borrow other assets against collateral
- Pay interest on borrowed amount
- Repay loan plus interest to retrieve collateral
Algorithmic Interest Rates:
Interest rates adjust automatically based on utilization:
- High utilization (many borrowers) → rates increase
- Low utilization (few borrowers) → rates decrease
- Incentivizes balance between supply and demand
No Credit Checks:
Without identity, protocols can't assess creditworthiness:
- Anyone can lend or borrow
- No approval process
- No discrimination possible
- But also no unsecured lending
Overcollateralization
Since DeFi protocols can't assess creditworthiness, they require overcollateralization.
The Requirement:
Borrowers must deposit collateral worth more than they borrow:
- Typical requirement: 125-150% collateralization
- Borrow $1000 → deposit $1500 in collateral
- Ratio varies by collateral asset risk
Why This Works:
Even without knowing the borrower:
- Collateral secures the loan
- If borrower doesn't repay, collateral covers debt
- Protocol doesn't need to trust anyone
The Trade-off:
Seems capital inefficient:
- Need $1500 to access $1000
- Traditional loans are often undercollateralized
But it enables:
- Permissionless borrowing
- No identity required
- Instant access
- No credit history needed
Major Lending Protocols
Aave:
One of the largest lending protocols:
- Supports numerous assets
- Variable and stable rate options
- Flash loans (covered below)
- Credit delegation features
- Multi-chain deployment
Compound:
Pioneer of algorithmic lending:
- Introduced interest-bearing cTokens
- COMP governance token
- Focus on simplicity
- Important for DeFi development
MakerDAO:
Enables borrowing DAI stablecoin:
- Deposit collateral, borrow DAI
- Stability fees (interest) paid in DAI
- Different vaults for different collateral types
- Governance by MKR token holders
Protocol Differences:
Each protocol has different:
- Supported assets
- Collateral requirements
- Interest rate models
- Governance structures
- Risk parameters
Many users interact with multiple protocols, moving assets to optimize rates.
Liquidations
When collateral value falls below required levels, positions become liquidatable.
The Process:
- Collateral value drops (e.g., ETH price falls)
- Collateralization ratio falls below minimum
- Position becomes eligible for liquidation
- Liquidators repay part of debt
- Liquidators receive collateral at discount
- Borrower loses collateral
Example:
- Deposit 1 ETH ($1500) as collateral
- Borrow 1000 USDC
- ETH drops to $1100
- Position now 110% collateralized (below 125% requirement)
- Liquidator pays 500 USDC of debt
- Liquidator receives ~$550 worth of ETH (10% discount)
- Borrower loses that collateral
Liquidation Incentives:
The discount incentivizes rapid liquidation:
- Arbitrage opportunity for liquidators
- Bots compete to liquidate
- Protocol stays solvent
Cascade Risk:
During market crashes:
- Falling prices trigger liquidations
- Liquidations create selling pressure
- More price drops → more liquidations
- Can accelerate crashes
This happened dramatically in March 2020 and May 2021.
Flash Loans
Flash loans are unique to DeFi—borrowing without any collateral, within a single transaction.
How They Work:
- Borrow assets (any amount) without collateral
- Use the assets for something
- Repay loan plus fee
- All happens in one atomic transaction
- If repayment fails, entire transaction reverts
The Magic:
Because blockchain transactions are atomic:
- Either everything succeeds or everything fails
- If you can't repay, it's like loan never happened
- Protocol never at risk
Use Cases:
Arbitrage:
- Spot price difference between exchanges
- Borrow to buy low, sell high, repay
- Keep profit without needing capital
Collateral Swaps:
- Swap collateral type without closing position
- Borrow to repay loan, withdraw old collateral
- Deposit new collateral, borrow again, repay flash loan
Self-Liquidation:
- Close underwater position efficiently
- Better than being liquidated by others
The Dark Side:
Flash loans have been used in attacks:
- Manipulate prices for profit
- Exploit protocol vulnerabilities
- Enable attacks without capital
Flash loan attacks have caused hundreds of millions in losses.
Use Cases for DeFi Lending
Leverage:
Amplify exposure:
- Deposit ETH as collateral
- Borrow stablecoins
- Buy more ETH
- Repeat for more leverage
Risk: Liquidation if ETH falls.
Liquidity Without Selling:
Access cash without selling assets:
- Deposit assets as collateral
- Borrow stablecoins for expenses
- Avoid taxable sale event
- Keep upside exposure
Short Selling:
Bet on price decline:
- Borrow asset you expect to fall
- Sell immediately
- Wait for price to drop
- Buy back cheaper
- Repay loan, keep difference
Yield Strategies:
Combine lending with other DeFi:
- Deposit collateral, borrow stablecoins
- Deploy stablecoins in yield farms
- Earn more than borrowing cost
- Complex but can be profitable
Risks in DeFi Lending
Smart Contract Risk:
- Protocol bugs can lose all funds
- Even audited protocols have been exploited
Oracle Risk:
- Price feeds can be manipulated
- Wrong prices → incorrect liquidations
Liquidation Risk:
- Market crashes can liquidate positions faster than you can react
- High gas fees during crashes make it expensive to add collateral
Interest Rate Risk:
- Variable rates can spike suddenly
- Positions can become unprofitable
Governance Risk:
- Parameter changes can affect positions
- Malicious governance proposals possible
Concentration Risk:
- Large positions can't exit quickly
- "Bank run" scenarios possible
Key Takeaways
- DeFi lending operates through smart contracts with algorithmic interest rates based on supply and demand
- Overcollateralization replaces credit assessment, requiring collateral worth more than borrowed amounts
- Major protocols include Aave, Compound, and MakerDAO with different features and supported assets
- Liquidations occur when collateral value falls below required levels, creating cascade risks
- Flash loans enable uncollateralized borrowing within single transactions
Summary
DeFi lending protocols enable permissionless borrowing and lending through smart contracts and overcollateralization. While this creates new opportunities for leverage, liquidity access, and yield generation, it also introduces risks including liquidation cascades. Flash loans represent a unique DeFi innovation enabling capital-free arbitrage but have also been used in attacks.

