Visibility
- external and public. external functions serve callers only; public also serves internal calls: surface declared exactly.
- internal and private. internal shares with children; private stays in this contract: inheritance-aware visibility.
- Default danger. Every function’s visibility is explicit: the forgotten-public function is a classic exploit.
Modifiers
- Modifiers. A modifier wraps functions with pre-checks: onlyOwner guarding the door in one word.
- The underscore. The modifier’s underscore marks where the function body runs: checks before, effects after.
- Modifier discipline. Modifiers stay simple: checks only; state changes hidden in modifiers ambush auditors.
Access-Control Patterns
- Ownable. The owner pattern gates admin functions to one address: simple, and a single point of failure.
- Role-based access. Roles split powers: minter, pauser, admin: each grantable, revocable, auditable.
- Timelocks and multisig. Serious admin runs behind multisig and timelocks: powers delayed and shared, rug-resistance by design.
Before and after this level
- Before: Level 3: Collections & Data Models: Arrays and Mappings, Structs and Enums, Designing Contract State.
- Next: Level 5: Events & Errors: Events, Custom Errors, Reverts and Contract Failure.
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 4: Functions & Access cover?
Visibility, Modifiers, Access-Control Patterns: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 3: Collections & Data Models, which covers Arrays and Mappings, Structs and Enums, Designing Contract State.