@skalenetwork/upgrade-tools 3.0.0-safe-mock.0 → 3.0.0-safe-mock.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/upgrader.js +9 -1
- package/dist/src/verification.js +3 -1
- package/dist/src/version.js +18 -1
- package/package.json +3 -1
package/dist/src/upgrader.js
CHANGED
|
@@ -64,7 +64,6 @@ class Upgrader {
|
|
|
64
64
|
implementationAddress: newImplementationAddress,
|
|
65
65
|
name: contract
|
|
66
66
|
});
|
|
67
|
-
await (0, verification_1.verify)(contract, newImplementationAddress, []);
|
|
68
67
|
}
|
|
69
68
|
else {
|
|
70
69
|
console.log(chalk_1.default.gray(`Contract ${contract} is up to date`));
|
|
@@ -83,6 +82,15 @@ class Upgrader {
|
|
|
83
82
|
await this.setVersion(version);
|
|
84
83
|
await fs_1.promises.writeFile(`data/transactions-${version}-${hardhat_2.network.name}.json`, JSON.stringify(this.transactions, null, 4));
|
|
85
84
|
await this.submitter.submit(this.transactions);
|
|
85
|
+
if (process.env.NO_VERIFY) {
|
|
86
|
+
console.log("Skip verification");
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
console.log("Start verification");
|
|
90
|
+
for (const contract of contractsToUpgrade) {
|
|
91
|
+
await (0, verification_1.verify)(contract.name, contract.implementationAddress, []);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
86
94
|
console.log("Done");
|
|
87
95
|
}
|
|
88
96
|
// private
|
package/dist/src/verification.js
CHANGED
|
@@ -5,10 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.verifyProxy = exports.verify = void 0;
|
|
7
7
|
const hardhat_1 = require("hardhat");
|
|
8
|
+
const chain_config_1 = require("@nomicfoundation/hardhat-verify/internal/chain-config");
|
|
8
9
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
10
|
const upgrades_core_1 = require("@openzeppelin/upgrades-core");
|
|
10
11
|
async function verify(contractName, contractAddress, constructorArguments) {
|
|
11
|
-
|
|
12
|
+
const chainId = (await hardhat_1.ethers.provider.getNetwork()).chainId;
|
|
13
|
+
if (chain_config_1.builtinChains.find(chain => chain.chainId === chainId) !== undefined) {
|
|
12
14
|
for (let retry = 0; retry <= 5; ++retry) {
|
|
13
15
|
try {
|
|
14
16
|
await (0, hardhat_1.run)("verify:verify", {
|
package/dist/src/version.js
CHANGED
|
@@ -8,6 +8,23 @@ const child_process_1 = require("child_process");
|
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
const util_1 = __importDefault(require("util"));
|
|
10
10
|
const exec = util_1.default.promisify(child_process_1.exec);
|
|
11
|
+
class VersionNotFound extends Error {
|
|
12
|
+
}
|
|
13
|
+
async function getVersionFilename(folder) {
|
|
14
|
+
if (folder === undefined) {
|
|
15
|
+
return getVersionFilename((await exec("git rev-parse --show-toplevel")).stdout.trim());
|
|
16
|
+
}
|
|
17
|
+
const VERSION_FILENAME = 'VERSION', path = `${folder}/${VERSION_FILENAME}`;
|
|
18
|
+
if ((0, fs_1.existsSync)(path)) {
|
|
19
|
+
return path;
|
|
20
|
+
}
|
|
21
|
+
for (const entry of await fs_1.promises.readdir(folder, { withFileTypes: true, recursive: true })) {
|
|
22
|
+
if (entry.isFile() && entry.name === VERSION_FILENAME) {
|
|
23
|
+
return `${entry.path}/${entry.name}`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
throw new VersionNotFound("Can't find version file");
|
|
27
|
+
}
|
|
11
28
|
const getVersion = async () => {
|
|
12
29
|
if (process.env.VERSION) {
|
|
13
30
|
return process.env.VERSION;
|
|
@@ -17,7 +34,7 @@ const getVersion = async () => {
|
|
|
17
34
|
return tag;
|
|
18
35
|
}
|
|
19
36
|
catch {
|
|
20
|
-
return (await fs_1.promises.readFile(
|
|
37
|
+
return (await fs_1.promises.readFile(await getVersionFilename(), "utf-8")).trim();
|
|
21
38
|
}
|
|
22
39
|
};
|
|
23
40
|
exports.getVersion = getVersion;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skalenetwork/upgrade-tools",
|
|
3
|
-
"version": "3.0.0-safe-mock.
|
|
3
|
+
"version": "3.0.0-safe-mock.2",
|
|
4
4
|
"description": "Scripts to support upgrades of smart contracts",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*"
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"@tsconfig/recommended": "^1.0.2",
|
|
28
28
|
"@typechain/ethers-v5": "^9.0.0",
|
|
29
29
|
"@typechain/hardhat": "^8.0.0",
|
|
30
|
+
"@types/node": "^20.6.0",
|
|
30
31
|
"@typescript-eslint/eslint-plugin": "^6.6.0",
|
|
31
32
|
"@typescript-eslint/parser": "^6.6.0",
|
|
32
33
|
"cspell": "^7.0.0",
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
"ethereumjs-util": "^7.1.4"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
49
|
+
"@nomicfoundation/hardhat-verify": "^1.1.1",
|
|
48
50
|
"@nomiclabs/hardhat-ethers": "^2.0.4",
|
|
49
51
|
"@openzeppelin/hardhat-upgrades": "^1.14.0",
|
|
50
52
|
"@openzeppelin/upgrades-core": "^1.27.1",
|