@skalenetwork/upgrade-tools 1.0.0-develop.7 → 1.0.0-develop.8
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/upgrade.d.ts +2 -1
- package/dist/src/upgrade.js +21 -1
- package/package.json +1 -1
package/dist/src/upgrade.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ import { Contract } from "ethers";
|
|
|
3
3
|
import { OwnableUpgradeable } from "../typechain-types";
|
|
4
4
|
export declare function getContractFactoryAndUpdateManifest(contract: string): Promise<import("ethers").ContractFactory>;
|
|
5
5
|
declare type DeploymentAction<ContractManagerType extends Contract> = (safeTransactions: string[], abi: SkaleABIFile, contractManager: ContractManagerType) => Promise<void>;
|
|
6
|
-
|
|
6
|
+
declare type MultiTransactionAction<ContractManagerType extends Contract> = (abi: SkaleABIFile, contractManager: ContractManagerType) => Promise<string[][]>;
|
|
7
|
+
export declare function upgrade<ContractManagerType extends OwnableUpgradeable>(projectName: string, targetVersion: string, getDeployedVersion: (abi: SkaleABIFile) => Promise<string | undefined>, setVersion: (safeTransaction: string[], abi: SkaleABIFile, newVersion: string) => Promise<void>, safeMockAccessRequirements: string[], contractNamesToUpgrade: string[], deployNewContracts: DeploymentAction<ContractManagerType>, initialize: DeploymentAction<ContractManagerType>, afterUpgrade?: MultiTransactionAction<ContractManagerType>): Promise<void>;
|
|
7
8
|
export {};
|
package/dist/src/upgrade.js
CHANGED
|
@@ -62,7 +62,7 @@ function getContractFactoryAndUpdateManifest(contract) {
|
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
exports.getContractFactoryAndUpdateManifest = getContractFactoryAndUpdateManifest;
|
|
65
|
-
function upgrade(projectName, targetVersion, getDeployedVersion, setVersion, safeMockAccessRequirements, contractNamesToUpgrade, deployNewContracts, initialize) {
|
|
65
|
+
function upgrade(projectName, targetVersion, getDeployedVersion, setVersion, safeMockAccessRequirements, contractNamesToUpgrade, deployNewContracts, initialize, afterUpgrade) {
|
|
66
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
67
67
|
if (!process.env.ABI) {
|
|
68
68
|
console.log(chalk_1.default.red("Set path to file with ABI and addresses to ABI environment variables"));
|
|
@@ -172,9 +172,19 @@ function upgrade(projectName, targetVersion, getDeployedVersion, setVersion, saf
|
|
|
172
172
|
privateKey = hardhat_1.ethers.Wallet.createRandom().privateKey;
|
|
173
173
|
}
|
|
174
174
|
const safeTx = yield (0, gnosis_safe_1.createMultiSendTransaction)(hardhat_1.ethers, safe, privateKey, safeTransactions, safeMock !== undefined);
|
|
175
|
+
let transactionsBatches;
|
|
176
|
+
if (afterUpgrade !== undefined) {
|
|
177
|
+
transactionsBatches = yield afterUpgrade(abi, contractManager);
|
|
178
|
+
}
|
|
175
179
|
if (!safeMock) {
|
|
176
180
|
const chainId = (yield hardhat_1.ethers.provider.getNetwork()).chainId;
|
|
177
181
|
yield (0, gnosis_safe_1.sendSafeTransaction)(safe, chainId, safeTx);
|
|
182
|
+
if (transactionsBatches !== undefined) {
|
|
183
|
+
for (const batch of transactionsBatches) {
|
|
184
|
+
const multiSendTransaction = yield (0, gnosis_safe_1.createMultiSendTransaction)(hardhat_1.ethers, safe, privateKey, batch, safeMock !== undefined);
|
|
185
|
+
yield (0, gnosis_safe_1.sendSafeTransaction)(safe, chainId, multiSendTransaction);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
178
188
|
}
|
|
179
189
|
else {
|
|
180
190
|
console.log(chalk_1.default.blue("Send upgrade transactions to safe mock"));
|
|
@@ -184,6 +194,16 @@ function upgrade(projectName, targetVersion, getDeployedVersion, setVersion, saf
|
|
|
184
194
|
value: safeTx.value,
|
|
185
195
|
data: safeTx.data,
|
|
186
196
|
})).wait();
|
|
197
|
+
if (transactionsBatches !== undefined) {
|
|
198
|
+
for (const batch of transactionsBatches) {
|
|
199
|
+
const multiSendTransaction = yield (0, gnosis_safe_1.createMultiSendTransaction)(hardhat_1.ethers, safe, privateKey, batch, safeMock !== undefined);
|
|
200
|
+
yield (yield deployer.sendTransaction({
|
|
201
|
+
to: safeMock.address,
|
|
202
|
+
value: multiSendTransaction.value,
|
|
203
|
+
data: multiSendTransaction.data,
|
|
204
|
+
})).wait();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
187
207
|
console.log(chalk_1.default.blue("Transactions have been sent"));
|
|
188
208
|
}
|
|
189
209
|
finally {
|