Module 9: DeFi Deep Dive

Composability and Systemic Risk

Chapter 12 of 14 · about 5 minutes

12.1 When one block falls

Chapter 1 described DeFi as money legos. Hash now showed Mint the other side of that idea.

"Imagine a tower of blocks," said Hash. "A stablecoin at the bottom. A lending protocol using it. A liquidity pool built on the lending protocol's tokens. A yield vault built on the pool. Pull out the bottom block, and everything above shifts at once. DeFi's biggest disasters rarely stay in one protocol."

12.2 How risk spreads

ChannelHow it spreads risk
Shared collateralMany protocols accept the same assets; a collapse in one asset hits all of them
Stablecoin dependencyStablecoins backed by other stablecoins inherit their problems (Chapter 7)
Wrapped and derivative tokensLSTs, LRTs, LP tokens, and bridged tokens depend on their underlying protocols
LiquidationsForced selling in one protocol pushes prices down, triggering liquidations elsewhere
Shared oraclesA faulty price feed can affect every protocol using it
Shared codeForks and common libraries can share the same bugs
Common usersLarge holders spread across protocols can transmit stress when they unwind

12.3 Case study: TerraUSD, May 2022

TerraUSD (UST) was an algorithmic stablecoin (Chapter 7) designed to hold $1 through a mint-and-burn relationship with its sister token, LUNA. A lending protocol in its ecosystem offered depositors close to 20% yield on UST, attracting billions of dollars.

StageWhat happened
Large withdrawals and sales of USTUST slipped below $1
Arbitrage mechanism kicked inUST holders redeemed for newly minted LUNA and sold it, pushing LUNA down
Confidence collapsedMore UST holders rushed to exit; LUNA supply exploded as its price collapsed
ContagionFunds and lenders exposed to UST and LUNA failed, leading to forced selling of other crypto assets and further collapses

Within days, tens of billions of dollars in value disappeared. The 20% yield, which had seemed stable, had been subsidised and depended on continuous inflows.

12.4 Case study: the LST discount, June 2022

As Chapter 8 described, the main ETH liquid staking token traded at a discount to ETH before withdrawals were possible. Large holders who had borrowed ETH against it faced rising liquidation risk as the discount widened. Some troubled lenders needed to sell large LST positions, deepening the discount. The episode showed how a token designed to track ETH could diverge under stress, and how leverage (Chapter 11) amplified the pressure.

12.5 Case study: USDC, March 2023

When a bank holding part of USDC's reserves failed (Chapter 7), USDC briefly fell to about $0.88.

ExposureEffect
Stablecoins with USDC in their reserves or PSMsSlipped below $1 as well
Stablecoin liquidity poolsFilled with USDC as users swapped out of it
Lending positions using USDC as collateral or debtLiquidation and pricing confusion

The peg recovered once the bank's depositors were protected. But the weekend showed how a problem in the traditional banking system could ripple through DeFi within hours.

12.6 Case study: shared code, July 2023

In July 2023, a bug in certain versions of a smart contract programming language compiler affected several liquidity pools on a major stablecoin-focused DEX and on protocols using the same code. Attackers drained tens of millions of dollars. Separately, concerns grew that a large loan, collateralised by the DEX's governance token and held across multiple lending protocols, could be liquidated if the token's price fell, potentially creating bad debt for those lenders.

The episode showed two forms of contagion at once: a shared technical dependency, and concentrated collateral spread across protocols.

12.7 Correlation in crises

In normal markets, diversifying across protocols reduces risk. In crises, many risks move together:

Normal timesCrises
Different protocols fail independentlyFailures cluster, as stress spreads
Collateral prices move somewhat independentlyMost crypto assets fall together
Liquidity is availableLiquidity disappears, slippage spikes
Borrow rates are stableRates spike as everyone seeks stablecoins
Stablecoins hold $1Some stablecoins wobble

"So diversifying across ten DeFi protocols isn't like diversifying across ten unrelated businesses," said Node.

"Not when they all depend on the same few stablecoins, oracles, and collateral assets," said Hash.

12.8 Mapping your dependencies

Before entering any DeFi position, Hash suggested mapping every layer it depends on.

Mint's position: a stablecoin deposit in a yield vault.

LayerDependencyWhat could go wrong
VaultVault smart contract and strategyBug, poor strategy
StrategyDeposits into a lending protocol and a DEX poolEither protocol fails
Lending protocolOracles and accepted collateralBad debt from oracle or collateral failure
DEX poolStablecoin pairOne stablecoin depegs
StablecoinsReserves, banks, or other stablecoinsReserve or banking problems
ChainLayer 2 network and bridgeSequencer outage or bridge failure (Module 3)

Six layers, any of which could fail. The vault's advertised yield didn't show any of them.

12.9 Reducing systemic exposure

  1. Prefer fewer layers. Simpler positions have fewer points of failure.
  2. Know your bottom layer. Which stablecoins, oracles, and collateral does everything rest on?
  3. Avoid stacking leverage on derivative tokens during uncertain periods (Chapter 11).
  4. Diversify across genuinely different foundations, not just different front ends on the same base.
  5. Keep some assets outside DeFi entirely (Module 2).
  6. Watch for stress signals: stablecoin pool imbalances, rising borrow rates, LST discounts, and large liquidations (Module 6).

12.10 Try it yourself

Choose one DeFi yield product. Map every layer it depends on, using the table in section 12.8 as a template. For each layer, note one specific way it could fail. Then identify which layer is the most fundamental: the one whose failure would affect all the others.

Key takeaways from this chapter

  1. Composability means failures can spread across protocols through shared collateral, stablecoins, derivative tokens, liquidations, oracles, code, and users.
  2. TerraUSD's 2022 collapse showed how subsidised yields and algorithmic designs can fail and spread contagion.
  3. The 2022 LST discount showed how derivative tokens can diverge under stress, amplified by leverage.
  4. USDC's 2023 depeg showed how traditional banking problems can ripple through DeFi.
  5. The 2023 compiler bug showed contagion through shared code and concentrated collateral.
  6. In crises, risks become correlated, liquidity disappears, and diversification helps less.
  7. Map your dependencies, prefer fewer layers, and watch for stress signals.