Pools and Exchanges
- AMMs. An AMM prices by formula: the constant-product pool trading without an order book.
- LP shares. Liquidity providers hold shares of the pool: deposits minting, withdrawals burning, fees accruing.
- Slippage bounds. Swaps carry slippage limits: the user’s defence against moving pools and sandwiches.
Lending and Vault Concepts
- Collateralised lending. On-chain loans are overcollateralised: positions liquidated when health factors break.
- Vaults and shares. A vault pools deposits under a strategy: share price carrying yield, standardised by ERC-4626.
- Liquidations. Liquidation keeps protocols solvent: incentivised third parties closing unhealthy positions.
Composable Smart Contracts
- Money legos. DeFi composes: protocols stack on each other’s interfaces, permissionlessly.
- Composability risk. Composability imports risk: your safety now depends on every protocol underneath.
- Flash loans. A flash loan borrows and repays in one transaction: a tool for arbitrage, and for attacks.
Before and after this level
- Before: Level 13: Upgradeability: Proxy Concepts, Storage Layout, Upgrade Risk and Governance.
- Next: Level 15: Low-Level Solidity: EVM Execution, Yul and Assembly Awareness, When Low-Level Code Is Appropriate.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does Solidity Level 14: DeFi Contract Patterns cover?
Pools and Exchanges, Lending and Vault Concepts, Composable Smart Contracts: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 13: Upgradeability, which covers Proxy Concepts, Storage Layout, Upgrade Risk and Governance.