Sub topic 9
Liquidations: protecting the system when collateral falls
This chapter assumes you know how an overcollateralized position works. You should be able to compute a collateral ratio and a liquidation price, as in the previous chapter. You should also know that a crypto-backed stablecoin is minted against locked collateral such as ETH. Here we look at what happens when the collateral value drops and the position becomes unsafe.
Why liquidations exist
A crypto-backed stablecoin has no bank holding dollars. Its backing is a pool of volatile collateral locked in smart contracts. The system stays solvent only if the collateral stays worth more than the stablecoins it backs.
A liquidation is a forced sale of a borrower's collateral to repay their debt. It fires when a position's collateral ratio falls below the protocol's minimum. It works in three steps:
- The protocol defines a minimum collateral ratio, for example 150%.
- When a position falls below that ratio, anyone may repay part or all of its debt.
- In return, the repayer receives the borrower's collateral at a discount.
The borrower keeps whatever collateral is left over. The debt is cleared before the collateral can fall below the debt's value, so each stablecoin stays backed by more than one dollar of assets. That backing is what supports the peg.
The trigger: price oracles
A smart contract cannot look up the ETH price by itself. It reads it from a price oracle, a feed that publishes market prices on-chain. The liquidation check is a simple comparison using that feed:
def collateral_ratio(collateral_amount, collateral_price, debt_usd):
return collateral_amount * collateral_price / debt_usd
def is_liquidatable(collateral_amount, collateral_price, debt_usd, min_ratio):
return collateral_ratio(collateral_amount, collateral_price, debt_usd) < min_ratioThe oracle is part of the security model. If the feed is wrong, the protocol acts on false information:
- A stale price can leave unsafe positions open while the real market has moved on.
- A manipulated price can liquidate healthy positions. Attackers have done this by moving thin markets that a protocol read directly.
Protocols reduce this risk with several techniques. They aggregate many sources, use time-averaged prices, and add delays or deviation limits. None of these removes the risk. They trade speed against resistance to manipulation.
Who performs liquidations
Protocols do not run liquidations themselves. They pay outside actors to do it. These actors are called liquidators or keepers, and they are usually bots that watch every open position.
A liquidator is motivated by profit. The protocol offers a liquidation penalty (also called a bonus or discount), which is a percentage extra of collateral on top of the debt repaid. With a 13% penalty, repaying 1,000 stablecoins of debt earns 1,130 dollars' worth of collateral. The 130 dollars of difference pays for the liquidator's gas fees, price risk and capital cost, and leaves them a profit.
The penalty also lands on the borrower. It is the cost of letting the position slip below the minimum, and it gives borrowers a reason to keep a buffer.
A worked liquidation
Take the position from the previous chapter: 10 ETH locked, 10,000 stablecoins minted, 150% minimum. The liquidation price is 1,500. Suppose ETH falls to 1,400 and the penalty is 13%. The protocol also uses a close factor of 50%, which caps how much of the debt one liquidation call may repay.
def collateral_ratio(collateral_amount, collateral_price, debt_usd):
return collateral_amount * collateral_price / debt_usd
def liquidation_price(collateral_amount, debt_usd, min_ratio):
return debt_usd * min_ratio / collateral_amount
def liquidate(collateral, price, debt, repay, penalty=0.13, min_ratio=1.5):
"""Repay `repay` of the debt and return (seized, new_collateral, new_debt)."""
if collateral_ratio(collateral, price, debt) >= min_ratio:
raise ValueError("position is healthy")
repay = min(repay, debt)
seized = min(collateral, repay * (1 + penalty) / price)
return seized, collateral - seized, debt - repay
def bad_debt(collateral, price, debt):
"""Debt that the remaining collateral cannot cover."""
return max(0.0, debt - collateral * price)
print(round(liquidation_price(10, 10_000, 1.5), 2)) # 1500.0
seized, coll, debt = liquidate(10, 1400, 10_000, repay=5_000)
print(round(seized, 4)) # 4.0357
print(round(coll, 4), round(debt, 2)) # 5.9643 5000.0
print(round(collateral_ratio(coll, 1400, debt), 2)) # 1.67
print(bad_debt(10, 800, 10_000)) # 2000.0Walking through the numbers:
- The liquidator repays 5,000 and receives 5,650 dollars of ETH, which is 4.0357 ETH at 1,400.
- The borrower now has 5.9643 ETH and 5,000 of debt. The ratio is back to 167%, above the minimum, so no further liquidation is needed.
- The liquidator's gross gain is 650 dollars, before gas and trading costs.
The last line shows the failure case. If ETH falls to 800, the 10 ETH are worth 8,000 against 10,000 of debt. No liquidator will pay 10,000 for 8,000 of collateral, and the 2,000 gap is bad debt.
Thresholds to remember
The penalty creates distinct zones as the collateral price falls. This table uses the same position with a 13% penalty, 10,000 of debt and 10 ETH.
| ETH price | Collateral ratio | State |
|---|---|---|
| Above 1,500 | Above 150% | Safe. No liquidation allowed. |
| 1,130 to 1,500 | 113% to 150% | Liquidatable, and a liquidator can earn the full penalty. |
| 1,000 to 1,130 | 100% to 113% | Liquidatable, but the penalty cannot be paid in full. Incentives weaken. |
| Below 1,000 | Below 100% | Collateral is worth less than debt. Bad debt is unavoidable. |
The 150% minimum is a safety margin. It leaves room for the price to keep falling while liquidators act. Bigger margins make bad debt less likely but make the stablecoin more expensive to mint.
How the sale is run
Protocols differ in how they price the collateral sold to the liquidator.
| Design | How it prices collateral | Strength | Weakness |
|---|---|---|---|
| Fixed discount | Liquidator repays debt and takes collateral at a set bonus, such as 5% to 13%. | Simple and fast, with one transaction. | The discount may be too high or too low for market conditions. |
| Auction | Collateral is offered over time, for example a Dutch auction whose price falls until someone buys. | Finds a market price instead of guessing one. | Slower, and needs working bidders during a crash. |
Fixed-discount systems are easy for bots to execute, and liquidators often use flash loans (loans borrowed and repaid in one transaction) so they need no capital of their own. Auction systems can recover more value for borrowers when markets are healthy, but they depend on participants showing up.
What goes wrong
Liquidations work best when markets are calm. Stress exposes several weaknesses.
- Network congestion. In a crash, many transactions compete for block space and gas prices spike. Liquidators who cannot get a transaction included, or cannot afford the gas, do nothing. On 12 March 2020 ("Black Thursday") ETH fell sharply while Ethereum was congested. In MakerDAO's auctions at that time, some bids for collateral were accepted at nearly zero because there were few competing bidders. The system ended up with several million stablecoins of bad debt, which it covered by creating and selling its governance token.
- Liquidation cascades. Liquidators sell the seized collateral, often on the open market. That selling pushes the price down, which can put more positions below the minimum. The new liquidations cause more selling.
- Oracle lag or failure. If the price feed lags during a fast move, positions are liquidated late, after the real price has already gone below the debt.
- Dust and gas cost. A very small position may earn a liquidator less than the gas to liquidate it. These positions can sit unsafe indefinitely, so protocols set minimum debt sizes.
- Concentrated collateral. If one large borrower holds much of a thinly traded asset, selling it moves the price enough to wipe out the discount.
Protocols respond with higher minimum ratios for riskier assets, caps on how much of one asset can be used, and reserve funds that absorb losses. These tools shift the cost of failure but cannot remove it.
What borrowers can do
A borrower has several ways to avoid liquidation:
- Add collateral, which raises the ratio without changing the debt.
- Repay part of the stablecoin debt, which lowers the debt and raises the ratio.
- Open positions at a ratio well above the minimum, such as 250% to 300%.
- Use alerts or automation that tops up collateral when the ratio falls to a chosen level.
The tradeoff is capital efficiency. A higher ratio means locking more collateral to borrow the same amount.
Summary
Liquidations are the repair mechanism of crypto-backed stablecoins. They turn a falling collateral ratio into an incentive for outsiders to clear debt before the system becomes insolvent. They depend on accurate oracles, available liquidators, working networks and enough liquid demand for the collateral. When one of these breaks, bad debt appears and the peg is at risk. The causes and examples of such failures are covered in the chapter on depegging.
Exercise
A position holds 5 ETH and has 4,000 stablecoins of debt. The minimum ratio is 160% and the liquidation penalty is 10%. (a) What is the liquidation price? (b) ETH falls to 1,200 and a liquidator repays 2,000 of debt. How much ETH do they receive, and what is the borrower's collateral ratio afterward?
Show answer
(a) liquidation price = debt min_ratio / collateral = 4,000 1.6 / 5 = 1,280. (b) The liquidator receives 2,000 1.10 / 1,200 = 1.8333 ETH. The borrower keeps 5 - 1.8333 = 3.1667 ETH with 2,000 of debt left. The ratio is 3.1667 1,200 / 2,000 = 1.90, or 190%, so the position is safe again.
Exercise
Using the thresholds from this chapter's table (13% penalty, 10,000 of debt, 10 ETH), at what ETH price does a full liquidation stop paying the liquidator the entire penalty, and at what price does bad debt begin?
Show answer
A full liquidation pays the whole penalty only if collateral value is at least 1.13 10,000 = 11,300, so the price must be at least 1,130. Below 1,130 the collateral cannot cover debt plus penalty. Bad debt begins when collateral value is below the debt itself, which is at a price of 1,000 (10 ETH 1,000 = 10,000).