Getting Started
It’s a good idea to check out the two links below to get started with assertions, but it’s not required to understand the content of the book.- Learn all about assertions in the Assertion Guide
- Follow the PCL Quickstart Guide to set up your own assertions project
- Check the PhEVM Cheatcodes Reference for available assertion tools
Book Structure
This book is organized into two complementary sections:Part 1: General Use Cases
The first part contains curated assertion patterns organized by security category. These examples demonstrate proactive security measures you can implement to protect your protocols. Each assertion shows how to prevent specific types of vulnerabilities before they can be exploited. View the complete use cases catalog →Part 2: Previous Hacks
The second part analyzes real-world DeFi hacks and demonstrates how assertions could have prevented them. These case studies provide concrete examples of how assertions work as a safety net, catching vulnerabilities that might slip through traditional security measures like audits and testing. View the previous hacks analysis → Both sections include:- Assertion code examples
- Explanations of the vulnerability or pattern being addressed
- Minimal protocol interfaces for context