Chapter 7
OpenZeppelin Contracts
OpenZeppelin Contracts is the de facto standard library for secure Solidity building blocks. Instead of reinventing ownership, access control, and reentrancy guards, you compose audited modules and focus on your protocol's unique logic.
Ownable fits admin-only protocols with one trusted address. AccessControl scales to multiple roles — minters, pausers, upgraders — each with granular grant and revoke. Choose based on governance needs, not convenience.
Always read the module source before overriding internal hooks like _update or _authorizeUpgrade. OpenZeppelin's docs explain expected call order; breaking that order is a common source of subtle bugs in inherited contracts.