📈 GH Trending Explorer 🎲 Surprise me

← all repos

OpenZeppelin / openzeppelin-foundry-upgrades

git clone https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades.git v0.4.2 · 2mo ago 🔥 on GitHub Trending today

Foundry library for deploying and managing upgradeable contracts

+0
stars, 24h · #15,281
+~0
stars, 7 days · #15,845
+0
stars, 30 days · #22,299
257
★ total
42
forks · 13 open issues

Star history (as recorded here)

2026-10-20 · 257 ★ 2026-10-22 · 257 ★
LanguageSolidity
LicenseMIT
Created2023-10-17 (3y ago)
Last pushtoday
Watchers10
OwnerOrganization

Seen on GitHub Trending

  • 2026-10-22 — #8 monthly in solidity
  • 2026-10-21 — #9 monthly in solidity
  • 2026-10-20 — #9 monthly in solidity

Links

README excerpt
# OpenZeppelin Foundry Upgrades
Foundry library for deploying and managing upgradeable contracts, which includes upgrade safety validations.
## Installing
Follow one of the sections below depending on which version of OpenZeppelin Contracts you are using. OpenZeppelin Contracts v5 is required for new deployments.
### Using OpenZeppelin Contracts v5
Run these commands:
 [code] 
Set the following in `remappings.txt`, replacing any previous definitions of these remappings:
 [code] 
> **Note**
> The above remappings mean that both `@openzeppelin/contracts/` (including proxy contracts deployed by this library) and `@openzeppelin/contracts-upgradeable/` come from your installation of the `openzeppelin-contracts-upgradeable` submodule and its subdirectories, which includes its own transitive copy of `openzeppelin-contracts` of the same release version number. This format is needed for Etherscan verification to work. Particularly, any copies of `openzeppelin-contracts` that you install separately are NOT used.
### Using OpenZeppelin Contracts v4
Run these commands, replacing `v4.9.6` with the specific version of OpenZeppelin Contracts that you are using:
 [code] 
Set the following in `remappings.txt`:
 [code] 
> **Note**
> Use LegacyUpgrades.sol instead of `Upgrades.sol` to upgrade existing deployments that were created with OpenZeppelin Contracts v4.
### Optional: Alternative installation methods
#### NPM
Follow the steps above, but instead of running `forge install OpenZeppelin/openzeppelin-foundry-upgrades`, use this command instead:
 [code] 
Then add the following additional line to `remappings.txt`, in addition to the ones described above:
 [code] 
> **Note**
> This library can also be used in Hardhat 3 Solidity tests, where the same remapping applies. See Using with Hardhat — Solidity tests for the Hardhat configuration and an example.
#### Soldeer
Follow the steps above, but instead of running `forge install OpenZeppelin/openzeppelin-foundry-upgrades`, use one of the install commands described in https://soldeer.xyz/project/openzeppelin-foundry-upgrades
Then add the following additional line to `remappings.txt`, in addition to the ones described above (replace `0.3.6` with the version of the plugin that you installed):
 [code] 
## OpenZeppelin Defender integration
See DEFENDER.md
## Requirements
- forge-std version 1.9.5 or higher.
- Solidity version 0.8.13 or higher.
## Before Running
This library uses the OpenZeppelin Upgrades CLI for upgrade safety validations, which are run by default during deployments and upgrades.
If you want to be able to run upgrade safety validations, the following are needed:
1. Install Node.js.
2. Configure your `foundry.toml` to enable ffi, ast, build info and storage layout:
 [code] 
3. If you are upgrading your contract from a previous version, add the `@custom:oz-upgrades-from ` annotation to the new version of your contract according to Define Reference Contracts or specify the `referenceContract` option when call