Skip to content

Commit

Permalink
Prepare for NPM publishing, update instructions for NPM and Soldeer (#86
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ericglau authored Dec 4, 2024
1 parent 8e754fd commit 6461ba3
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ broadcast/
# Node modules
node_modules/

# NPM package files
*.tgz

# Hardhat build output
artifacts/
cache_hardhat/
Expand Down
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,31 @@ Set the following in `remappings.txt`:
> **Note**
> Use [LegacyUpgrades.sol](src/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:
```
npm install @openzeppelin/foundry-upgrades
```

Then add the following additional lines to `remappings.txt`, in addition to the ones described above:
```
openzeppelin-foundry-upgrades/=node_modules/@openzeppelin/foundry-upgrades/src/
solidity-stringutils/=node_modules/@openzeppelin/foundry-upgrades/lib/solidity-stringutils/
```

#### 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 lines to `remappings.txt`, in addition to the ones described above (replace `0.3.6` with the version of the plugin that you installed):
```
openzeppelin-foundry-upgrades/=dependencies/openzeppelin-foundry-upgrades-0.3.6/src/
solidity-stringutils/=dependencies/openzeppelin-foundry-upgrades-0.3.6/lib/solidity-stringutils/
```

## OpenZeppelin Defender integration

See [DEFENDER.md](DEFENDER.md)
Expand Down
28 changes: 28 additions & 0 deletions docs/modules/pages/foundry-upgrades.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,34 @@ Set the following in `remappings.txt`:

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:
[source,console]
----
npm install @openzeppelin/foundry-upgrades
----

Then add the following additional lines to `remappings.txt`, in addition to the ones described above:
[source,console]
----
openzeppelin-foundry-upgrades/=node_modules/@openzeppelin/foundry-upgrades/src/
solidity-stringutils/=node_modules/@openzeppelin/foundry-upgrades/lib/solidity-stringutils/
----

==== 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 lines to `remappings.txt`, in addition to the ones described above (replace `0.3.6` with the version of the plugin that you installed):
[source,console]
----
openzeppelin-foundry-upgrades/=dependencies/openzeppelin-foundry-upgrades-0.3.6/src/
solidity-stringutils/=dependencies/openzeppelin-foundry-upgrades-0.3.6/lib/solidity-stringutils/
----

== Foundry Requirements

This library requires https://github.com/foundry-rs/forge-std[forge-std] version 1.8.0 or higher.
Expand Down
16 changes: 14 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
{
"name": "openzeppelin-foundry-upgrades",
"private": true,
"name": "@openzeppelin/foundry-upgrades",
"version": "0.3.6",
"description": "Foundry library for deploying and managing upgradeable contracts",
"license": "MIT",
"files": [
"src/**/*",
"lib/solidity-stringutils/**/*"
],
"repository": {
"type": "git",
"url": "https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades.git"
},
"scripts": {
"clean": "forge clean && hardhat clean",
"compile": "forge build",
Expand Down Expand Up @@ -33,5 +41,9 @@
"solhint": "^3.3.6",
"solhint-plugin-openzeppelin": "file:scripts/solhint-custom",
"solidity-docgen": "^0.6.0-beta.36"
},
"peerDependencies": {
"@openzeppelin/defender-deploy-client-cli": "0.0.1-alpha.9",
"@openzeppelin/upgrades-core": "^1.37.0"
}
}

0 comments on commit 6461ba3

Please sign in to comment.