@skalenetwork/upgrade-tools 3.0.0-linter.26 → 3.0.0-linter.27
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/contractFactory.js +1 -1
- package/dist/src/deploy.d.ts +0 -1
- package/dist/src/deploy.js +2 -31
- package/package.json +1 -1
|
@@ -78,6 +78,6 @@ const getContractFactoryAndUpdateManifest = async (contract) => {
|
|
|
78
78
|
const { librariesToUpgrade, oldLibraries } = await getLibrariesToUpgrade(manifest, linkReferences);
|
|
79
79
|
const libraries = await (0, deploy_1.deployLibraries)(librariesToUpgrade);
|
|
80
80
|
await updateManifest(manifest, libraries, oldLibraries);
|
|
81
|
-
return await
|
|
81
|
+
return await hardhat_1.ethers.getContractFactory(contract, { "libraries": Object.fromEntries(libraries) });
|
|
82
82
|
};
|
|
83
83
|
exports.getContractFactoryAndUpdateManifest = getContractFactoryAndUpdateManifest;
|
package/dist/src/deploy.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export declare const deployLibraries: (libraryNames: string[]) => Promise<Map<string, string>>;
|
|
2
|
-
export declare const getLinkedContractFactory: (contractName: string, libraries: Map<string, string>) => Promise<import("ethers").ContractFactory>;
|
|
3
2
|
export declare const getManifestFile: () => Promise<string>;
|
|
4
3
|
export declare const getContractFactory: (contract: string) => Promise<import("ethers").ContractFactory>;
|
package/dist/src/deploy.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getContractFactory = exports.getManifestFile = exports.
|
|
3
|
+
exports.getContractFactory = exports.getManifestFile = exports.deployLibraries = void 0;
|
|
4
4
|
const upgrades_core_1 = require("@openzeppelin/upgrades-core");
|
|
5
5
|
const hardhat_1 = require("hardhat");
|
|
6
|
-
const utils_1 = require("ethers/lib/utils");
|
|
7
6
|
const fs_1 = require("fs");
|
|
8
7
|
const contractFactory_1 = require("./contractFactory");
|
|
9
8
|
const deployLibrary = async (libraryName, nonce) => {
|
|
@@ -25,34 +24,6 @@ const deployLibraries = async (libraryNames) => {
|
|
|
25
24
|
return libraries;
|
|
26
25
|
};
|
|
27
26
|
exports.deployLibraries = deployLibraries;
|
|
28
|
-
const firstByteIndex = 0;
|
|
29
|
-
const linkBytecode = (artifact, libraries) => {
|
|
30
|
-
let { bytecode } = artifact;
|
|
31
|
-
for (const [, fileReferences] of Object.entries(artifact.linkReferences)) {
|
|
32
|
-
for (const [libName, fixups] of Object.entries(fileReferences)) {
|
|
33
|
-
const libAddress = libraries.get(libName);
|
|
34
|
-
if (typeof libAddress !== "undefined") {
|
|
35
|
-
for (const fixup of fixups) {
|
|
36
|
-
const bytecodeBefore = (0, utils_1.hexDataSlice)(bytecode, firstByteIndex, fixup.start);
|
|
37
|
-
const bytecodeAfter = (0, utils_1.hexDataSlice)(bytecode, fixup.start + fixup.length);
|
|
38
|
-
bytecode = (0, utils_1.hexConcat)([
|
|
39
|
-
bytecodeBefore,
|
|
40
|
-
libAddress,
|
|
41
|
-
bytecodeAfter
|
|
42
|
-
]);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return bytecode;
|
|
48
|
-
};
|
|
49
|
-
const getLinkedContractFactory = async (contractName, libraries) => {
|
|
50
|
-
const cArtifact = await hardhat_1.artifacts.readArtifact(contractName);
|
|
51
|
-
const linkedBytecode = linkBytecode(cArtifact, libraries);
|
|
52
|
-
const ContractFactory = await hardhat_1.ethers.getContractFactory(cArtifact.abi, linkedBytecode);
|
|
53
|
-
return ContractFactory;
|
|
54
|
-
};
|
|
55
|
-
exports.getLinkedContractFactory = getLinkedContractFactory;
|
|
56
27
|
const getManifestFile = async function getManifestFile() {
|
|
57
28
|
return (await upgrades_core_1.Manifest.forNetwork(hardhat_1.ethers.provider)).file;
|
|
58
29
|
};
|
|
@@ -96,6 +67,6 @@ const getContractFactory = async (contract) => {
|
|
|
96
67
|
const libraries = await (0, exports.deployLibraries)(libraryNames);
|
|
97
68
|
const libraryArtifacts = await getLibraryArtifacts(libraries);
|
|
98
69
|
await updateManifest(libraryArtifacts);
|
|
99
|
-
return await
|
|
70
|
+
return await hardhat_1.ethers.getContractFactory(contract, { "libraries": Object.fromEntries(libraries) });
|
|
100
71
|
};
|
|
101
72
|
exports.getContractFactory = getContractFactory;
|