@skalenetwork/upgrade-tools 3.0.0-linter.3 → 3.0.0-linter.30
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/hardhat.config.d.ts +1 -1
- package/dist/hardhat.config.js +4 -2
- package/dist/hardhat.config.js.map +1 -0
- package/dist/src/abi.d.ts +1 -1
- package/dist/src/abi.js +3 -2
- package/dist/src/abi.js.map +1 -0
- package/dist/src/contractFactory.d.ts +3 -0
- package/dist/src/contractFactory.js +84 -0
- package/dist/src/contractFactory.js.map +1 -0
- package/dist/src/deploy.d.ts +4 -4
- package/dist/src/deploy.js +54 -60
- package/dist/src/deploy.js.map +1 -0
- package/dist/src/exitCodes.d.ts +7 -0
- package/dist/src/exitCodes.js +12 -0
- package/dist/src/exitCodes.js.map +1 -0
- package/dist/src/gnosis-safe.d.ts +1 -1
- package/dist/src/gnosis-safe.js +100 -76
- package/dist/src/gnosis-safe.js.map +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/multiSend.d.ts +10 -2
- package/dist/src/multiSend.js +22 -43
- package/dist/src/multiSend.js.map +1 -0
- package/dist/src/nonceProvider.d.ts +7 -0
- package/dist/src/nonceProvider.js +18 -0
- package/dist/src/nonceProvider.js.map +1 -0
- package/dist/src/submitters/auto-submitter.d.ts +18 -5
- package/dist/src/submitters/auto-submitter.js +103 -89
- package/dist/src/submitters/auto-submitter.js.map +1 -0
- package/dist/src/submitters/eoa-submitter.d.ts +1 -1
- package/dist/src/submitters/eoa-submitter.js +15 -13
- package/dist/src/submitters/eoa-submitter.js.map +1 -0
- package/dist/src/submitters/index.js +1 -0
- package/dist/src/submitters/index.js.map +1 -0
- package/dist/src/submitters/safe-ima-legacy-marionette-submitter.js +12 -18
- package/dist/src/submitters/safe-ima-legacy-marionette-submitter.js.map +1 -0
- package/dist/src/submitters/safe-ima-marionette-submitter.d.ts +2 -2
- package/dist/src/submitters/safe-ima-marionette-submitter.js +10 -13
- package/dist/src/submitters/safe-ima-marionette-submitter.js.map +1 -0
- package/dist/src/submitters/safe-submitter.d.ts +1 -1
- package/dist/src/submitters/safe-submitter.js +3 -2
- package/dist/src/submitters/safe-submitter.js.map +1 -0
- package/dist/src/submitters/safe-to-ima-submitter.d.ts +9 -4
- package/dist/src/submitters/safe-to-ima-submitter.js +15 -12
- package/dist/src/submitters/safe-to-ima-submitter.js.map +1 -0
- package/dist/src/submitters/submitter.d.ts +1 -1
- package/dist/src/submitters/submitter.js +10 -6
- package/dist/src/submitters/submitter.js.map +1 -0
- package/dist/src/submitters/types/marionette.d.ts +1 -2
- package/dist/src/submitters/types/marionette.js +1 -0
- package/dist/src/submitters/types/marionette.js.map +1 -0
- package/dist/src/types/SkaleManifestData.js +1 -0
- package/dist/src/types/SkaleManifestData.js.map +1 -0
- package/dist/src/upgrader.d.ts +20 -4
- package/dist/src/upgrader.js +126 -101
- package/dist/src/upgrader.js.map +1 -0
- package/dist/src/verification.d.ts +2 -2
- package/dist/src/verification.js +53 -28
- package/dist/src/verification.js.map +1 -0
- package/dist/src/version.js +9 -6
- package/dist/src/version.js.map +1 -0
- package/dist/typechain-types/AdminUpgradeabilityProxy.js +1 -0
- package/dist/typechain-types/AdminUpgradeabilityProxy.js.map +1 -0
- package/dist/typechain-types/ProxyAdmin.js +1 -0
- package/dist/typechain-types/ProxyAdmin.js.map +1 -0
- package/dist/typechain-types/common.js +1 -0
- package/dist/typechain-types/common.js.map +1 -0
- package/dist/typechain-types/factories/AdminUpgradeabilityProxy__factory.js +1 -0
- package/dist/typechain-types/factories/AdminUpgradeabilityProxy__factory.js.map +1 -0
- package/dist/typechain-types/factories/ProxyAdmin__factory.js +1 -0
- package/dist/typechain-types/factories/ProxyAdmin__factory.js.map +1 -0
- package/dist/typechain-types/index.js +1 -0
- package/dist/typechain-types/index.js.map +1 -0
- package/package.json +1 -1
|
@@ -3,31 +3,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SafeToImaSubmitter = void 0;
|
|
4
4
|
const safe_submitter_1 = require("./safe-submitter");
|
|
5
5
|
class SafeToImaSubmitter extends safe_submitter_1.SafeSubmitter {
|
|
6
|
-
constructor(safeAddress, imaInstance,
|
|
7
|
-
super(safeAddress,
|
|
6
|
+
constructor(safeAddress, imaInstance, network) {
|
|
7
|
+
super(safeAddress, network.mainnetChainId);
|
|
8
8
|
this.imaInstance = imaInstance;
|
|
9
|
-
this.targetSchainHash = targetSchainHash;
|
|
9
|
+
this.targetSchainHash = network.targetSchainHash;
|
|
10
10
|
}
|
|
11
11
|
async submit(transactions) {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const singleTransaction = 1;
|
|
13
|
+
if (transactions.length > singleTransaction) {
|
|
14
|
+
SafeToImaSubmitter.atomicityWarning();
|
|
14
15
|
}
|
|
15
|
-
const messageProxyForMainnet = await this.
|
|
16
|
+
const messageProxyForMainnet = await this.getMessageProxyForMainnet();
|
|
16
17
|
const transactionsToIma = transactions.map((transaction) => ({
|
|
17
|
-
"to": messageProxyForMainnet.address,
|
|
18
18
|
"data": messageProxyForMainnet.interface.encodeFunctionData("postOutgoingMessage", [
|
|
19
19
|
this.targetSchainHash,
|
|
20
20
|
transaction.to,
|
|
21
21
|
transaction.data
|
|
22
|
-
])
|
|
22
|
+
]),
|
|
23
|
+
"to": messageProxyForMainnet.address
|
|
23
24
|
}));
|
|
24
25
|
await super.submit(transactionsToIma);
|
|
25
26
|
}
|
|
26
|
-
async
|
|
27
|
-
if (this.
|
|
28
|
-
this.
|
|
27
|
+
async getMessageProxyForMainnet() {
|
|
28
|
+
if (typeof this.messageProxyForMainnet === "undefined") {
|
|
29
|
+
this.messageProxyForMainnet =
|
|
30
|
+
await this.imaInstance.getContract("MessageProxyForMainnet");
|
|
29
31
|
}
|
|
30
|
-
return this.
|
|
32
|
+
return this.messageProxyForMainnet;
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
exports.SafeToImaSubmitter = SafeToImaSubmitter;
|
|
36
|
+
//# sourceMappingURL=safe-to-ima-submitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safe-to-ima-submitter.js","sourceRoot":"","sources":["../../../src/submitters/safe-to-ima-submitter.ts"],"names":[],"mappings":";;;AAEA,qDAA+C;AAQ/C,MAAa,kBAAmB,SAAQ,8BAAa;IAOjD,YACI,WAAmB,EACnB,WAAqB,EACrB,OAAgB;QAEhB,KAAK,CACD,WAAW,EACX,OAAO,CAAC,cAAc,CACzB,CAAC;QACF,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,MAAM,CAAE,YAAmC;QAC7C,MAAM,iBAAiB,GAAG,CAAC,CAAC;QAC5B,IAAI,YAAY,CAAC,MAAM,GAAG,iBAAiB,EAAE;YACzC,kBAAkB,CAAC,gBAAgB,EAAE,CAAC;SACzC;QACD,MAAM,sBAAsB,GAAG,MAAM,IAAI,CAAC,yBAAyB,EAAE,CAAC;QACtE,MAAM,iBAAiB,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YACzD,MAAM,EAAE,sBAAsB,CAAC,SAAS,CAAC,kBAAkB,CACvD,qBAAqB,EACrB;gBACI,IAAI,CAAC,gBAAgB;gBACrB,WAAW,CAAC,EAAE;gBACd,WAAW,CAAC,IAAI;aACnB,CACJ;YACD,IAAI,EAAE,sBAAsB,CAAC,OAAO;SACvC,CAAC,CAAC,CAAC;QACJ,MAAM,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAC1C,CAAC;IAEO,KAAK,CAAC,yBAAyB;QACnC,IAAI,OAAO,IAAI,CAAC,sBAAsB,KAAK,WAAW,EAAE;YACpD,IAAI,CAAC,sBAAsB;gBACvB,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;SACpE;QACD,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACvC,CAAC;CACJ;AA/CD,gDA+CC"}
|
|
@@ -4,18 +4,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Submitter = void 0;
|
|
7
|
+
const exitCodes_1 = require("../exitCodes");
|
|
7
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
9
|
class Submitter {
|
|
9
10
|
// Protected
|
|
10
|
-
static
|
|
11
|
-
if (
|
|
12
|
-
console.log(chalk_1.default.
|
|
13
|
-
console.log(chalk_1.default.red("If not atomic upgrade is OK set ALLOW_NOT_ATOMIC_UPGRADE environment variable"));
|
|
14
|
-
process.exit(1);
|
|
11
|
+
static atomicityWarning() {
|
|
12
|
+
if (process.env.ALLOW_NOT_ATOMIC_UPGRADE) {
|
|
13
|
+
console.log(chalk_1.default.yellow("Not atomic upgrade is performing"));
|
|
15
14
|
}
|
|
16
15
|
else {
|
|
17
|
-
console.log(chalk_1.default.
|
|
16
|
+
console.log(chalk_1.default.red("The upgrade will consist" +
|
|
17
|
+
" of multiple transactions and will not be atomic"));
|
|
18
|
+
console.log(chalk_1.default.red("If not atomic upgrade is OK" +
|
|
19
|
+
" set ALLOW_NOT_ATOMIC_UPGRADE environment variable"));
|
|
20
|
+
process.exit(exitCodes_1.EXIT_CODES.NOT_ATOMIC_UPGRADE);
|
|
18
21
|
}
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
24
|
exports.Submitter = Submitter;
|
|
25
|
+
//# sourceMappingURL=submitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submitter.js","sourceRoot":"","sources":["../../../src/submitters/submitter.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAwC;AAExC,kDAA0B;AAG1B,MAAsB,SAAS;IAG3B,YAAY;IAEF,MAAM,CAAC,gBAAgB;QAC7B,IAAI,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE;YACtC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,kCAAkC,CAAC,CAAC,CAAC;SACjE;aAAM;YACH,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,0BAA0B;gBAC5C,kDAAkD,CAAC,CAAC,CAAC;YACzD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,6BAA6B;gBAC/C,oDAAoD,CAAC,CAAC,CAAC;YAC3D,OAAO,CAAC,IAAI,CAAC,sBAAU,CAAC,kBAAkB,CAAC,CAAC;SAC/C;IACL,CAAC;CACJ;AAhBD,8BAgBC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BigNumberish, BytesLike } from "ethers";
|
|
2
|
-
import { ethers as RawEthers } from "ethers";
|
|
1
|
+
import { BigNumberish, BytesLike, ethers as RawEthers } from "ethers";
|
|
3
2
|
export declare const MARIONETTE_ADDRESS = "0xD2c0DeFACe000000000000000000000000000000";
|
|
4
3
|
type FunctionCallStruct = {
|
|
5
4
|
receiver: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marionette.js","sourceRoot":"","sources":["../../../../src/submitters/types/marionette.ts"],"names":[],"mappings":";;;AAGa,QAAA,kBAAkB,GAAG,4CAA4C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SkaleManifestData.js","sourceRoot":"","sources":["../../../src/types/SkaleManifestData.ts"],"names":[],"mappings":""}
|
package/dist/src/upgrader.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { UnsignedTransaction } from "ethers";
|
|
2
|
-
import { Submitter } from "./submitters/submitter";
|
|
3
1
|
import { Instance } from "@skalenetwork/skale-contracts-ethers-v5";
|
|
2
|
+
import { Submitter } from "./submitters/submitter";
|
|
3
|
+
import { UnsignedTransaction } from "ethers";
|
|
4
|
+
interface Project {
|
|
5
|
+
name: string;
|
|
6
|
+
instance: Instance;
|
|
7
|
+
version: string;
|
|
8
|
+
contractNamesToUpgrade: string[];
|
|
9
|
+
}
|
|
4
10
|
export declare abstract class Upgrader {
|
|
5
11
|
instance: Instance;
|
|
6
12
|
targetVersion: string;
|
|
@@ -8,11 +14,21 @@ export declare abstract class Upgrader {
|
|
|
8
14
|
projectName: string;
|
|
9
15
|
transactions: UnsignedTransaction[];
|
|
10
16
|
submitter: Submitter;
|
|
11
|
-
constructor(
|
|
17
|
+
constructor(project: Project, submitter?: Submitter);
|
|
12
18
|
abstract getDeployedVersion: () => Promise<string | undefined>;
|
|
13
19
|
abstract setVersion: (newVersion: string) => Promise<void>;
|
|
14
20
|
deployNewContracts?: () => Promise<void>;
|
|
15
21
|
initialize?: () => Promise<void>;
|
|
16
22
|
upgrade(): Promise<void>;
|
|
17
|
-
private
|
|
23
|
+
private callInitialize;
|
|
24
|
+
private callDeployNewContracts;
|
|
25
|
+
private prepareVersion;
|
|
26
|
+
private writeTransactions;
|
|
27
|
+
private static verify;
|
|
28
|
+
private switchToNewImplementations;
|
|
29
|
+
private deployNewImplementations;
|
|
30
|
+
private deployNewImplementation;
|
|
31
|
+
private getNormalizedDeployedVersion;
|
|
32
|
+
private checkVersion;
|
|
18
33
|
}
|
|
34
|
+
export {};
|
package/dist/src/upgrader.js
CHANGED
|
@@ -1,140 +1,165 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
exports.Upgrader = void 0;
|
|
7
|
-
const hardhat_1 =
|
|
30
|
+
const hardhat_1 = __importStar(require("hardhat"));
|
|
31
|
+
const auto_submitter_1 = require("./submitters/auto-submitter");
|
|
32
|
+
const exitCodes_1 = require("./exitCodes");
|
|
8
33
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const hardhat_2 = require("hardhat");
|
|
10
|
-
const admin_1 = require("@openzeppelin/hardhat-upgrades/dist/admin");
|
|
11
|
-
const version_1 = require("./version");
|
|
12
34
|
const fs_1 = require("fs");
|
|
13
|
-
const
|
|
35
|
+
const contractFactory_1 = require("./contractFactory");
|
|
14
36
|
const upgrades_core_1 = require("@openzeppelin/upgrades-core");
|
|
37
|
+
const admin_1 = require("@openzeppelin/hardhat-upgrades/dist/admin");
|
|
38
|
+
const version_1 = require("./version");
|
|
15
39
|
const verification_1 = require("./verification");
|
|
16
|
-
const
|
|
40
|
+
const withoutNull = (array) => array.
|
|
41
|
+
filter((element) => element !== null);
|
|
17
42
|
class Upgrader {
|
|
18
|
-
constructor(
|
|
19
|
-
this.targetVersion =
|
|
20
|
-
if (!
|
|
21
|
-
this.targetVersion = `${
|
|
43
|
+
constructor(project, submitter = new auto_submitter_1.AutoSubmitter()) {
|
|
44
|
+
this.targetVersion = project.version;
|
|
45
|
+
if (!project.version.includes("-")) {
|
|
46
|
+
this.targetVersion = `${project.version}-stable.0`;
|
|
22
47
|
}
|
|
23
|
-
this.instance = instance;
|
|
24
|
-
this.contractNamesToUpgrade = contractNamesToUpgrade;
|
|
25
|
-
this.projectName =
|
|
48
|
+
this.instance = project.instance;
|
|
49
|
+
this.contractNamesToUpgrade = project.contractNamesToUpgrade;
|
|
50
|
+
this.projectName = project.name;
|
|
26
51
|
this.transactions = [];
|
|
27
52
|
this.submitter = submitter;
|
|
28
53
|
}
|
|
29
54
|
// Public
|
|
30
55
|
async upgrade() {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
56
|
+
const version = await this.prepareVersion();
|
|
57
|
+
await this.callDeployNewContracts();
|
|
58
|
+
const contractsToUpgrade = await this.deployNewImplementations();
|
|
59
|
+
this.switchToNewImplementations(contractsToUpgrade, await (0, admin_1.getManifestAdmin)(hardhat_1.default));
|
|
60
|
+
await this.callInitialize();
|
|
61
|
+
// Write version
|
|
62
|
+
await this.setVersion(version);
|
|
63
|
+
await this.writeTransactions(version);
|
|
64
|
+
await this.submitter.submit(this.transactions);
|
|
65
|
+
await Upgrader.verify(contractsToUpgrade);
|
|
66
|
+
console.log("Done");
|
|
67
|
+
}
|
|
68
|
+
// Private
|
|
69
|
+
async callInitialize() {
|
|
70
|
+
if (typeof this.initialize !== "undefined") {
|
|
71
|
+
await this.initialize();
|
|
45
72
|
}
|
|
46
|
-
|
|
47
|
-
|
|
73
|
+
}
|
|
74
|
+
async callDeployNewContracts() {
|
|
75
|
+
if (typeof this.deployNewContracts !== "undefined") {
|
|
48
76
|
// Deploy new contracts
|
|
49
77
|
await this.deployNewContracts();
|
|
50
78
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"implementationAddress": newImplementationAddress,
|
|
66
|
-
"name": contract
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
console.log(chalk_1.default.gray(`Contract ${contract} is up to date`));
|
|
71
|
-
}
|
|
79
|
+
}
|
|
80
|
+
async prepareVersion() {
|
|
81
|
+
const version = await (0, version_1.getVersion)();
|
|
82
|
+
await this.checkVersion(version);
|
|
83
|
+
console.log(`Will mark updated version as ${version}`);
|
|
84
|
+
return version;
|
|
85
|
+
}
|
|
86
|
+
async writeTransactions(version) {
|
|
87
|
+
const indentation = 4;
|
|
88
|
+
await fs_1.promises.writeFile(`data/transactions-${version}-${hardhat_1.network.name}.json`, JSON.stringify(this.transactions, null, indentation));
|
|
89
|
+
}
|
|
90
|
+
static async verify(contractsToUpgrade) {
|
|
91
|
+
if (process.env.NO_VERIFY) {
|
|
92
|
+
console.log("Skip verification");
|
|
72
93
|
}
|
|
73
|
-
|
|
94
|
+
else {
|
|
95
|
+
console.log("Start verification");
|
|
96
|
+
await Promise.all(contractsToUpgrade.map((contract) => (0, verification_1.verify)(contract.name, contract.implementationAddress, [])));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
switchToNewImplementations(contractsToUpgrade, proxyAdmin) {
|
|
74
100
|
for (const contract of contractsToUpgrade) {
|
|
75
|
-
|
|
101
|
+
const infoMessage = `Prepare transaction to upgrade ${contract.name}` +
|
|
102
|
+
` at ${contract.proxyAddress}` +
|
|
103
|
+
` to ${contract.implementationAddress}`;
|
|
104
|
+
console.log(chalk_1.default.yellowBright(infoMessage));
|
|
76
105
|
this.transactions.push({
|
|
77
|
-
"to": proxyAdmin.address,
|
|
78
106
|
"data": proxyAdmin.interface.encodeFunctionData("upgrade", [
|
|
79
107
|
contract.proxyAddress,
|
|
80
108
|
contract.implementationAddress
|
|
81
|
-
])
|
|
109
|
+
]),
|
|
110
|
+
"to": proxyAdmin.address
|
|
82
111
|
});
|
|
83
112
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
113
|
+
}
|
|
114
|
+
async deployNewImplementations() {
|
|
115
|
+
const contracts = await Promise.all(this.contractNamesToUpgrade.
|
|
116
|
+
map(this.deployNewImplementation, this));
|
|
117
|
+
return withoutNull(contracts);
|
|
118
|
+
}
|
|
119
|
+
async deployNewImplementation(contract) {
|
|
120
|
+
const contractFactory = await (0, contractFactory_1.getContractFactoryAndUpdateManifest)(contract);
|
|
121
|
+
const proxyAddress = (await this.instance.getContract(contract)).address;
|
|
122
|
+
console.log(`Prepare upgrade of ${contract}`);
|
|
123
|
+
const currentImplementationAddress = await (0, upgrades_core_1.getImplementationAddress)(hardhat_1.network.provider, proxyAddress);
|
|
124
|
+
const newImplementationAddress = await hardhat_1.upgrades.prepareUpgrade(proxyAddress, contractFactory, {
|
|
125
|
+
"unsafeAllowLinkedLibraries": true,
|
|
126
|
+
"unsafeAllowRenames": true
|
|
127
|
+
});
|
|
128
|
+
if (newImplementationAddress !== currentImplementationAddress) {
|
|
129
|
+
return {
|
|
130
|
+
"implementationAddress": newImplementationAddress,
|
|
131
|
+
"name": contract,
|
|
132
|
+
proxyAddress
|
|
133
|
+
};
|
|
93
134
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
135
|
+
console.log(chalk_1.default.gray(`Contract ${contract} is up to date`));
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
async getNormalizedDeployedVersion() {
|
|
139
|
+
const deployedVersion = await this.getDeployedVersion();
|
|
140
|
+
if (deployedVersion) {
|
|
141
|
+
if (!deployedVersion.includes("-")) {
|
|
142
|
+
return `${deployedVersion}-stable.0`;
|
|
98
143
|
}
|
|
144
|
+
return deployedVersion;
|
|
99
145
|
}
|
|
100
|
-
|
|
146
|
+
return deployedVersion;
|
|
101
147
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const oldLibraries = {};
|
|
111
|
-
if (manifest.libraries === undefined) {
|
|
112
|
-
Object.assign(manifest, { "libraries": {} });
|
|
113
|
-
}
|
|
114
|
-
for (const key of Object.keys(linkReferences)) {
|
|
115
|
-
const libraryName = Object.keys(linkReferences[key])[0];
|
|
116
|
-
const { bytecode } = await hardhat_2.artifacts.readArtifact(libraryName);
|
|
117
|
-
if (manifest.libraries[libraryName] === undefined) {
|
|
118
|
-
librariesToUpgrade.push(libraryName);
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
const libraryBytecodeHash = manifest.libraries[libraryName].bytecodeHash;
|
|
122
|
-
if ((0, upgrades_core_1.hashBytecode)(bytecode) !== libraryBytecodeHash) {
|
|
123
|
-
librariesToUpgrade.push(libraryName);
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
oldLibraries[libraryName] = manifest.libraries[libraryName].address;
|
|
148
|
+
async checkVersion(version) {
|
|
149
|
+
const deployedVersion = await this.getNormalizedDeployedVersion();
|
|
150
|
+
if (deployedVersion) {
|
|
151
|
+
if (deployedVersion !== this.targetVersion) {
|
|
152
|
+
const cannotUpgradeMessage = `This script can't upgrade version ${deployedVersion}` +
|
|
153
|
+
` to ${version}`;
|
|
154
|
+
console.log(chalk_1.default.red(cannotUpgradeMessage));
|
|
155
|
+
process.exit(exitCodes_1.EXIT_CODES.BAD_VERSION);
|
|
127
156
|
}
|
|
128
157
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
manifest.libraries[libraryName] = { "address": libraryAddress,
|
|
133
|
-
"bytecodeHash": (0, upgrades_core_1.hashBytecode)(bytecode) };
|
|
158
|
+
else {
|
|
159
|
+
const cannotCheckMessage = `Can't check currently deployed version of ${this.projectName}`;
|
|
160
|
+
console.log(chalk_1.default.yellow(cannotCheckMessage));
|
|
134
161
|
}
|
|
135
|
-
Object.assign(libraries, oldLibraries);
|
|
136
|
-
await fs_1.promises.writeFile(await (0, deploy_1.getManifestFile)(), JSON.stringify(manifest, null, 4));
|
|
137
|
-
return await (0, deploy_1.getLinkedContractFactory)(contract, libraries);
|
|
138
162
|
}
|
|
139
163
|
}
|
|
140
164
|
exports.Upgrader = Upgrader;
|
|
165
|
+
//# sourceMappingURL=upgrader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrader.js","sourceRoot":"","sources":["../../src/upgrader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAA+C;AAC/C,gEAA0D;AAC1D,2CAAuC;AAKvC,kDAA0B;AAC1B,2BAAkC;AAClC,uDAAsE;AACtE,+DAAqE;AACrE,qEAA2E;AAC3E,uCAAqC;AACrC,iDAAsC;AAgBtC,MAAM,WAAW,GAAG,CAAI,KAAsB,EAAE,EAAE,CAAC,KAAK;IACpD,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,IAAI,CAAa,CAAC;AAGtD,MAAsB,QAAQ;IAa1B,YACI,OAAgB,EAChB,YAAuB,IAAI,8BAAa,EAAE;QAE1C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAChC,IAAI,CAAC,aAAa,GAA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AK,CAAC,IAAI,CAAC,YAAY,QAAQ,gBAAgB,CAAC,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC;IAChB,CAAC;IAEO,KAAK,CAAC,4BAA4B;QACtC,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxD,IAAI,eAAe,EAAE;YACjB,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBAChC,OAAO,GAAG,eAAe,WAAW,CAAC;aACxC;YACD,OAAO,eAAe,CAAC;SAC1B;QACD,OAAO,eAAe,CAAC;IAC3B,CAAC;IAEO,KAAK,CAAC,YAAY,CAAE,OAAe;QACvC,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,4BAA4B,EAAE,CAAC;QAClE,IAAI,eAAe,EAAE;YACjB,IAAI,eAAe,KAAK,IAAI,CAAC,aAAa,EAAE;gBACxC,MAAM,oBAAoB,GACtB,qCAAqC,eAAe,EAAE;oBACtD,OAAO,OAAO,EAAE,CAAC;gBACrB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC;gBAC7C,OAAO,CAAC,IAAI,CAAC,sBAAU,CAAC,WAAW,CAAC,CAAC;aACxC;SACJ;aAAM;YACH,MAAM,kBAAkB,GACpB,6CAA6C,IAAI,CAAC,WAAW,EAAE,CAAC;YACpE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC;SACjD;IACL,CAAC;CACJ;AA5MD,4BA4MC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
export declare
|
|
1
|
+
export declare const verify: (contractName: string, contractAddress: string, constructorArguments: object) => Promise<void>;
|
|
2
|
+
export declare const verifyProxy: (contractName: string, proxyAddress: string, constructorArguments: object) => Promise<void>;
|
package/dist/src/verification.js
CHANGED
|
@@ -8,35 +8,60 @@ const hardhat_1 = require("hardhat");
|
|
|
8
8
|
const chain_config_1 = require("@nomicfoundation/hardhat-verify/internal/chain-config");
|
|
9
9
|
const chalk_1 = __importDefault(require("chalk"));
|
|
10
10
|
const upgrades_core_1 = require("@openzeppelin/upgrades-core");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
catch (e) {
|
|
23
|
-
if (e instanceof Error) {
|
|
24
|
-
if (e.toString().includes("Contract source code already verified")) {
|
|
25
|
-
console.log(chalk_1.default.grey(`${contractName} is already verified`));
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
console.log(chalk_1.default.red(`Contract ${contractName} was not verified on etherscan`));
|
|
29
|
-
console.log(e.toString());
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
console.log("Unknown exception type:", e);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
11
|
+
const RETRIES_AMOUNT = 5;
|
|
12
|
+
const processError = (error, contractName) => {
|
|
13
|
+
if (error instanceof Error) {
|
|
14
|
+
const alreadyVerifiedErrorLine = "Contract source code already verified";
|
|
15
|
+
if (error.toString().includes(alreadyVerifiedErrorLine)) {
|
|
16
|
+
const infoMessage = `${contractName} is already verified`;
|
|
17
|
+
console.log(chalk_1.default.grey(infoMessage));
|
|
18
|
+
return;
|
|
35
19
|
}
|
|
20
|
+
const errorMessage = `Contract ${contractName} was not verified on etherscan`;
|
|
21
|
+
console.log(chalk_1.default.red(errorMessage));
|
|
22
|
+
console.log(error.toString());
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
console.log("Unknown exception type:", error);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const verificationAttempt = async (contractName, contractAddress, constructorArguments) => {
|
|
29
|
+
try {
|
|
30
|
+
await (0, hardhat_1.run)("verify:verify", {
|
|
31
|
+
"address": contractAddress,
|
|
32
|
+
constructorArguments
|
|
33
|
+
});
|
|
34
|
+
return true;
|
|
36
35
|
}
|
|
37
|
-
|
|
36
|
+
catch (error) {
|
|
37
|
+
processError(error, contractName);
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
};
|
|
41
|
+
const verifyWithRetry = async (verificationTarget, attempts) => {
|
|
42
|
+
if (attempts) {
|
|
43
|
+
if (!await verificationAttempt(verificationTarget.contractName, verificationTarget.contractAddress, verificationTarget.constructorArguments)) {
|
|
44
|
+
const failedAttempts = 1;
|
|
45
|
+
await verifyWithRetry(verificationTarget, attempts - failedAttempts);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const verify = async (contractName, contractAddress, constructorArguments) => {
|
|
50
|
+
const { chainId } = await hardhat_1.ethers.provider.getNetwork();
|
|
51
|
+
if (!chain_config_1.builtinChains.map((chain) => chain.chainId).includes(chainId)) {
|
|
52
|
+
const errorMessage = "Verification on this network is not supported";
|
|
53
|
+
console.log(chalk_1.default.grey(errorMessage));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
await verifyWithRetry({
|
|
57
|
+
constructorArguments,
|
|
58
|
+
contractAddress,
|
|
59
|
+
contractName
|
|
60
|
+
}, RETRIES_AMOUNT);
|
|
61
|
+
};
|
|
38
62
|
exports.verify = verify;
|
|
39
|
-
async
|
|
40
|
-
await verify(contractName, await (0, upgrades_core_1.getImplementationAddress)(hardhat_1.network.provider, proxyAddress), constructorArguments);
|
|
41
|
-
}
|
|
63
|
+
const verifyProxy = async (contractName, proxyAddress, constructorArguments) => {
|
|
64
|
+
await (0, exports.verify)(contractName, await (0, upgrades_core_1.getImplementationAddress)(hardhat_1.network.provider, proxyAddress), constructorArguments);
|
|
65
|
+
};
|
|
42
66
|
exports.verifyProxy = verifyProxy;
|
|
67
|
+
//# sourceMappingURL=verification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verification.js","sourceRoot":"","s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C,MAAM,mBAAmB,CAC1B,kBAAkB,CAAC,YAAY,EAC/B,kBAAkB,CAAC,eAAe,EAClC,kBAAkB,CAAC,oBAAoB,CAC1C,EAAE;YACC,MAAM,cAAc,GAAG,CAAC,CAAC;YACzB,MAAM,eAAe,CACjB,kBAAkB,EAClB,QAAQ,GAAG,cAAc,CAC5B,CAAC;SACL;KACJ;AACL,CAAC,CAAC;AAEK,MAAM,MAAM,GAAG,KAAK,EACvB,YAAoB,EACpB,eAAuB,EACvB,oBAA4B,EAC9B,EAAE;IACA,MAAM,EAAC,OAAO,EAAC,GAAG,MAAM,gBAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IACrD,IAAI,CAAC,4BAAa,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QAChE,MAAM,YAAY,GAAG,+CAA+C,CAAC;QACrE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QACtC,OAAO;KACV;IACD,MAAM,eAAe,CACjB;QACI,oBAAoB;QACpB,eAAe;QACf,YAAY;KACf,EACD,cAAc,CACjB,CAAC;AACN,CAAC,CAAC;AAnBW,QAAA,MAAM,UAmBjB;AAEK,MAAM,WAAW,GAAG,KAAK,EAC5B,YAAoB,EACpB,YAAoB,EACpB,oBAA4B,EAC9B,EAAE;IACA,MAAM,IAAA,cAAM,EACR,YAAY,EACZ,MAAM,IAAA,wCAAwB,EAC1B,iBAAO,CAAC,QAAQ,EAChB,YAAY,CACf,EACD,oBAAoB,CACvB,CAAC;AACN,CAAC,CAAC;AAbW,QAAA,WAAW,eAatB"}
|
package/dist/src/version.js
CHANGED
|
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getVersion = void 0;
|
|
7
|
-
const child_process_1 = require("child_process");
|
|
8
7
|
const fs_1 = require("fs");
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
9
|
const util_1 = __importDefault(require("util"));
|
|
10
10
|
const exec = util_1.default.promisify(child_process_1.exec);
|
|
11
11
|
class VersionNotFound extends Error {
|
|
12
12
|
}
|
|
13
|
-
async
|
|
14
|
-
if (folder === undefined) {
|
|
13
|
+
const getVersionFilename = async (folder) => {
|
|
14
|
+
if (typeof folder === "undefined") {
|
|
15
15
|
return getVersionFilename((await exec("git rev-parse --show-toplevel")).stdout.trim());
|
|
16
16
|
}
|
|
17
17
|
const VERSION_FILENAME = "VERSION";
|
|
@@ -19,14 +19,16 @@ async function getVersionFilename(folder) {
|
|
|
19
19
|
if ((0, fs_1.existsSync)(path)) {
|
|
20
20
|
return path;
|
|
21
21
|
}
|
|
22
|
-
for (const entry of await fs_1.promises.readdir(folder, {
|
|
23
|
-
"recursive": true
|
|
22
|
+
for (const entry of await fs_1.promises.readdir(folder, {
|
|
23
|
+
"recursive": true,
|
|
24
|
+
"withFileTypes": true
|
|
25
|
+
})) {
|
|
24
26
|
if (entry.isFile() && entry.name === VERSION_FILENAME) {
|
|
25
27
|
return `${entry.path}/${entry.name}`;
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
throw new VersionNotFound("Can't find version file");
|
|
29
|
-
}
|
|
31
|
+
};
|
|
30
32
|
const getVersion = async () => {
|
|
31
33
|
if (process.env.VERSION) {
|
|
32
34
|
return process.env.VERSION;
|
|
@@ -40,3 +42,4 @@ const getVersion = async () => {
|
|
|
40
42
|
}
|
|
41
43
|
};
|
|
42
44
|
exports.getVersion = getVersion;
|
|
45
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;;;;AAAA,2BAA8C;AAC9C,iDAAgD;AAChD,gDAAwB;AAGxB,MAAM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E,EAC1B,OAAO,CACV,CAAC,CAAC,IAAI,EAAE,CAAC;KACb;AACL,CAAC,CAAC;AAbW,QAAA,UAAU,cAarB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdminUpgradeabilityProxy.js","sourceRoot":"","sources":["../../typechain-types/AdminUpgradeabilityProxy.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProxyAdmin.js","sourceRoot":"","sources":["../../typechain-types/ProxyAdmin.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../typechain-types/common.ts"],"names":[],"mappings":""}
|
|
@@ -115,3 +115,4 @@ class AdminUpgradeabilityProxy__factory extends ethers_1.ContractFactory {
|
|
|
115
115
|
exports.AdminUpgradeabilityProxy__factory = AdminUpgradeabilityProxy__factory;
|
|
116
116
|
AdminUpgradeabilityProxy__factory.bytecode = _bytecode;
|
|
117
117
|
AdminUpgradeabilityProxy__factory.abi = _abi;
|
|
118
|
+
//# sourceMappingURL=AdminUpgradeabilityProxy__factory.js.map
|