Reusable Contract Components
- Components. A component packages storage, events and logic for embedding: ownable and upgradeable as building blocks.
- component! macro. The component! macro mounts a component into a contract: its storage and events merged in.
- Ecosystem components. Audited component libraries supply the classics: ownership, access control, upgrades: reviewed by many eyes.
Composition
- Embedding impls. Components expose embeddable impls: their external functions surfacing on your contract deliberately.
- Internal impls. Internal component functions serve the host: composition without exposing every gear.
- No inheritance maze. Components compose flat: the auditor reads a mount list, not a parent chain.
Contract Architecture
- Small trusted core. Architecture keeps the money logic small: components for the commodity parts.
- Interfaces at seams. Multi-contract systems talk through declared interfaces: the trust graph explicit.
- Upgradability by class. Starknet upgrades swap the class hash: a power gated, timelocked and documented.
Before and after this level
- Before: Level 7: Events & Contract Interaction: Events, Dispatchers and Interfaces, Contract-to-Contract Communication.
- Next: Level 9: Accounts & Transactions: Starknet Accounts, Transactions, Fees and Execution.
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 8: Components cover?
Reusable Contract Components, Composition, Contract Architecture: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 7: Events & Contract Interaction, which covers Events, Dispatchers and Interfaces, Contract-to-Contract Communication.