openzeppelin-contracts-upgradeable
CLAUDE.md1.2k starsChanged 24 days agoMITView on GitHub
This repository is a Solidity smart contract library: reusable abstract contract and library implementations meant to be inherited and extended by downstream projects. It is not a deployed product. Most conventions exist because code here is a base for others: functions must be overridable, argument types must not constrain inheritors, and the public API must not force a particular call context on child contracts. Read GUIDELINES.md first — it is the human contributor spec and authoritative. This file is for…
1 other project uses a version of this.
Trending
More talk lately.about the whole repository
Most recently taken up by
- OpenZeppelin/openzeppelin-contractsword for word, first seen Oct 8, 2026
Who's talking about OpenZeppelin/openzeppelin-contracts-upgradeable
- smartcontractkit/chainlink“[FEAT] Chainlink upgradeable smart contracts”GitHub · Sep 7, 2021 · 40 reactions
- foundry-rs/foundry“Support EIP-7201 in `forge inspect storage`”GitHub · Apr 14, 2024 · 4 reactions
- OpenZeppelin/openzeppelin-contracts“Use diamond storage instead of gaps in upgradeable contracts”GitHub · Nov 12, 2021 · 3 reactions
- code-423n4/2022-06-nibbl-findings“[PNM-001] Function `permit` directly uses `_approve`, suffering from the well-known double attacks”GitHub · Jun 24, 2022 · 2 reactions
- OpenZeppelin/openzeppelin-contracts“Release 4.7”GitHub · May 4, 2022 · 2 reactions
The biggest 5 of 51 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 51
Talked about on GitHub and Stack Overflow (51 times).
On GitHub · 50
- Sep 7, 2021[FEAT] Chainlink upgradeable smart contracts — smartcontractkit/chainlink40 reactions · 15 comments
- Apr 14, 2024Support EIP-7201 in `forge inspect storage` — foundry-rs/foundry4 reactions · 9 comments
- Nov 12, 2021Use diamond storage instead of gaps in upgradeable contracts — OpenZeppelin/openzeppelin-contracts3 reactions · 37 comments
- Jun 24, 2022[PNM-001] Function `permit` directly uses `_approve`, suffering from the well-known double attacks — code-423n4/2022-06-nibbl-findings2 reactions · 3 comments
- May 4, 2022Release 4.7 — OpenZeppelin/openzeppelin-contracts2 reactions · 4 comments
45 more on GitHub
- Jun 2, 2026chore(deps-dev): bump the openzeppelin group across 1 directory with 3 updates — XFuel-Lab/chit4021 reaction · 5 comments
- Apr 8, 2026foundry-rs#13763 (#398) — Dargon789/foundry1 reaction · 12 comments
- Mar 9, 2026`forge install` submodule cleanup discrepancy when using `--no-git` — foundry-rs/foundry1 reaction
- Dec 17, 2023cergyk - FootiumClub::ERC721Upgradeable/Pausable Cannot pause transfers on FootiumClub NFT — sherlock-audit/2023-12-footium-judging1 reaction · 15 comments
- Oct 27, 2023__Ownable_init() function isn't called properly in the initializer — hats-finance/Smooth-0x64bc275b37e62eec81a00ecaecd2b9567058f9901 reaction · 1 comment
- Oct 17, 2023Ownable2StepUpgradeable requires initializing OwnableUpgradeable — OpenZeppelin/openzeppelin-contracts1 reaction · 12 comments
- Nov 14, 2022removes base contract dependency on hardhat / fixes initializer modifiers — Network-Goods/hypercerts-protocol1 reaction · 3 comments
- Oct 20, 2022[R&D review] Unify ERC20 interfaces — morpho-org/morpho-optimizers-vaults1 reaction · 12 comments
- Oct 18, 2022Contracts without GAP can lead a upgrade disaster — code-423n4/2022-10-traderjoe-findings1 reaction · 2 comments
- Aug 6, 2022 Use of not recommended ERC721 _mint function — code-423n4/2022-08-rigor-findings1 reaction · 1 comment
- Jun 25, 2022QA Report — code-423n4/2022-06-yieldy-findings1 reaction
- Jan 10, 2022New keyword `pin` for fixed sparse storage layouts — argotorg/solidity1 reaction · 10 comments
- Nov 4, 2026chore(deps): bump lib/openzeppelin-contracts-upgradeable from `7bd46d8` to `7839763` — YieldShield/smart-contracts0 reactions · 1 comment
- Nov 4, 2026Bump contracts/lib/openzeppelin-contracts-upgradeable from `7bf4727` to `7839763` — Rong0715/assert-dao0 reactions
- Nov 3, 2026chore(deps): bump lib/openzeppelin-contracts-upgradeable from `ed0d253` to `7839763` — the3rdweblabs/payment-kit.evm0 reactions · 2 comments
- Nov 3, 2026Bump lib/openzeppelin-contracts-upgradeable from `3d5fa5c` to `7839763` — lukema95/flip-core0 reactions
- Nov 2, 2026chore(deps): bump lib/openzeppelin-contracts-upgradeable from `fc6d2f3` to `58c8c82` — owieth/foundry-setup0 reactions
- Nov 2, 2026build(deps): bump contracts/lib/openzeppelin-contracts-upgradeable from `1717bdd` to `ce38bf1` — YieldShield/yieldshield-bnb-open-source0 reactions
- Oct 28, 2026chore(deps): bump lib/openzeppelin-contracts-upgradeable from `7bd46d8` to `fc6d2f3` — YieldShield/smart-contracts0 reactions · 2 comments
- Oct 21, 2026chore(deps): bump @openzeppelin/contracts-upgradeable from 5.3.0 to 5.4.0 — Datura-ai/celium-collateral-contracts0 reactions
- Oct 15, 2026chore(deps): bump @openzeppelin/contracts-upgradeable from 5.4.0 to 5.7.0 in /solidity in the openzeppelin-contracts group across 1 directory — oasisprotocol/privana0 reactions · 1 comment
- Oct 1, 2026chore(deps): Bump contracts/lib/openzeppelin-contracts-upgradeable from `527c1bd` to `66f1abd` — ismellike/nft-gacha0 reactions
- Sep 18, 2026Bump @openzeppelin/contracts-upgradeable from 5.0.0 to 5.0.2 in the npm_and_yarn group across 1 directory — Ronnie-Ahmed/Foundry_Tutorial0 reactions
- Sep 1, 2026chore(deps): bump contracts/lib/openzeppelin-contracts-upgradeable from `c1b1bed` to `f8fc282` — NeoWeb3Nova/NeoDeFi0 reactions · 1 comment
- Jul 27, 2026Bump lib/openzeppelin-contracts-upgradeable from `723f8ca` to `7a37a98` — dust/zen-staking-layer0 reactions
- Jun 20, 2026chore(deps): bump contracts/lib/openzeppelin-contracts-upgradeable from `7bf4727` to `c1b1bed` — tresr-community/tresr-game0 reactions
- Jun 4, 2026deps: bump the openzeppelin group across 1 directory with 3 updates — eq-lab/pipeline-contracts0 reactions
- Apr 20, 2026Track upstream OZ PR to expose ERC-7201 root slot as internal — S01-Issuer/st0x.deploy0 reactions · 3 comments
- Mar 9, 2026chore(deps): bump lib/openzeppelin-contracts-upgradeable from `60b305a` to `524c8c9` — k0yote/newlo-point0 reactions
- Nov 25, 2025Bump @openzeppelin/contracts-upgradeable from 5.0.1 to 5.0.2 — vechain/vevote0 reactions · 2 comments
- Feb 19, 2025Bald Crimson Alligator - Launch contract does not use upgradable versions of parent initializer functions — sherlock-audit/2025-02-rova-judging0 reactions
- Feb 5, 2025Bump @openzeppelin/contracts-upgradeable from 4.9.3 to 4.9.6 — lidofinance/linea-contracts0 reactions
- Dec 5, 2024Energetic Honeysuckle Leopard - corrupt upgdreability pattarn — sherlock-audit/2024-11-ethos-network-ii-judging0 reactions
- Dec 2, 2024Bump contracts/lib/openzeppelin-contracts-upgradeable from `723f8ca` to `5fcea08` — ava-labs/avalanche-interchain-token-transfer0 reactions
- Nov 5, 2024USDE : renounceRole is not fully sealed — hats-finance/Euro-Dollar-0xa4ccd3b6daa763f729ad59eae75f9cbff7baf2cd0 reactions · 1 comment
- Aug 6, 2024chore(deps): update dependency @openzeppelin/contracts to v4.9.6 [security] — ashutoshvarma/sway0 reactions · 1 comment
- Jul 8, 2024Bump @openzeppelin/contracts-upgradeable from 5.0.0 to 5.0.2 — Ultra-Tech-code/Dynamic_NFT0 reactions
- Jun 8, 2024Uninitialized Implementation Contracts are not Completely Protected — code-423n4/2024-05-predy-validation0 reactions
- May 1, 2024CvxRewardDistributor misses `_Ownable2Step_init()` in the `initialize()` function — hats-finance/Convergence---Convex-integration-0xb3df23e155b74ad2b93777f58980d6727e8b40bb0 reactions · 13 comments
- Apr 29, 2024chore(deps): bump lib/openzeppelin-contracts-upgradeable from `762e9bc` to `82e861e` — Akagi201/foundry-template0 reactions
- Apr 24, 2024build(deps-dev): bump @openzeppelin/contracts-upgradeable from 4.9.3 to 4.9.6 — henkaku-center/mono-auction-contract0 reactions
- Apr 16, 2024chore(deps-dev): bump @openzeppelin/contracts-upgradeable from 4.9.3 to 4.9.6 — spherity/ethr-revocation-registry0 reactions
- Feb 29, 2024Bump @openzeppelin/contracts-upgradeable from 4.9.3 to 4.9.6 — Fathom-Fi/fathom-solidity-sdk0 reactions
- Feb 29, 2024Bump @openzeppelin/contracts-upgradeable from 4.9.3 to 4.9.6 in /contracts — 1337CyberSecurity/chainlink0 reactions
- Feb 29, 2024Bump @openzeppelin/contracts-upgradeable from 4.9.3 to 4.9.6 — eniblock/website-demo0 reactions
On Stack Overflow · 1
Other versions1 project uses a version of this.
Word for word · 1
- OpenZeppelin/openzeppelin-contracts★ 27k100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository4 other files it gives its agents.
- add-changesetSkill
- library-api-designSkill
- solidity-styleSkill
- testingSkill
The file
We split this CLAUDE.md into the rules it gives an agent
7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 5
Read GUIDELINES.md first — it is the human contributor spec and authoritative.
- Very specific: line 7
Before preparing a contribution, also read CONTRIBUTING.md thoroughly.
- Distinctive: line 53
If a lint rule already catches it, don't waste tokens explaining it — fix and move on.
- Very specific: line 59
File header version line: don't add or edit the // OpenZeppelin Contracts (last updated vX.Y.Z) (path) line — release tooling …
- Very specific: line 62
Inheritance order is globally consistent: if you change an is A, B, C list, run npm run compile && npm run test:inheritance before pushing.
- Distinctive: line 63
Changesets: every PR that changes contract behavior needs one.
- Very specific: line 64
Procedurally generated files: never hand-edit a file whose header says "procedurally generated from <template>".
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
openzeppelin-contracts — Claude project guide
This repository is a Solidity smart contract library: reusable abstract contract and library implementations meant to be inherited and extended by downstream projects. It is not a deployed product. Most conventions exist because code here is a base for others: functions must be overridable, argument types must not constrain inheritors, and the public API must not force a particular call context on child contracts.
Read GUIDELINES.md first — it is the human contributor spec and authoritative. This file is for what is specific to Claude-assisted work, plus the conventions not fully documented elsewhere.
Before preparing a contribution, also read CONTRIBUTING.md thoroughly. Non-trivial changes must be discussed in an issue before a PR is opened.
Repo map
| Path | Purpose |
contracts/ | Library source. Subdirectory layout (token/ERC20/, access/, utils/, …) mirrors the public API. |
contracts/mocks/ | Mocks used by tests. Mirrors contracts/. Manual mocks only — see the testing skill. |
contracts/interfaces/ | ERC interfaces in their pristine spec form. |
test/ | Hardhat + Chai tests (.test.js), shared behaviors (.behavior.js), and Foundry tests (.t.sol). |
contracts-exposed/ | Auto-generated $ContractName wrappers from hardhat-exposed. Gitignored. Do not edit. |
fv/ | Certora specs (fv/specs/*.{conf,spec}), harnesses, and make-applied patches. |
scripts/generate/ | Procedurally generated .sol files (Arrays variants, Checkpoints, EnumerableSet, …). Source of truth is the template, not the generated file. |
scripts/checks/ | CI checks: inheritance-ordering.js, pragma-validity.js, generation diff, storage layout. |
docs/ | AsciiDoc sources used by the OZ documentation site. Per-module README.adoc files in contracts/**/ are also rendered. |
.changeset/ | Per-PR changelog entries consumed by the release workflow. |
audits/ | Historical third-party audit reports, one per release. Reference only. |
.claude/skills/ | Skills specific to working in this repository, loaded by AI assistants per task. See CONTRIBUTING.md. |
Commands
| Task | Command |
| Compile | npm run compile |
| Tests (JS + Solidity) | npm test |
| Foundry tests only (forge defaults) | forge test -vvv |
| Halmos symbolic tests | halmos --match-test '^symbolic|^testSymbolic' -vv |
| Lint (JS + Sol) | npm run lint / npm run lint:fix |
| Coverage | npm run coverage |
| Inheritance order check | npm run test:inheritance |
| Pragma validity check | npm run test:pragma |
| Generated-file freshness check | npm run test:generation |
| Regenerate procedural contracts | npm run generate |
| Add a changelog entry | npx changeset add |
| Run a single Certora spec | node fv/run.js <SpecName> (apply harnesses first: make -C fv apply) |
What linting via solhint already enforces (don't re-state in code review)
solhint-plugin-openzeppelin + scripts/solhint-custom/index.js enforce, on contracts/**/*.sol (mocks and tests are exempt):
- State variables are
private(constant/immutableare the only exceptions). - Underscore prefix matches visibility:
private/internalstate vars and functions get_;public/externaldo not. Library internal functions do NOT get_. - No
external virtual(except fallback). Thepublicdefault makes this redundant; flagged byno-external-virtual. - Libraries expose only
internal/private. - Interfaces start with
I, contracts use CapWords, events use CapWords, modifiers/params mixedCase.
If a lint rule already catches it, don't waste tokens explaining it — fix and move on.
Always-on conventions
These apply to every change and are not lint-enforced:
- File header version line: don't add or edit the
// OpenZeppelin Contracts (last updated vX.Y.Z) (path)line — release tooling (scripts/release/update-comment.js) maintains it automatically based ongit diffbetween the previous tag andHEAD. The SPDX line is your only responsibility. - Pragma: don't pick the floor by hand. Run
npm run pragmaand letscripts/minimize-pragma.jswalk the dependency graph, compile against every candidatesolc, and write back the lowest version that works for each file (>=prefix for interfaces,^for implementations and libraries). Bumping the floor casually can introduce opcodes (mcopyin 0.8.24, etc.) not supported on all target chains — the script's output is the safe answer. - Imports: 100% named, curly-brace, relative paths within
contracts/. No wildcards. - Inheritance order is globally consistent: if you change an
is A, B, Clist, runnpm run compile && npm run test:inheritancebefore pushing. - Changesets: every PR that changes contract behavior needs one. Skip for NatSpec-only, internal refactors with no user-visible effect, or pure repo plumbing.
- Procedurally generated files: never hand-edit a file whose header says "procedurally generated from
<template>". Edit the template underscripts/generate/templates/and runnpm run generate. CI runstest:generationto enforce. - Backward compatibility: released contracts are inherited downstream and transpiled into the
-upgradeablepackage. Don't change existingpublic/externalsignatures, event or error shapes, or the storage layout of existing contracts. Changes are additive; deprecate rather than delete. Breaking changes are a maintainer decision tied to a major release. - Dependencies: this library has no third-party dependencies that translate to the user, and nothing that could change behavior out from under it. Don't add an npm or Solidity dependency or a new external import without maintainer sign-off; reuse existing
contracts/utils/helpers first. Code that needs third-party dependencies belongs inopenzeppelin-community-contracts, not here.
When to load which skill
Claude Code surfaces these from .claude/skills/ based on the task. You can also reference them directly:
library-api-design— when adding or modifying any contract incontracts/(visibility,virtual,memoryvscalldata,_updatepattern, internal/external split, no-ops over reverts, hooks).solidity-style— when writing or editing Solidity (errors, events, NatSpec, ERC-7201, assembly,unchecked, casting, immutables).testing— when writing tests or mocks (hardhat-exposed$wrappers, when manual mocks are warranted,.behavior.jsreuse, multi-target test loops, Foundry fuzz, Halmos symbolic, Certora).add-changeset— at PR close, or when the user asks for one.
Things to always verify manually
AI suggestions in these areas are often plausible-but-wrong. Read the surrounding code before accepting:
- Cryptography — anything in
contracts/utils/cryptography/, hashing, ECDSA, EIP-712 domains, BLS, signatures. - ERC-7201 slot derivations — recompute with
SlotDerivation.erc7201Slot()and compare to the constant. The formula in the inline comment is mandatory. - Storage layout for transpiler-processed contracts — adding/removing/reordering fields breaks proxied deployments. CI runs storage-layout diff but read it.
delegatecall, inline assembly, memory safety — verify thememory-safeannotation is honest and stack/scratch usage is bounded.uncheckedinvariants — re-derive the overflow-impossible claim for every code path. The inline comment is the contract._authorizeUpgradeaccess control — the base is empty by design; every override must restrict._disableInitializers()in implementation constructors for UUPS/Transparent proxy targets.- Pragma bumps — check that any new opcode the compiler will emit is supported on all target chains.
Out of scope for AI
- Adding/renaming public API or deciding whether a feature belongs in the library — open an issue first.
- Security assessments or audit opinions.
- New ERC interfaces or standards without explicit direction.
- Restructuring tests without a corresponding contract change.
- Fabricated bug bounties and security rewards. Never claim or imply a reward, amount, or eligibility. The only existing program is Immunefi (See
SECURITY.md).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

