Solidity modifiers, inheritance and interfaces for reusable contracts
11 steps · about 3 h 20 min · Intermediate
- Function Modifier (reference, Solidity by Example, 15 min)
Start with short runnable code for onlyOwner, modifiers with arguments and a reentrancy guard, so you can see how `_;` works.
- Contracts — Solidity documentation (doc, Solidity docs (official), 40 min)
The official reference for modifiers, inheritance, virtual/override and interfaces, so you can check the rules the examples rely on.
- Inheritance (tutorial, RareSkills, 20 min)
A gentle walkthrough of `is`, parent constructors and `super`, with Remix exercises you can try.
- Inheritance (reference, Solidity by Example (mirror), 15 min)
Shows the diamond inheritance graph and why the order of base contracts matters.
- Lesson 11: Inheritance — SolidityMaster (article, SolidityMaster, 15 min)
Combines an Ownable-style base, a Pausable-style base and a super chain, which is the usual reusable-contract pattern.
- Inheritance (reference, RedDuck Academy, 15 min)
Goes deeper on C3 linearization and the difference between super.foo() and Parent.foo() once chains get complicated.
- Interface (reference, Solidity by Example, 10 min)
Covers what an interface may and may not contain, which is the basis for decoupling contracts.
- Solidity Architecture Essentials: Interfaces, Access Modifiers, and Indexed Event Design (article, DEV Community, 15 min)
Puts modifiers, interfaces and inheritance together in one modular design.
- Access (doc, OpenZeppelin Docs, 20 min)
Shows how the standard library implements Ownable, Ownable2Step and role-based access.
- Extending Contracts (doc, OpenZeppelin Docs, 15 min)
Teaches how to override and call super on real library contracts, applying everything above.
- Contracts Wizard (interactive, OpenZeppelin Docs, 20 min)
Finish by generating an inherited contract and reading the code to see the pattern in practice.