Section 18 of 18
Complete Lending Protocol
Final Build
Submit your complete protocol and run the full test suite. Earn the "compound-v2-builder" badge on completion.
Key takeaway: This final section verifies the complete Compound V2 protocol with cToken, Comptroller, PriceOracle, JumpRateModel, and CErc20 wrappers all integrated and passing the full 207-test suite. By this point you have a deployable lending protocol you understand line-by-line, including the parts that audit firms typically charge $50K to $150K to review. Run the deploy scripts and you have your own Compound V2 fork without the inherited bug surface most forks ship with.
What You Built
You just wrote a complete lending protocol. Not a simplified tutorial version. The actual architecture that powered Compound V2, held over $10 billion in deposits, and was forked by Aave V2, Venus, Benqi, Cream, Iron Bank, and dozens of others. Every function you implemented has a direct counterpart in the deployed Compound V2 contracts on Ethereum mainnet.
Here is the full inheritance chain you built, from bottom to top:
ExponentialNoError (fixed-point math)
-> CTokenStorage (state variables, events, interfaces)
-> CTokenInterest (accrueInterest, exchangeRate, borrowBalance)
-> CTokenMint (supply underlying, receive cTokens)
-> CTokenRedeem (burn cTokens, withdraw underlying)
-> CTokenBorrow (take out loans against collateral)
-> CTokenRepay (return borrowed tokens, reduce debt)
-> CTokenLiquidate (seize collateral from underwater positions)
-> CErc20 (public entry points, ERC-20 transfers, initialization)
And the risk engine:
ExponentialNoError
-> ComptrollerMarkets (market registry, enter/exit markets)
-> ComptrollerLiquidity (cross-market solvency calculation)
-> ComptrollerHooks (policy enforcement: mint/redeem/borrow/repay/liquidate/seize/transfer)
Your Complete Protocol
Sign up free — keep reading + earn 100 Lynx
Zealynx Academy is free. Track your progress, earn Lynx, and climb the leaderboard.
Sign up free to continueAlready have an account? Log in