Crypto and DeFi: how it works and what can go wrong · Part 29 of 30
Stablecoins and DeFi: AMMs, lending and liquidations
Expert 22 min
How fiat-backed and algorithmic stablecoins differ, how automated market makers and lending protocols work, and the specific risks of each.
What you will learn
- You can compare reserve-backed, crypto-collateralised and algorithmic stablecoins.
- You can compute an AMM trade with the constant-product formula and explain impermanent loss.
- You can compute a lending position's health factor and liquidation price.
Before this: How blockchains, Bitcoin and Ethereum work
Stablecoins
A stablecoin is a token designed to keep a stable price, usually 1 US dollar. Types:
- Reserve-backed (fiat-backed): an issuer holds cash and short-term government bonds and promises redemption at 1:1. The biggest stablecoins work this way. Risks: the quality and transparency of reserves, the issuer's solvency and access to redemption (often only for large, verified customers). In March 2023, USDC briefly fell to about 0.88 dollars when part of its reserves were stuck at the failed Silicon Valley Bank.
- Crypto-collateralised: users lock more crypto than the stablecoins they mint (over-collateralisation); if collateral value falls, positions are liquidated.
- Algorithmic: stability relies on a mechanism with a sister token rather than real reserves. TerraUSD, then one of the largest stablecoins, lost its peg in May 2022 and collapsed together with its sister token LUNA, wiping out tens of billions of dollars of value.
The Bank for International Settlements argued in its 2025 annual report that stablecoins fail key tests for sound money (singleness, elasticity, integrity), even as they grow quickly as a payment and trading tool. Laws now regulate reserve-backed stablecoins in the EU (MiCA) and the US (GENIUS Act) — see the next lesson.

Automated market makers (AMMs)
Decentralised exchanges such as Uniswap replace the order book with a liquidity pool holding two tokens. In the classic constant-product design, the pool keeps x × y = k constant (before fees).
Example: a pool holds 10 ETH and 30,000 USDC, so k = 300,000 and the price is 3,000 USDC per ETH. To buy 1 ETH, the pool must end with x = 9, so y = 300,000 ÷ 9 ≈ 33,333 USDC — you pay about 3,333 (plus a fee, often 0.3 %): an average price 11 % above the starting price. That is price impact — large trades in small pools are expensive.
Liquidity providers deposit both tokens and earn the fees. But when prices move, the pool automatically sells the rising token and buys the falling one. Compared with simply holding the tokens, the provider ends up worse off — impermanent loss. If one token's price doubles relative to the other, the loss versus holding is about 5.7 % (formula: 2√r ÷ (1 + r) − 1 with price ratio r). Fees must exceed this to make providing liquidity worthwhile.
Lending protocols and liquidations
DeFi lending protocols let you deposit collateral and borrow other tokens. Loans are over-collateralised and enforced by code:
- Each collateral has a liquidation threshold (for example 82.5 %).
- Health factor = collateral value × threshold ÷ debt. Below 1, anyone may repay part of your debt and take your collateral at a discount — a liquidation.
Example: you deposit ETH worth 10,000 and borrow 6,000 USDC. Health factor = 10,000 × 0.825 ÷ 6,000 ≈ 1.38. If ETH falls about 27 % (collateral value 7,273), the health factor reaches 1 and liquidation starts. Crypto falls of that size can happen in days.
The interest rates on deposits ("yield") come from borrowers — often traders using leverage. High advertised yields usually mean high risk.
DeFi-specific risks
- Smart contract bugs: code is law, including buggy code.
- Oracle manipulation: protocols need price feeds; manipulated prices trigger wrong liquidations or let attackers borrow too much.
- Bridges: tokens moved between chains are held in bridge contracts — prime targets (the Ronin bridge lost about 600 million dollars in 2022).
- Governance and admin keys: some "decentralised" protocols can be upgraded or paused by a small group.
- Approvals: signing an unlimited token approval for a malicious contract can drain a wallet later. Review and revoke approvals regularly.
Key points
- Stablecoins: reserve-backed (issuer and reserve risk), crypto-collateralised (liquidation risk), algorithmic (Terra collapse, May 2022).
- AMMs keep x × y = k; large trades suffer price impact; liquidity providers face impermanent loss (~5.7 % when price doubles).
- Lending: health factor = collateral × threshold ÷ debt; below 1 you are liquidated.
- DeFi risks: bugs, oracles, bridges, admin keys and token approvals.
Flashcards
- Question: What is the constant-product rule?
- Answer: An AMM pool keeps x × y = k (before fees).
- Question: What is impermanent loss?
- Answer: The shortfall of a liquidity position versus simply holding the tokens when prices move.
- Question: Define a lending health factor.
- Answer: Collateral value × liquidation threshold ÷ debt; below 1 means liquidation.
- Question: Which stablecoin type collapsed in May 2022?
- Answer: Algorithmic — TerraUSD.
Check yourself
Think about your answer, then open it. In the app the quiz is interactive, earns points and brings back what you missed.
A pool holds 20 ETH and 40,000 USDC (x × y = k, no fee). How many USDC do you pay for 4 ETH?
Show the answer
10000 USDC (± 1 USDC)
k = 800,000; after the trade x = 16, y = 50,000; you pay 50,000 − 40,000 = 10,000.
Source: Uniswap v2 Core whitepaper
Collateral worth 8,000, threshold 0.8, debt 4,000. Health factor?
Show the answer
1.6 (± 0.005)
8,000 × 0.8 ÷ 4,000 = 1.6.
Source: ethereum.org, DeFi
Which stablecoin design relies on a mechanism with a sister token instead of real reserves?
- Reserve-backed
- Crypto-collateralised
- Algorithmic
- Central bank digital currency
Show the answer
Algorithmic
Algorithmic designs such as TerraUSD relied on a sister token.
Source: BIS Annual Economic Report 2025
Which are DeFi-specific risks?
- Smart contract bugs
- Oracle manipulation
- Deposit guarantee up to 100,000 €
- Unlimited token approvals to malicious contracts
Show the answer
Smart contract bugs; Oracle manipulation; Unlimited token approvals to malicious contracts
DeFi positions are not covered by deposit guarantees.
Source: ethereum.org, DeFi
Sources
- Annual Economic Report 2025, Chapter III: The next-generation monetary and financial system, Bank for International Settlements, 2025
- Decentralized finance (DeFi), ethereum.org (Ethereum Foundation), 2025
- Uniswap v2 Core whitepaper, Hayden Adams, Noah Zinsmeister and Dan Robinson, 2020
Facts checked on 2026-11-30. Skillgrove lessons are free learning material — no certificate and no accreditation.