Events
- Event enums. Contract events declare as an enum: variants with typed fields, derived for emission.
- emit. self.emit logs an event: the breadcrumb indexers and UIs live on.
- Keys and data. Event fields split into keys (searchable) and data: filterable history designed up front.
Dispatchers and Interfaces
- Interfaces. A #[starknet::interface] trait declares another contract’s surface: the typed handle.
- Dispatchers. The generated dispatcher calls a contract by address: interface trait plus contract address.
- Safe dispatchers. Safe dispatchers return Results on failure: the callee’s panic handled as data.
Contract-to-Contract Communication
- Untrusted callees. Every cross-contract call hands control to untrusted code: state settled before calls out.
- Reentrancy in Cairo. Reentrancy exists on Starknet too: ordering and guards, the EVM lesson carried over.
- Library calls. A library call runs another class’s code in your storage context: delegatecall’s cousin, feared accordingly.
Before and after this level
- Before: Level 6: Starknet Contracts: Contract Structure, Storage, External Functions.
- Next: Level 8: Components: Reusable Contract Components, Composition, Contract Architecture.
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 Cairo Level 7: Events & Contract Interaction cover?
Events, Dispatchers and Interfaces, Contract-to-Contract Communication: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 6: Starknet Contracts, which covers Contract Structure, Storage, External Functions.