Solidity modifiers, inheritance and interfaces for reusable contracts

11 steps · about 3 h 20 min · Intermediate

  1. 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.

  2. 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.

  3. Inheritance (tutorial, RareSkills, 20 min)

    A gentle walkthrough of `is`, parent constructors and `super`, with Remix exercises you can try.

  4. Inheritance (reference, Solidity by Example (mirror), 15 min)

    Shows the diamond inheritance graph and why the order of base contracts matters.

  5. 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.

  6. Inheritance (reference, RedDuck Academy, 15 min)

    Goes deeper on C3 linearization and the difference between super.foo() and Parent.foo() once chains get complicated.

  7. Interface (reference, Solidity by Example, 10 min)

    Covers what an interface may and may not contain, which is the basis for decoupling contracts.

  8. 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.

  9. Access (doc, OpenZeppelin Docs, 20 min)

    Shows how the standard library implements Ownable, Ownable2Step and role-based access.

  10. Extending Contracts (doc, OpenZeppelin Docs, 15 min)

    Teaches how to override and call super on real library contracts, applying everything above.

  11. Contracts Wizard (interactive, OpenZeppelin Docs, 20 min)

    Finish by generating an inherited contract and reading the code to see the pattern in practice.