DeFi Code Review Checklist
A comprehensive code review checklist specifically for DeFi protocols. Use this when reviewing PRs for lending protocols, DEXs, yield aggregators, and other financial smart contracts.
Financial Logic Review
Verify correctness of financial calculations.
Oracle Integration
Review price feed usage and manipulation resistance.
Liquidity & Solvency
Verify protocol remains solvent under all conditions.
MEV & Ordering
Review transaction ordering vulnerabilities.
Access Control & Governance
Review permission systems and admin functions.
Integration Safety
Review external protocol interactions.
Testing & Documentation
Verify code quality and test coverage.
Tips from the field
- 1.
Always trace the math by hand: For any financial calculation, work through specific examples manually before trusting the code.
- 2.
Think like an attacker with a flash loan: Ask: What could I do with unlimited capital in a single transaction? This catches most DeFi bugs.
- 3.
Check edge cases: zero, one, max: Every numeric input should be tested with 0, 1, and type(uint256).max.
- 4.
Review rounding direction for every division: Rounding should favor the protocol, not users. Inconsistent rounding is exploitable.
- 5.
Draw the token flow diagram: For complex operations, diagram where tokens move. Missing flows mean lost or stuck funds.
Join teams building the financial infrastructure of the decentralized economy.