5. Capstone: DeFi Components Intro
Complete the course loop through a small DeFi component.
Module Guide
Section titled “Module Guide”This is where the course closes the loop. Everything you’ve learned — contracts and testing (Module 2), a full-stack dApp with Scaffold-ETH (Module 3), L2 deployment and security thinking (Module 4) — comes together in one shipped DeFi component that you can put in a portfolio. The goal is not to build a production protocol; it’s to build a small, correct, well-tested one end to end and to understand the concepts real DeFi is made of.
You choose one of two paths. The Vendor path extends the Token Vendor from Module 3: an
ERC-20 buy/sell contract with approvals, inventory, and withdrawals — the gentler option, and
a solid capstone if you want to consolidate rather than stretch. The DEX path is more
ambitious: an ETH/token liquidity pool with a constant-product pricing function
(x * y = k), swaps in both directions, and liquidity-provider accounting. The DEX is where
you meet the ideas that define automated market makers — price impact, slippage, fees, and
impermanent loss — so it’s the richer learning experience if you have the time.
The lessons support both paths. Challenge 2: Token Vendor (revisited from Module 3) anchors the Vendor path. SpeedRun Challenge 4: DEX (31) is a detailed, checkpoint-driven build of the AMM — budget several hours; the video is an overview, not a substitute for implementing each piece. ENS, DEX, Identity, Inventory & Sybil Resistance (32) rounds out the identity and asset model your frontend should respect, including why “one address = one person” is unsafe. And the external Foundry Deployment and Scripts chapter (33) gives you reproducible, scripted deployment — the professional way to ship the capstone to a testnet.
Lab 5 is the deliverable: a minimal Vendor or DEX, with basic tests, deployed to a testnet, and its links organized. Aim for the optional portfolio package — repo, testnet address, frontend demo, README, explorer links, and three concrete security notes. That package is the tangible proof that you can take an Ethereum application from idea to shipped, which is the whole point of the course.
Project Options
Section titled “Project Options”Choose one:
- Vendor: ERC-20 buy/sell flow, approve, inventory, and withdrawals
- DEX: ETH/token pool, swap, price function, and LP concepts
Optional extensions:
- SpeedRun DEX challenge
- Simplified stablecoin: collateral, mint, burn, and liquidation concepts
- Further reading on oracles, lending, and stablecoins
Assigned Lessons
Section titled “Assigned Lessons”Open the Module 5 lesson sequence
- Challenge 2: Token Vendor
- SpeedRun Challenge 4: DEX
- ENS, DEX, Identity, Inventory & Sybil Resistance
- Cyfrin Updraft: Foundry Deployment and Scripts
Lab Tasks
Section titled “Lab Tasks”Open Lab 5: Complete the DeFi Capstone
- Complete a minimal Vendor or DEX implementation
- Write basic tests
- Deploy to a testnet
- Organize portfolio links
Optional Portfolio Package
Section titled “Optional Portfolio Package”Ship it
- GitHub repo
- Testnet deployment address
- Frontend demo
- README
- Transaction or block explorer links
- Three security risk notes
