Events
- Events. An event writes a log entry: the cheap, indexed breadcrumb off-chain systems watch.
- indexed parameters. indexed parameters become searchable topics: filter transfers by address without scanning.
- Events as the API. Indexers and UIs live on events: every state change worth knowing emits one.
Custom Errors
- Custom errors. A custom error: error NotOwner();: reverts cheaper than strings and names the failure precisely.
- revert with data. Errors carry arguments: error InsufficientBalance(available, required): diagnostics as data.
- require and revert. require guards with a condition; revert raises directly: both undo everything.
Reverts and Contract Failure
- All-or-nothing. A reverted call leaves no trace but the gas spent: atomicity as the safety net.
- try/catch external calls. Solidity try/catch handles a failing external call: one contract’s revert need not become yours.
- Failing loudly. Contracts fail loudly and early: silent fallbacks around money are how funds vanish.
Before and after this level
- Before: Level 4: Functions & Access: Visibility, Modifiers, Access-Control Patterns.
- Next: Level 6: Contract Interaction: ABI, External Calls, Ether and Value Transfers.
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 5: Events & Errors cover?
Events, Custom Errors, Reverts and Contract Failure: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 4: Functions & Access, which covers Visibility, Modifiers, Access-Control Patterns.