Update docs

This commit is contained in:
github-actions
2023-09-28 21:35:16 +00:00
parent 85822663f2
commit 9ac3ab322f
28 changed files with 2839 additions and 13215 deletions

View File

@ -1,7 +1,5 @@
const fs = require('fs');
const { findAll } = require('solidity-ast/utils');
const { astDereferencer } = require('@openzeppelin/upgrades-core/dist/ast-dereferencer');
const { solcInputOutputDecoder } = require('@openzeppelin/upgrades-core/dist/src-decoder');
const { findAll, astDereferencer, srcDecoder } = require('solidity-ast/utils');
const { extractStorageLayout } = require('@openzeppelin/upgrades-core/dist/storage/extract');
const { _ } = require('yargs').argv;
@ -13,7 +11,7 @@ function extractLayouts(path) {
const layout = {};
const { input, output } = JSON.parse(fs.readFileSync(path));
const decoder = solcInputOutputDecoder(input, output);
const decoder = srcDecoder(input, output);
const deref = astDereferencer(output);
for (const src in output.contracts) {

View File

@ -4,9 +4,20 @@ set -euo pipefail
shopt -s globstar
# cross platform `mkdir -p`
node -e 'fs.mkdirSync("build/contracts", { recursive: true })'
mkdirp() {
node -e "fs.mkdirSync('$1', { recursive: true })"
}
cp artifacts/contracts/**/*.json build/contracts
rm build/contracts/*.dbg.json
# cd to the root of the repo
cd "$(git rev-parse --show-toplevel)"
npm run clean
env COMPILE_MODE=production npm run compile
mkdirp contracts/build/contracts
cp artifacts/contracts/**/*.json contracts/build/contracts
rm contracts/build/contracts/*.dbg.json
node scripts/remove-ignored-artifacts.js
cp README.md contracts/

View File

@ -1,15 +0,0 @@
#!/usr/bin/env bash
# cd to the root of the repo
cd "$(git rev-parse --show-toplevel)"
# avoids re-compilation during publishing of both packages
if [[ ! -v ALREADY_COMPILED ]]; then
npm run clean
npm run prepare
npm run prepack
fi
cp README.md contracts/
mkdir contracts/build contracts/build/contracts
cp -r build/contracts/*.json contracts/build/contracts

View File

@ -1,10 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
if [ "${SKIP_COMPILE:-}" == true ]; then
exit
fi
npm run clean
env COMPILE_MODE=production npm run compile

View File

@ -23,7 +23,7 @@ const ignorePatternsSubtrees = ignorePatterns
.concat(ignorePatterns.map(pat => path.join(pat, '**/*')))
.map(p => p.replace(/^\//, ''));
const artifactsDir = 'build/contracts';
const artifactsDir = 'contracts/build/contracts';
const buildinfo = 'artifacts/build-info';
const filenames = fs.readdirSync(buildinfo);

View File

@ -1,4 +1,5 @@
{
"name": "solhint-plugin-openzeppelin",
"version": "0.0.0",
"private": true
}

View File

@ -2,9 +2,12 @@
set -euo pipefail -x
VERSION="$(jq -r .version contracts/package.json)"
DIRNAME="$(dirname -- "${BASH_SOURCE[0]}")"
bash "$DIRNAME/patch-apply.sh"
sed -i "s/<package-version>/$VERSION/g" contracts/package.json
git add contracts/package.json
npm run clean
npm run compile
@ -24,7 +27,8 @@ fi
# -p: emit public initializer
# -n: use namespaces
# -N: exclude from namespaces transformation
npx @openzeppelin/upgrade-safe-transpiler@latest -D \
# -q: partial transpilation using @openzeppelin/contracts as peer project
npx @openzeppelin/upgrade-safe-transpiler -D \
-b "$build_info" \
-i contracts/proxy/utils/Initializable.sol \
-x 'contracts-exposed/**/*' \
@ -36,7 +40,8 @@ npx @openzeppelin/upgrade-safe-transpiler@latest -D \
-x '!contracts/proxy/beacon/IBeacon.sol' \
-p 'contracts/**/presets/**/*' \
-n \
-N 'contracts/mocks/**/*'
-N 'contracts/mocks/**/*' \
-q '@openzeppelin/'
# delete compilation artifacts of vanilla code
npm run clean

View File

@ -59,7 +59,7 @@ index ff596b0c3..000000000
-<!-- Make sure that you have reviewed the OpenZeppelin Contracts Contributor Guidelines. -->
-<!-- https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/CONTRIBUTING.md -->
diff --git a/README.md b/README.md
index 53c29e5f8..666a667d3 100644
index 549891e3f..a6b24078e 100644
--- a/README.md
+++ b/README.md
@@ -23,6 +23,9 @@
@ -81,8 +81,8 @@ index 53c29e5f8..666a667d3 100644
```
#### Foundry (git)
@@ -40,10 +43,10 @@ $ npm install @openzeppelin/contracts
> **Warning** Foundry installs the latest version initially, but subsequent `forge update` commands will use the `master` branch.
@@ -42,10 +45,10 @@ $ npm install @openzeppelin/contracts
> Foundry installs the latest version initially, but subsequent `forge update` commands will use the `master` branch.
```
-$ forge install OpenZeppelin/openzeppelin-contracts
@ -94,7 +94,7 @@ index 53c29e5f8..666a667d3 100644
### Usage
@@ -52,10 +55,11 @@ Once installed, you can use the contracts in the library by importing them:
@@ -54,10 +57,11 @@ Once installed, you can use the contracts in the library by importing them:
```solidity
pragma solidity ^0.8.20;
@ -110,7 +110,7 @@ index 53c29e5f8..666a667d3 100644
}
```
diff --git a/contracts/package.json b/contracts/package.json
index df141192d..1cf90ad14 100644
index 9017953ca..f51c1d38b 100644
--- a/contracts/package.json
+++ b/contracts/package.json
@@ -1,5 +1,5 @@
@ -129,6 +129,16 @@ index df141192d..1cf90ad14 100644
},
"keywords": [
"solidity",
@@ -28,5 +28,8 @@
"bugs": {
"url": "https://github.com/OpenZeppelin/openzeppelin-contracts/issues"
},
- "homepage": "https://openzeppelin.com/contracts/"
+ "homepage": "https://openzeppelin.com/contracts/",
+ "peerDependencies": {
+ "@openzeppelin/contracts": "<package-version>"
+ }
}
diff --git a/contracts/utils/cryptography/EIP712.sol b/contracts/utils/cryptography/EIP712.sol
index 644f6f531..ab8ba05ff 100644
--- a/contracts/utils/cryptography/EIP712.sol
@ -297,10 +307,10 @@ index 644f6f531..ab8ba05ff 100644
}
}
diff --git a/package.json b/package.json
index e6804c4cd..612ec513e 100644
index 3a1617c09..97e59c2d9 100644
--- a/package.json
+++ b/package.json
@@ -33,7 +33,7 @@
@@ -32,7 +32,7 @@
},
"repository": {
"type": "git",