blockmindset
Lesson 5 of 514 min

DeFi Primitives

DeFi protocols compose swaps, lending, collateral, stablecoins, derivatives, oracles, and liquidations into open financial systems.

Why this matters

DeFi primitives explain AMMs, flash loans, liquidation cascades, oracle risk, composability, and protocol insolvency.

1

The Intuition

DeFi is a stack of money-legos. Protocols can call each other directly, which creates powerful combinations and correlated failures.

2

See it concretely

Concrete example

Imagine every bank, exchange, and lending desk exposing public APIs that settle instantly. Builders can connect them like pipes, but a leak can spread quickly.

3

Tempting — but wrong

4

The precise version

Automated market makers use pricing functions instead of order books. Lending protocols use collateral ratios and liquidation mechanisms. Stablecoins attempt to maintain a target price through collateral, algorithms, or off-chain reserves. Oracles provide external price data. Flash loans allow uncollateralized borrowing within one atomic transaction as long as repayment occurs before the transaction ends.

constantProductAMM: x \times y = k

Check your understanding

Why are many DeFi loans overcollateralized?

Click to reveal answer

Why are oracles dangerous?

Click to reveal answer

Before moving on
  • Explain AMMs, lending, stablecoins, liquidations, and oracles.
  • Explain flash loans and atomicity.
  • Describe composability benefits and contagion risk.
  • Separate smart-contract risk from economic risk.
?Checkpoint

Why are price oracles critical in DeFi?