openzeppelin

Installation
SKILL.md

OpenZeppelin Contracts

OpenZeppelin Contracts is the standard library for secure smart contract development. Used by Uniswap, Aave, Compound, and most production Solidity projects. The library provides audited, modular building blocks for tokens, access control, security patterns, upgradeability, and governance.

What You Probably Got Wrong

OZ v5 shipped breaking changes in late 2023. Most LLM training data reflects v4. Every item below will cause compilation failures if you use the old pattern.

  • Ownable requires a constructor argument -- Ownable no longer has a default owner. You MUST pass the initial owner address: Ownable(initialOwner). Omitting this is the #1 compilation error.
  • Import paths changed -- v5 uses @openzeppelin/contracts/token/ERC20/ERC20.sol, not @openzeppelin/contracts/ERC20.sol. Some nested paths also changed. Always import from the full canonical path.
  • _setupRole is removed -- Use _grantRole(role, account) in the constructor instead. _setupRole does not exist in v5.
  • _safeMint internal visibility -- _safeMint is still internal but the override pattern changed. Override _update instead of _beforeTokenTransfer / _afterTokenTransfer.
  • Hook functions renamed -- _beforeTokenTransfer and _afterTokenTransfer are gone. Override _update(from, to, value) for ERC-20 and _update(to, tokenId, auth) for ERC-721.
  • ERC-721 Enumerable override -- v5 requires overriding _increaseBalance in addition to _update when combining ERC721Enumerable with other extensions.
  • SafeMath is removed -- Solidity 0.8+ has built-in overflow checks. SafeMath was deleted from v5 entirely.
  • Counters is removed -- Use plain uint256 with ++ instead. The Counters library was removed for being unnecessary abstraction.
  • AccessControl.renounceRole requires callerConfirmation -- In v5, renounceRole(role, callerConfirmation) takes a second parameter to prevent accidental renouncement.

Quick Start

Installs
1
First Seen
Aug 4, 2026
openzeppelin — justaname-id/cryptoskills