@skalenetwork/upgrade-tools 3.0.0-linter.6 → 3.0.0-linter.7
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/deploy.js
CHANGED
|
@@ -64,17 +64,14 @@ const getContractFactory = async (contract) => {
|
|
|
64
64
|
"bytecodeHash": (0, upgrades_core_1.hashBytecode)(bytecode)
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
Object.assign(libraryArtifacts, manifest.libraries);
|
|
67
|
+
const manifest = JSON.parse(await fs_1.promises.readFile(await (0, exports.getManifestFile)(), "utf-8"));
|
|
68
|
+
if (manifest.libraries === undefined) {
|
|
69
|
+
Object.assign(manifest, { "libraries": libraryArtifacts });
|
|
71
70
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
Object.assign(manifest, { "libraries": libraryArtifacts });
|
|
75
|
-
}
|
|
76
|
-
await fs_1.promises.writeFile(await (0, exports.getManifestFile)(), JSON.stringify(manifest, null, 4));
|
|
71
|
+
else {
|
|
72
|
+
Object.assign(libraryArtifacts, manifest.libraries);
|
|
77
73
|
}
|
|
74
|
+
await fs_1.promises.writeFile(await (0, exports.getManifestFile)(), JSON.stringify(manifest, null, 4));
|
|
78
75
|
return await (0, exports.getLinkedContractFactory)(contract, libraries);
|
|
79
76
|
};
|
|
80
77
|
exports.getContractFactory = getContractFactory;
|
package/dist/src/multiSend.js
CHANGED
|
@@ -9,7 +9,7 @@ const encodeTransaction = (operation, to, value, data) => {
|
|
|
9
9
|
// / value as a uint256 (=> 32 bytes),
|
|
10
10
|
// / data length as a uint256 (=> 32 bytes),
|
|
11
11
|
// / data as bytes.
|
|
12
|
-
let _operation;
|
|
12
|
+
let _operation = "";
|
|
13
13
|
if (operation === 0) {
|
|
14
14
|
_operation = "00";
|
|
15
15
|
}
|
|
@@ -3,6 +3,7 @@ import { Submitter } from "./submitter";
|
|
|
3
3
|
export declare class AutoSubmitter extends Submitter {
|
|
4
4
|
name: string;
|
|
5
5
|
submit(transactions: Transaction[]): Promise<void>;
|
|
6
|
+
private static getSubmitter;
|
|
6
7
|
private static _getImaInstance;
|
|
7
8
|
private static _getSafeAddress;
|
|
8
9
|
private static _getSchainHash;
|
|
@@ -43,56 +43,54 @@ class AutoSubmitter extends submitter_1.Submitter {
|
|
|
43
43
|
}
|
|
44
44
|
async submit(transactions) {
|
|
45
45
|
console.log(`Submit via ${this.name}`);
|
|
46
|
-
|
|
46
|
+
const submitter = await AutoSubmitter.getSubmitter();
|
|
47
|
+
await submitter.submit(transactions);
|
|
48
|
+
}
|
|
49
|
+
// Private
|
|
50
|
+
static async getSubmitter() {
|
|
47
51
|
// TODO: remove unknown when move everything to ethers 6
|
|
48
52
|
const proxyAdmin = await (0, admin_1.getManifestAdmin)(hardhat_1.default);
|
|
49
53
|
const owner = await proxyAdmin.owner();
|
|
50
54
|
if (await hardhat_1.default.ethers.provider.getCode(owner) === "0x") {
|
|
51
55
|
console.log("Owner is not a contract");
|
|
52
|
-
|
|
56
|
+
return new eoa_submitter_1.EoaSubmitter();
|
|
53
57
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
submitter = new safe_ima_legacy_marionette_submitter_1.SafeImaLegacyMarionetteSubmitter(safeAddress, imaInstance, schainHash, mainnetChainId);
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
// Assuming owner is a Gnosis Safe
|
|
89
|
-
console.log("Using Gnosis Safe");
|
|
90
|
-
submitter = new safe_submitter_1.SafeSubmitter(owner);
|
|
91
|
-
}
|
|
58
|
+
console.log("Owner is a contract");
|
|
59
|
+
if (hardhat_1.ethers.utils.getAddress(owner) === hardhat_1.ethers.utils.getAddress(marionette_1.MARIONETTE_ADDRESS)) {
|
|
60
|
+
console.log("Marionette owner is detected");
|
|
61
|
+
const imaInstance = await AutoSubmitter._getImaInstance();
|
|
62
|
+
const mainnetChainId = AutoSubmitter._getMainnetChainId();
|
|
63
|
+
const safeAddress = AutoSubmitter._getSafeAddress();
|
|
64
|
+
const schainHash = AutoSubmitter._getSchainHash();
|
|
65
|
+
/*
|
|
66
|
+
* TODO: after marionette has multiSend functionality
|
|
67
|
+
* query version and properly select a submitter
|
|
68
|
+
* based on it
|
|
69
|
+
*
|
|
70
|
+
* if (await this._versionFunctionExists()) {
|
|
71
|
+
* console.log("version() function was found. Use normal Marionette")
|
|
72
|
+
* submitter = new SafeImaMarionetteSubmitter(
|
|
73
|
+
* safeAddress,
|
|
74
|
+
* imaAbi,
|
|
75
|
+
* schainHash,
|
|
76
|
+
* mainnetChainId
|
|
77
|
+
* )
|
|
78
|
+
* } else {
|
|
79
|
+
* console.log("No version() function was found. Use legacy Marionette")
|
|
80
|
+
* submitter = new SafeImaLegacyMarionetteSubmitter(
|
|
81
|
+
* safeAddress,
|
|
82
|
+
* imaAbi,
|
|
83
|
+
* schainHash,
|
|
84
|
+
* mainnetChainId
|
|
85
|
+
* )
|
|
86
|
+
* }
|
|
87
|
+
*/
|
|
88
|
+
return new safe_ima_legacy_marionette_submitter_1.SafeImaLegacyMarionetteSubmitter(safeAddress, imaInstance, schainHash, mainnetChainId);
|
|
92
89
|
}
|
|
93
|
-
|
|
90
|
+
// Assuming owner is a Gnosis Safe
|
|
91
|
+
console.log("Using Gnosis Safe");
|
|
92
|
+
return new safe_submitter_1.SafeSubmitter(owner);
|
|
94
93
|
}
|
|
95
|
-
// Private
|
|
96
94
|
static async _getImaInstance() {
|
|
97
95
|
if (!process.env.IMA) {
|
|
98
96
|
console.log(chalk_1.default.red("Set target IMA alias to IMA environment variable"));
|
package/dist/src/upgrader.js
CHANGED
|
@@ -109,7 +109,7 @@ class Upgrader {
|
|
|
109
109
|
const librariesToUpgrade = [];
|
|
110
110
|
const oldLibraries = {};
|
|
111
111
|
if (manifest.libraries === undefined) {
|
|
112
|
-
|
|
112
|
+
manifest.libraries = {};
|
|
113
113
|
}
|
|
114
114
|
for (const key of Object.keys(linkReferences)) {
|
|
115
115
|
const libraryName = Object.keys(linkReferences[key])[0];
|