← ClaudeAtlas

ekx-openzeppelin-upgradeslisted

Upgradeable contract patterns with OpenZeppelin — UUPS proxies, initializers, storage layout safety, access control, and merkle-tree allowlists. Use when writing an upgradeable contract, adding a storage variable to a deployed one, running the upgrade-safe validations, or building a merkle allowlist.
Ekinoxis-evm/claude-skills · ★ 0 · AI & Automation · score 60
Install: claude install-skill Ekinoxis-evm/claude-skills
# OpenZeppelin (upgrades + utilities) `@openzeppelin/upgrades-core`, `upgrade-safe-transpiler`, `merkle-tree` and `docs-utils` are in all three of our Foundry contract suites. Docs: https://docs.openzeppelin.com/contracts --- ## Upgradeable contracts We use **UUPS**, not Transparent — the upgrade logic lives in the implementation, so the proxy is cheaper to deploy, and we deploy one proxy per property. ```solidity contract AuctionManager is Initializable, UUPSUpgradeable, OwnableUpgradeable { function initialize(address usdc_, address owner_) public initializer { __Ownable_init(owner_); __UUPSUpgradeable_init(); usdc = IERC20(usdc_); } function _authorizeUpgrade(address) internal override onlyOwner {} /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } } ``` Four things that are not optional: 1. **`_disableInitializers()` in the constructor.** Without it, anyone can initialize the *implementation* contract directly and, with UUPS, call `upgradeTo` on it — a known way to brick the proxy. 2. **`initialize`, not a constructor.** Constructor code never runs in the proxy's context, so any state set there is invisible. 3. **`_authorizeUpgrade` must be access-controlled.** An empty override with no modifier makes the contract upgradeable by anyone. 4. **Use the `Upgradeable` variants** of every OZ base (`OwnableUpgradeable`, not `Ownable`). Mixing them corrupts storage. --- ## Storage layo