Foundations · Exchanges, DEX & DeFi
DeFi Lending & Borrowing
DeFi lending protocols pool tokens from suppliers and lend them to borrowers who post more collateral than they borrow. If the collateral's value falls too far, the loan is liquidated.
Why it matters
Lending markets are one of the main building blocks of DeFi, beside exchanges. They are where the rates quoted on stablecoin deposits usually come from, and where on-chain leverage is created.
They also behave unlike a bank loan in one central respect: a loan is enforced by automatic sale of collateral, with no notice and no negotiation.
How it works
- Suppliers depositTokens go into a shared pool at a variable rate.
- Borrowers post collateralWorth more than the loan they take.
- Borrowers pay interestThe rate rises as more of the pool is borrowed.
- Liquidation if neededIf collateral value falls too far, part of it is sold to repay debt.
A lending protocol is a set of smart contracts holding one pool per token. Suppliers deposit tokens into a pool and receive a receipt token that stands for the deposit plus the interest it accrues. Borrowers take tokens out of a pool after depositing something else as collateral.
The protocol cannot check identity, income or credit history, and it cannot take anyone to court. So loans are over-collateralized: the collateral must be worth more than the loan, and it can be sold if its value falls too close to the debt.
In plain words
It resembles a pawn shop more than a bank. You hand over something worth 1,000 and walk out with 500 in cash. Nobody asks about your salary. If you do not come back, or the item loses too much value, the shop sells it.
The key numbers
| Term | Meaning |
|---|---|
| Loan-to-value (LTV) | The most that can be borrowed against a given collateral, as a percentage of its value |
| Liquidation threshold | The percentage of collateral value at which the debt becomes eligible for liquidation. Set a little above the maximum LTV |
| Health factor | A single number comparing the two. Below 1, the position can be liquidated |
| Liquidation penalty | Extra collateral taken from the borrower and given to whoever carries out the liquidation |
| Utilization | The share of a pool that is currently borrowed |
Health factor = (collateral value x liquidation threshold) / debt valueNames, thresholds and exact formulas differ between protocols.- Collateral token at 100Health factor 1.60Collateral 1,000, debt 500.
- Collateral token at 80Health factor 1.28
- Collateral token at 70Health factor 1.12
- Collateral token at 62.50Health factor 1.00The edge of liquidation. A further fall takes the health factor below 1, and the loan can be liquidated.
The health factor falls when the collateral loses value, when the borrowed token gains value, or simply as interest is added to the debt.
Where the rates come from
Borrowers pay interest, and suppliers receive it, less a share kept by the protocol. Rates are set by a formula based on utilization. When 800 out of 1,000 supplied tokens are borrowed, utilization is 80%. As it climbs, both rates rise, which encourages repayment and attracts new supply.
Supply rates are not fixed and not guaranteed
A displayed supply rate is the rate at this moment. It is variable, is not guaranteed, and can drop sharply when borrowing demand fades. Part of it is often paid in a reward token whose price can fall. Supplied tokens are exposed to smart contract failure, to bad debt if liquidations do not cover loans, and to periods when most of the pool is borrowed and withdrawals have to wait.
APR and APY explains how such rates are quoted.
Going deeper
How liquidation happens. Anyone can act as a liquidator. When a health factor drops below 1, a liquidator repays part of the debt and receives the matching collateral plus the penalty. It is carried out by automated programs within seconds. It works on the same principle as liquidation on a margin account.
Price feeds. The protocol learns collateral prices from an oracle, a service that publishes prices on-chain. A wrong or manipulated price can trigger liquidations that should not happen, or allow loans that should not be granted. See smart contract risk.
Why people borrow. Common motives are obtaining a stablecoin without selling an asset, building a leveraged position by borrowing and buying more collateral, and borrowing a token in order to sell it.
Bad debt. If prices fall faster than liquidators can act, collateral may sell for less than the debt. The shortfall falls on suppliers or on a reserve fund, depending on the protocol.
A hypothetical loan, from opening to liquidationHypothetical illustration
Made-up numbers. A borrower deposits 10 tokens of A, priced at 100, as collateral worth 1,000. The maximum LTV is 75%, so up to 750 could be borrowed. The borrower takes 500 of a stablecoin. The liquidation threshold is 80%.
- Health factor at opening: 1,000 x 0.80 / 500 = 1.60.
- Liquidation price: 500 / (10 x 0.80) = 62.50. That is a fall of 37.5% from 100.
Token A later falls to 62.50. The collateral is worth 625 and the health factor is 625 x 0.80 / 500 = 1.00, the edge of liquidation. Real protocols act just below 1.00. To keep the numbers simple, suppose a liquidator acts at exactly this level, with a penalty of 5%:
- the liquidator repays 250 of the debt;
- and receives collateral worth 250 x 1.05 = 262.50.
Afterwards the borrower has collateral worth 625 - 262.50 = 362.50 and a debt of 250. The health factor is back up, at 362.50 x 0.80 / 250 = 1.16.
Before liquidation the collateral exceeded the debt by 625 - 500 = 125. Afterwards it does so by 362.50 - 250 = 112.50. The difference of 12.50 is the penalty.
What it does NOT mean
- Over-collateralized does not mean safe for the lender. Collateral can fall faster than it can be sold.
- A supply rate is not interest from a bank. It is variable, has no deposit protection behind it, and is not guaranteed.
- Liquidation is not a margin call. There is no warning period. It is executed as soon as the rule allows it.
- Borrowing against an asset is not the same as keeping it. The asset is locked in a contract and can be sold without the owner’s consent.
Common misunderstandings
- Borrowing up to the maximum. At the maximum LTV, a small price move is enough to reach the liquidation threshold.
- Watching only the collateral. A rise in the price of the borrowed token harms the health factor just as much.
- Forgetting accrued interest. Debt grows continuously, so a position can become unhealthy with no price move at all.
- Assuming withdrawals are always instant. When a pool is almost fully borrowed, suppliers must wait for repayments or new deposits.
Risks and limits
- Liquidation with a penalty, at a moment the borrower does not choose.
- Contract and oracle failure, which can affect suppliers and borrowers alike.
- Bad debt when liquidations fail to cover loans in a fast market.
- Illiquidity for suppliers when utilization is very high.
- Rate changes: borrowing costs can jump and supply rates can collapse.
- Token quality: thinly traded collateral, or a borrowed stablecoin that loses its value, affects every user of the pool. See stablecoin risks.
Key takeaway
DeFi lending replaces credit checks with collateral worth more than the loan and an automatic rule for selling it. Borrowers face liquidation when the health factor falls below 1, and suppliers earn a variable rate that carries the protocol’s risks.
Sources and further reading
- What is DeFi? Benefits and Use of Decentralised Finance (opens in a new tab), ethereum.org. DeFi products are accessible to anyone who can use Ethereum, with smart contracts replacing the intermediary; covers lending and decentralized exchanges
- Oracles (opens in a new tab), ethereum.org. Smart contracts cannot access off-chain data by default; a corrupt oracle means bad data in the contract
- Mastering Ethereum, Andreas M. Antonopoulos and Gavin Wood (2018)
- Decentralized Finance: Report of the Subcommittee on Digital Assets and Blockchain Technology (opens in a new tab), CFTC Technology Advisory Committee. Subcommittee report (not a Commission position) describing DeFi lending, over-collateralization, liquidation thresholds, oracle exploitation and limited recourse for victims