gate-evm-tools 1.0.26 → 1.0.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/README.md +14 -0
- package/bin/workflow.cjs +19 -0
- package/dist/core/BytecodeChecker.d.ts.map +1 -1
- package/dist/core/BytecodeChecker.js +16 -1
- package/dist/core/BytecodeChecker.js.map +1 -1
- package/dist/core/legacyProxyArtifact.d.ts +6 -0
- package/dist/core/legacyProxyArtifact.d.ts.map +1 -0
- package/dist/core/legacyProxyArtifact.js +36 -0
- package/dist/core/legacyProxyArtifact.js.map +1 -0
- package/dist-runtime/config/hardhatAdapters.d.ts +5 -0
- package/dist-runtime/config/hardhatAdapters.js +53 -0
- package/dist-runtime/config/hardhatAdapters.js.map +1 -0
- package/dist-runtime/config/networks.d.ts +8 -0
- package/dist-runtime/config/networks.js +269 -0
- package/dist-runtime/config/networks.js.map +1 -0
- package/dist-runtime/config/openzeppelin.d.ts +28 -0
- package/dist-runtime/config/openzeppelin.js +144 -0
- package/dist-runtime/config/openzeppelin.js.map +1 -0
- package/dist-runtime/config/rpc.d.ts +7 -0
- package/dist-runtime/config/rpc.js +19 -0
- package/dist-runtime/config/rpc.js.map +1 -0
- package/dist-runtime/config/zksyncSolcPath.d.ts +1 -0
- package/dist-runtime/config/zksyncSolcPath.js +61 -0
- package/dist-runtime/config/zksyncSolcPath.js.map +1 -0
- package/dist-runtime/migrate.d.ts +13 -0
- package/dist-runtime/migrate.js +208 -0
- package/dist-runtime/migrate.js.map +1 -0
- package/dist-runtime/package.json +1 -0
- package/dist-runtime/projectHardhat.d.ts +4 -0
- package/dist-runtime/projectHardhat.js +16 -0
- package/dist-runtime/projectHardhat.js.map +1 -0
- package/dist-runtime/runtime-identity.json +4 -0
- package/dist-runtime/template-migration.json +293 -0
- package/dist-runtime/workflow/checkCode.d.ts +1 -0
- package/dist-runtime/workflow/checkCode.js +16 -0
- package/dist-runtime/workflow/checkCode.js.map +1 -0
- package/dist-runtime/workflow/checkCodeFinalize.d.ts +1 -0
- package/dist-runtime/workflow/checkCodeFinalize.js +11 -0
- package/dist-runtime/workflow/checkCodeFinalize.js.map +1 -0
- package/dist-runtime/workflow/checkCodePlan.d.ts +1 -0
- package/dist-runtime/workflow/checkCodePlan.js +11 -0
- package/dist-runtime/workflow/checkCodePlan.js.map +1 -0
- package/dist-runtime/workflow/cli.d.ts +1 -0
- package/dist-runtime/workflow/cli.js +302 -0
- package/dist-runtime/workflow/cli.js.map +1 -0
- package/dist-runtime/workflow/commitContractInfo.d.ts +1 -0
- package/dist-runtime/workflow/commitContractInfo.js +64 -0
- package/dist-runtime/workflow/commitContractInfo.js.map +1 -0
- package/dist-runtime/workflow/create2Hashes.d.ts +1 -0
- package/dist-runtime/workflow/create2Hashes.js +76 -0
- package/dist-runtime/workflow/create2Hashes.js.map +1 -0
- package/dist-runtime/workflow/forkSourceProxy.d.ts +1 -0
- package/dist-runtime/workflow/forkSourceProxy.js +151 -0
- package/dist-runtime/workflow/forkSourceProxy.js.map +1 -0
- package/dist-runtime/workflow/importState.d.ts +1 -0
- package/dist-runtime/workflow/importState.js +193 -0
- package/dist-runtime/workflow/importState.js.map +1 -0
- package/dist-runtime/workflow/lib/authority.d.ts +28 -0
- package/dist-runtime/workflow/lib/authority.js +122 -0
- package/dist-runtime/workflow/lib/authority.js.map +1 -0
- package/dist-runtime/workflow/lib/calldata.d.ts +2 -0
- package/dist-runtime/workflow/lib/calldata.js +8 -0
- package/dist-runtime/workflow/lib/calldata.js.map +1 -0
- package/dist-runtime/workflow/lib/calls.d.ts +23 -0
- package/dist-runtime/workflow/lib/calls.js +316 -0
- package/dist-runtime/workflow/lib/calls.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCode/args.d.ts +2 -0
- package/dist-runtime/workflow/lib/checkCode/args.js +68 -0
- package/dist-runtime/workflow/lib/checkCode/args.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCode/command.d.ts +5 -0
- package/dist-runtime/workflow/lib/checkCode/command.js +35 -0
- package/dist-runtime/workflow/lib/checkCode/command.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCode/dependencies.d.ts +6 -0
- package/dist-runtime/workflow/lib/checkCode/dependencies.js +125 -0
- package/dist-runtime/workflow/lib/checkCode/dependencies.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCode/finalize.d.ts +17 -0
- package/dist-runtime/workflow/lib/checkCode/finalize.js +174 -0
- package/dist-runtime/workflow/lib/checkCode/finalize.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCode/index.d.ts +3 -0
- package/dist-runtime/workflow/lib/checkCode/index.js +20 -0
- package/dist-runtime/workflow/lib/checkCode/index.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCode/plan.d.ts +22 -0
- package/dist-runtime/workflow/lib/checkCode/plan.js +145 -0
- package/dist-runtime/workflow/lib/checkCode/plan.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCodeReport.d.ts +25 -0
- package/dist-runtime/workflow/lib/checkCodeReport.js +102 -0
- package/dist-runtime/workflow/lib/checkCodeReport.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCodeRunner.d.ts +87 -0
- package/dist-runtime/workflow/lib/checkCodeRunner.js +964 -0
- package/dist-runtime/workflow/lib/checkCodeRunner.js.map +1 -0
- package/dist-runtime/workflow/lib/cliTool.d.ts +10 -0
- package/dist-runtime/workflow/lib/cliTool.js +25 -0
- package/dist-runtime/workflow/lib/cliTool.js.map +1 -0
- package/dist-runtime/workflow/lib/config.d.ts +33 -0
- package/dist-runtime/workflow/lib/config.js +100 -0
- package/dist-runtime/workflow/lib/config.js.map +1 -0
- package/dist-runtime/workflow/lib/contractInfoCandidates.d.ts +82 -0
- package/dist-runtime/workflow/lib/contractInfoCandidates.js +441 -0
- package/dist-runtime/workflow/lib/contractInfoCandidates.js.map +1 -0
- package/dist-runtime/workflow/lib/create2.d.ts +49 -0
- package/dist-runtime/workflow/lib/create2.js +194 -0
- package/dist-runtime/workflow/lib/create2.js.map +1 -0
- package/dist-runtime/workflow/lib/create2Hashes.d.ts +22 -0
- package/dist-runtime/workflow/lib/create2Hashes.js +57 -0
- package/dist-runtime/workflow/lib/create2Hashes.js.map +1 -0
- package/dist-runtime/workflow/lib/deploymentInfo.d.ts +40 -0
- package/dist-runtime/workflow/lib/deploymentInfo.js +240 -0
- package/dist-runtime/workflow/lib/deploymentInfo.js.map +1 -0
- package/dist-runtime/workflow/lib/deploymentRecords.d.ts +137 -0
- package/dist-runtime/workflow/lib/deploymentRecords.js +374 -0
- package/dist-runtime/workflow/lib/deploymentRecords.js.map +1 -0
- package/dist-runtime/workflow/lib/deployments.d.ts +21 -0
- package/dist-runtime/workflow/lib/deployments.js +240 -0
- package/dist-runtime/workflow/lib/deployments.js.map +1 -0
- package/dist-runtime/workflow/lib/erc1967.d.ts +5 -0
- package/dist-runtime/workflow/lib/erc1967.js +29 -0
- package/dist-runtime/workflow/lib/erc1967.js.map +1 -0
- package/dist-runtime/workflow/lib/errors.d.ts +6 -0
- package/dist-runtime/workflow/lib/errors.js +77 -0
- package/dist-runtime/workflow/lib/errors.js.map +1 -0
- package/dist-runtime/workflow/lib/executionId.d.ts +7 -0
- package/dist-runtime/workflow/lib/executionId.js +26 -0
- package/dist-runtime/workflow/lib/executionId.js.map +1 -0
- package/dist-runtime/workflow/lib/executionPlan.d.ts +85 -0
- package/dist-runtime/workflow/lib/executionPlan.js +450 -0
- package/dist-runtime/workflow/lib/executionPlan.js.map +1 -0
- package/dist-runtime/workflow/lib/executionProgress.d.ts +5 -0
- package/dist-runtime/workflow/lib/executionProgress.js +100 -0
- package/dist-runtime/workflow/lib/executionProgress.js.map +1 -0
- package/dist-runtime/workflow/lib/external.d.ts +62 -0
- package/dist-runtime/workflow/lib/external.js +282 -0
- package/dist-runtime/workflow/lib/external.js.map +1 -0
- package/dist-runtime/workflow/lib/externalExecutionScanner.d.ts +64 -0
- package/dist-runtime/workflow/lib/externalExecutionScanner.js +638 -0
- package/dist-runtime/workflow/lib/externalExecutionScanner.js.map +1 -0
- package/dist-runtime/workflow/lib/forkSnapshot.d.ts +34 -0
- package/dist-runtime/workflow/lib/forkSnapshot.js +167 -0
- package/dist-runtime/workflow/lib/forkSnapshot.js.map +1 -0
- package/dist-runtime/workflow/lib/gateTool.d.ts +16 -0
- package/dist-runtime/workflow/lib/gateTool.js +177 -0
- package/dist-runtime/workflow/lib/gateTool.js.map +1 -0
- package/dist-runtime/workflow/lib/gateToolSync.d.ts +22 -0
- package/dist-runtime/workflow/lib/gateToolSync.js +253 -0
- package/dist-runtime/workflow/lib/gateToolSync.js.map +1 -0
- package/dist-runtime/workflow/lib/lock.d.ts +52 -0
- package/dist-runtime/workflow/lib/lock.js +269 -0
- package/dist-runtime/workflow/lib/lock.js.map +1 -0
- package/dist-runtime/workflow/lib/migrationState.d.ts +103 -0
- package/dist-runtime/workflow/lib/migrationState.js +920 -0
- package/dist-runtime/workflow/lib/migrationState.js.map +1 -0
- package/dist-runtime/workflow/lib/operatorExecution.d.ts +28 -0
- package/dist-runtime/workflow/lib/operatorExecution.js +134 -0
- package/dist-runtime/workflow/lib/operatorExecution.js.map +1 -0
- package/dist-runtime/workflow/lib/parameters.d.ts +58 -0
- package/dist-runtime/workflow/lib/parameters.js +322 -0
- package/dist-runtime/workflow/lib/parameters.js.map +1 -0
- package/dist-runtime/workflow/lib/pendingDeploymentReuse.d.ts +29 -0
- package/dist-runtime/workflow/lib/pendingDeploymentReuse.js +277 -0
- package/dist-runtime/workflow/lib/pendingDeploymentReuse.js.map +1 -0
- package/dist-runtime/workflow/lib/proxy.d.ts +18 -0
- package/dist-runtime/workflow/lib/proxy.js +19 -0
- package/dist-runtime/workflow/lib/proxy.js.map +1 -0
- package/dist-runtime/workflow/lib/registryCommit.d.ts +33 -0
- package/dist-runtime/workflow/lib/registryCommit.js +319 -0
- package/dist-runtime/workflow/lib/registryCommit.js.map +1 -0
- package/dist-runtime/workflow/lib/release.d.ts +57 -0
- package/dist-runtime/workflow/lib/release.js +256 -0
- package/dist-runtime/workflow/lib/release.js.map +1 -0
- package/dist-runtime/workflow/lib/releaseFinalize.d.ts +14 -0
- package/dist-runtime/workflow/lib/releaseFinalize.js +571 -0
- package/dist-runtime/workflow/lib/releaseFinalize.js.map +1 -0
- package/dist-runtime/workflow/lib/releaseParameters.d.ts +43 -0
- package/dist-runtime/workflow/lib/releaseParameters.js +184 -0
- package/dist-runtime/workflow/lib/releaseParameters.js.map +1 -0
- package/dist-runtime/workflow/lib/reporter.d.ts +39 -0
- package/dist-runtime/workflow/lib/reporter.js +452 -0
- package/dist-runtime/workflow/lib/reporter.js.map +1 -0
- package/dist-runtime/workflow/lib/resultPaths.d.ts +17 -0
- package/dist-runtime/workflow/lib/resultPaths.js +29 -0
- package/dist-runtime/workflow/lib/resultPaths.js.map +1 -0
- package/dist-runtime/workflow/lib/runtimeVersion.d.ts +10 -0
- package/dist-runtime/workflow/lib/runtimeVersion.js +46 -0
- package/dist-runtime/workflow/lib/runtimeVersion.js.map +1 -0
- package/dist-runtime/workflow/lib/signer.d.ts +10 -0
- package/dist-runtime/workflow/lib/signer.js +105 -0
- package/dist-runtime/workflow/lib/signer.js.map +1 -0
- package/dist-runtime/workflow/lib/signerIdentity.d.ts +1 -0
- package/dist-runtime/workflow/lib/signerIdentity.js +23 -0
- package/dist-runtime/workflow/lib/signerIdentity.js.map +1 -0
- package/dist-runtime/workflow/lib/simulation.d.ts +35 -0
- package/dist-runtime/workflow/lib/simulation.js +282 -0
- package/dist-runtime/workflow/lib/simulation.js.map +1 -0
- package/dist-runtime/workflow/lib/simulationCallers.d.ts +44 -0
- package/dist-runtime/workflow/lib/simulationCallers.js +260 -0
- package/dist-runtime/workflow/lib/simulationCallers.js.map +1 -0
- package/dist-runtime/workflow/lib/sourceRpcPolicy.d.ts +1 -0
- package/dist-runtime/workflow/lib/sourceRpcPolicy.js +43 -0
- package/dist-runtime/workflow/lib/sourceRpcPolicy.js.map +1 -0
- package/dist-runtime/workflow/lib/state.d.ts +6 -0
- package/dist-runtime/workflow/lib/state.js +25 -0
- package/dist-runtime/workflow/lib/state.js.map +1 -0
- package/dist-runtime/workflow/lib/staticValidation.d.ts +22 -0
- package/dist-runtime/workflow/lib/staticValidation.js +124 -0
- package/dist-runtime/workflow/lib/staticValidation.js.map +1 -0
- package/dist-runtime/workflow/lib/zksyncForkCapability.d.ts +27 -0
- package/dist-runtime/workflow/lib/zksyncForkCapability.js +52 -0
- package/dist-runtime/workflow/lib/zksyncForkCapability.js.map +1 -0
- package/dist-runtime/workflow/lib/zksyncForkRunner.d.ts +57 -0
- package/dist-runtime/workflow/lib/zksyncForkRunner.js +344 -0
- package/dist-runtime/workflow/lib/zksyncForkRunner.js.map +1 -0
- package/dist-runtime/workflow/reconcileExternal.d.ts +1 -0
- package/dist-runtime/workflow/reconcileExternal.js +87 -0
- package/dist-runtime/workflow/reconcileExternal.js.map +1 -0
- package/dist-runtime/workflow/reconcileExternalRun.d.ts +1 -0
- package/dist-runtime/workflow/reconcileExternalRun.js +77 -0
- package/dist-runtime/workflow/reconcileExternalRun.js.map +1 -0
- package/dist-runtime/workflow/releaseFinalize.d.ts +1 -0
- package/dist-runtime/workflow/releaseFinalize.js +11 -0
- package/dist-runtime/workflow/releaseFinalize.js.map +1 -0
- package/dist-runtime/workflow/run.d.ts +40 -0
- package/dist-runtime/workflow/run.js +858 -0
- package/dist-runtime/workflow/run.js.map +1 -0
- package/dist-runtime/workflow/staticValidate.d.ts +1 -0
- package/dist-runtime/workflow/staticValidate.js +26 -0
- package/dist-runtime/workflow/staticValidate.js.map +1 -0
- package/dist-runtime/workflow/steps/call.d.ts +3 -0
- package/dist-runtime/workflow/steps/call.js +9 -0
- package/dist-runtime/workflow/steps/call.js.map +1 -0
- package/dist-runtime/workflow/steps/check.d.ts +3 -0
- package/dist-runtime/workflow/steps/check.js +9 -0
- package/dist-runtime/workflow/steps/check.js.map +1 -0
- package/dist-runtime/workflow/steps/custom.d.ts +3 -0
- package/dist-runtime/workflow/steps/custom.js +33 -0
- package/dist-runtime/workflow/steps/custom.js.map +1 -0
- package/dist-runtime/workflow/steps/deploy.d.ts +3 -0
- package/dist-runtime/workflow/steps/deploy.js +595 -0
- package/dist-runtime/workflow/steps/deploy.js.map +1 -0
- package/dist-runtime/workflow/steps/upgrade.d.ts +3 -0
- package/dist-runtime/workflow/steps/upgrade.js +465 -0
- package/dist-runtime/workflow/steps/upgrade.js.map +1 -0
- package/dist-runtime/workflow/steps/view.d.ts +3 -0
- package/dist-runtime/workflow/steps/view.js +9 -0
- package/dist-runtime/workflow/steps/view.js.map +1 -0
- package/package.json +25 -5
- package/runtime/config/hardhatAdapters.ts +50 -0
- package/runtime/config/networks.ts +296 -0
- package/runtime/config/openzeppelin.ts +173 -0
- package/runtime/config/rpc.ts +27 -0
- package/runtime/config/zksyncSolcPath.ts +59 -0
- package/runtime/hardhat-types.d.ts +2 -0
- package/runtime/migrate.ts +154 -0
- package/runtime/projectHardhat.ts +10 -0
- package/runtime/template-migration.json +293 -0
- package/runtime/workflow/checkCode.ts +13 -0
- package/runtime/workflow/checkCodeFinalize.ts +8 -0
- package/runtime/workflow/checkCodePlan.ts +8 -0
- package/runtime/workflow/cli.ts +356 -0
- package/runtime/workflow/commitContractInfo.ts +63 -0
- package/runtime/workflow/create2Hashes.ts +79 -0
- package/runtime/workflow/forkSourceProxy.ts +193 -0
- package/runtime/workflow/importState.ts +190 -0
- package/runtime/workflow/lib/authority.ts +170 -0
- package/runtime/workflow/lib/calldata.ts +9 -0
- package/runtime/workflow/lib/calls.ts +407 -0
- package/runtime/workflow/lib/checkCode/args.ts +76 -0
- package/runtime/workflow/lib/checkCode/command.ts +36 -0
- package/runtime/workflow/lib/checkCode/dependencies.ts +112 -0
- package/runtime/workflow/lib/checkCode/finalize.ts +198 -0
- package/runtime/workflow/lib/checkCode/index.ts +18 -0
- package/runtime/workflow/lib/checkCode/plan.ts +163 -0
- package/runtime/workflow/lib/checkCodeReport.ts +133 -0
- package/runtime/workflow/lib/checkCodeRunner.ts +1225 -0
- package/runtime/workflow/lib/cliTool.ts +31 -0
- package/runtime/workflow/lib/config.ts +130 -0
- package/runtime/workflow/lib/contractInfoCandidates.ts +690 -0
- package/runtime/workflow/lib/create2.ts +278 -0
- package/runtime/workflow/lib/create2Hashes.ts +83 -0
- package/runtime/workflow/lib/deploymentInfo.ts +286 -0
- package/runtime/workflow/lib/deploymentRecords.ts +576 -0
- package/runtime/workflow/lib/deployments.ts +276 -0
- package/runtime/workflow/lib/erc1967.ts +57 -0
- package/runtime/workflow/lib/errors.ts +95 -0
- package/runtime/workflow/lib/executionId.ts +35 -0
- package/runtime/workflow/lib/executionPlan.ts +550 -0
- package/runtime/workflow/lib/executionProgress.ts +127 -0
- package/runtime/workflow/lib/external.ts +372 -0
- package/runtime/workflow/lib/externalExecutionScanner.ts +892 -0
- package/runtime/workflow/lib/forkSnapshot.ts +231 -0
- package/runtime/workflow/lib/gateTool.ts +261 -0
- package/runtime/workflow/lib/gateToolSync.ts +398 -0
- package/runtime/workflow/lib/lock.ts +388 -0
- package/runtime/workflow/lib/migrationState.ts +1246 -0
- package/runtime/workflow/lib/operatorExecution.ts +174 -0
- package/runtime/workflow/lib/parameters.ts +437 -0
- package/runtime/workflow/lib/pendingDeploymentReuse.ts +428 -0
- package/runtime/workflow/lib/proxy.ts +45 -0
- package/runtime/workflow/lib/registryCommit.ts +455 -0
- package/runtime/workflow/lib/release.ts +329 -0
- package/runtime/workflow/lib/releaseFinalize.ts +711 -0
- package/runtime/workflow/lib/releaseParameters.ts +248 -0
- package/runtime/workflow/lib/reporter.ts +502 -0
- package/runtime/workflow/lib/resultPaths.ts +49 -0
- package/runtime/workflow/lib/runtimeVersion.ts +28 -0
- package/runtime/workflow/lib/signer.ts +124 -0
- package/runtime/workflow/lib/signerIdentity.ts +22 -0
- package/runtime/workflow/lib/simulation.ts +415 -0
- package/runtime/workflow/lib/simulationCallers.ts +335 -0
- package/runtime/workflow/lib/sourceRpcPolicy.ts +41 -0
- package/runtime/workflow/lib/state.ts +25 -0
- package/runtime/workflow/lib/staticValidation.ts +142 -0
- package/runtime/workflow/lib/zksyncForkCapability.ts +80 -0
- package/runtime/workflow/lib/zksyncForkRunner.ts +505 -0
- package/runtime/workflow/reconcileExternal.ts +86 -0
- package/runtime/workflow/reconcileExternalRun.ts +88 -0
- package/runtime/workflow/releaseFinalize.ts +8 -0
- package/runtime/workflow/run.ts +1072 -0
- package/runtime/workflow/staticValidate.ts +23 -0
- package/runtime/workflow/steps/call.ts +10 -0
- package/runtime/workflow/steps/check.ts +10 -0
- package/runtime/workflow/steps/custom.ts +43 -0
- package/runtime/workflow/steps/deploy.ts +771 -0
- package/runtime/workflow/steps/upgrade.ts +598 -0
- package/runtime/workflow/steps/view.ts +10 -0
|
@@ -0,0 +1,193 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const child_process_1 = require("child_process");
|
|
40
|
+
const fs_1 = __importDefault(require("fs"));
|
|
41
|
+
const path_1 = __importDefault(require("path"));
|
|
42
|
+
const ethers_1 = require("ethers");
|
|
43
|
+
const config_1 = require("./lib/config");
|
|
44
|
+
const migrationState_1 = require("./lib/migrationState");
|
|
45
|
+
const erc1967_1 = require("./lib/erc1967");
|
|
46
|
+
const parseArgs = (argv) => {
|
|
47
|
+
const parsed = {};
|
|
48
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
49
|
+
const item = argv[index];
|
|
50
|
+
if (!item.startsWith("--"))
|
|
51
|
+
throw new Error(`Unsupported argument: ${item}`);
|
|
52
|
+
const equalIndex = item.indexOf("=");
|
|
53
|
+
const key = item.slice(2, equalIndex > 2 ? equalIndex : undefined);
|
|
54
|
+
const inlineValue = equalIndex > 2 ? item.slice(equalIndex + 1) : undefined;
|
|
55
|
+
const next = argv[index + 1];
|
|
56
|
+
const value = inlineValue ?? (next && !next.startsWith("--") ? next : "true");
|
|
57
|
+
if (inlineValue === undefined && next && !next.startsWith("--"))
|
|
58
|
+
index += 1;
|
|
59
|
+
(parsed[key] ||= []).push(value);
|
|
60
|
+
}
|
|
61
|
+
return parsed;
|
|
62
|
+
};
|
|
63
|
+
const singleArg = (args, key, options = {}) => {
|
|
64
|
+
const values = args[key] || [];
|
|
65
|
+
if (values.length > 1)
|
|
66
|
+
throw new Error(`--${key} may be provided only once`);
|
|
67
|
+
const value = values[0]?.trim();
|
|
68
|
+
if (options.required && (!value || value === "true")) {
|
|
69
|
+
throw new Error(`--${key} is required`);
|
|
70
|
+
}
|
|
71
|
+
return value && value !== "true" ? value : undefined;
|
|
72
|
+
};
|
|
73
|
+
const confinedPlanPath = (root, requested) => {
|
|
74
|
+
return (0, migrationState_1.resolveConfinedMigrationPath)(root, requested, {
|
|
75
|
+
label: "Migration plan",
|
|
76
|
+
requireFile: true,
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
const commandName = (command) => (process.platform === "win32" ? `${command}.cmd` : command);
|
|
80
|
+
const main = async () => {
|
|
81
|
+
const args = parseArgs(process.argv.slice(2));
|
|
82
|
+
const root = path_1.default.resolve(singleArg(args, "root") || process.cwd());
|
|
83
|
+
const planPath = confinedPlanPath(root, singleArg(args, "plan", { required: true }));
|
|
84
|
+
const plan = (0, migrationState_1.validateMigrationStatePlan)((0, config_1.readJsonFile)(planPath));
|
|
85
|
+
const confirmations = Object.keys(plan.networks).sort().map((network) => ({
|
|
86
|
+
network,
|
|
87
|
+
token: (0, migrationState_1.migrationConfirmationToken)(plan, network),
|
|
88
|
+
}));
|
|
89
|
+
if (args["print-confirmations"]?.length) {
|
|
90
|
+
console.log(JSON.stringify({ migrationId: plan.migrationId, confirmations }, null, 2));
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
process.env.GATE_MIGRATION_READ_ONLY = "1";
|
|
94
|
+
const { artifacts, config: hardhatConfig, ethers: hardhatEthers, network: hardhatNetwork, run: hardhatRun, } = await Promise.resolve().then(() => __importStar(require("../projectHardhat")));
|
|
95
|
+
const workflowConfig = (0, config_1.loadConfig)(root);
|
|
96
|
+
const rpcProviders = new Map();
|
|
97
|
+
const providerFor = (networkName) => {
|
|
98
|
+
if (networkName === hardhatNetwork.name)
|
|
99
|
+
return hardhatEthers.provider;
|
|
100
|
+
const existing = rpcProviders.get(networkName);
|
|
101
|
+
if (existing)
|
|
102
|
+
return existing;
|
|
103
|
+
const networkConfig = hardhatConfig.networks[networkName];
|
|
104
|
+
if (!networkConfig || !("url" in networkConfig) || typeof networkConfig.url !== "string") {
|
|
105
|
+
throw new Error(`Hardhat network ${networkName} does not define an HTTP RPC URL`);
|
|
106
|
+
}
|
|
107
|
+
const provider = new ethers_1.JsonRpcProvider(networkConfig.url);
|
|
108
|
+
rpcProviders.set(networkName, provider);
|
|
109
|
+
return provider;
|
|
110
|
+
};
|
|
111
|
+
const inspect = async (networkName, contract) => {
|
|
112
|
+
const provider = providerFor(networkName);
|
|
113
|
+
const chainId = Number((await provider.getNetwork()).chainId);
|
|
114
|
+
const implementationAddress = await (0, erc1967_1.getERC1967Implementation)(provider, contract.address);
|
|
115
|
+
const adminAddress = implementationAddress
|
|
116
|
+
? await (0, erc1967_1.getERC1967Admin)(provider, contract.address)
|
|
117
|
+
: undefined;
|
|
118
|
+
const proxyKind = implementationAddress
|
|
119
|
+
? (adminAddress ? "transparent" : "uups")
|
|
120
|
+
: "none";
|
|
121
|
+
const contractCode = await provider.getCode(contract.address);
|
|
122
|
+
const implementationCode = implementationAddress
|
|
123
|
+
? await provider.getCode(implementationAddress)
|
|
124
|
+
: undefined;
|
|
125
|
+
let artifactExists = true;
|
|
126
|
+
try {
|
|
127
|
+
await artifacts.readArtifact(contract.actualContract);
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
artifactExists = false;
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
chainId,
|
|
134
|
+
hasCode: contractCode !== "0x"
|
|
135
|
+
&& (implementationCode === undefined || implementationCode !== "0x"),
|
|
136
|
+
artifactExists,
|
|
137
|
+
proxyKind,
|
|
138
|
+
...(implementationAddress ? { implementationAddress } : {}),
|
|
139
|
+
address: contract.address,
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
await hardhatRun("compile", { quiet: true });
|
|
143
|
+
try {
|
|
144
|
+
const evidence = await (0, migrationState_1.importMigrationState)({
|
|
145
|
+
root,
|
|
146
|
+
plan,
|
|
147
|
+
targets: workflowConfig,
|
|
148
|
+
confirmations: args.confirm || [],
|
|
149
|
+
inspect,
|
|
150
|
+
verifyCandidate: async (contractInfo) => {
|
|
151
|
+
const checkRoot = fs_1.default.mkdtempSync(path_1.default.join(root, ".gate-migration-check-"));
|
|
152
|
+
const candidatePath = path_1.default.join(checkRoot, "contractInfo.json");
|
|
153
|
+
const reportPath = path_1.default.join(checkRoot, "bytecode-check.json");
|
|
154
|
+
try {
|
|
155
|
+
(0, config_1.writeJsonFile)(candidatePath, contractInfo);
|
|
156
|
+
const result = (0, child_process_1.spawnSync)(commandName("npx"), [
|
|
157
|
+
"--no-install",
|
|
158
|
+
"gate-tool",
|
|
159
|
+
"check",
|
|
160
|
+
"--config",
|
|
161
|
+
candidatePath,
|
|
162
|
+
"--output",
|
|
163
|
+
reportPath,
|
|
164
|
+
], {
|
|
165
|
+
cwd: root,
|
|
166
|
+
env: process.env,
|
|
167
|
+
stdio: "inherit",
|
|
168
|
+
});
|
|
169
|
+
return (0, migrationState_1.resolveGateToolCandidateCheck)(result, reportPath);
|
|
170
|
+
}
|
|
171
|
+
finally {
|
|
172
|
+
fs_1.default.rmSync(checkRoot, { recursive: true, force: true });
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
console.log(JSON.stringify({
|
|
177
|
+
status: evidence.status,
|
|
178
|
+
migrationId: evidence.migrationId,
|
|
179
|
+
planHash: evidence.planHash,
|
|
180
|
+
evidencePath: `scripts/migrations/${evidence.migrationId}/state-import.json`,
|
|
181
|
+
}));
|
|
182
|
+
}
|
|
183
|
+
finally {
|
|
184
|
+
for (const provider of rpcProviders.values())
|
|
185
|
+
provider.destroy();
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
void main().catch((error) => {
|
|
189
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
190
|
+
console.error("Use --print-confirmations with the same --plan before importing state.");
|
|
191
|
+
process.exitCode = 1;
|
|
192
|
+
});
|
|
193
|
+
//# sourceMappingURL=importState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importState.js","sourceRoot":"","sources":["../../runtime/workflow/importState.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAC1C,4CAAoB;AACpB,gDAAwB;AACxB,mCAAmD;AACnD,yCAAuE;AACvE,yDAO8B;AAC9B,2CAGuB;AAIvB,MAAM,SAAS,GAAG,CAAC,IAAc,EAAc,EAAE;IAC/C,MAAM,MAAM,GAAe,EAAE,CAAC;IAC9B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;QAC7E,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACnE,MAAM,WAAW,GAAG,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC5E,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAC7B,MAAM,KAA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C;QACT,KAAK,MAAM,QAAQ,IAAI,YAAY,CAAC,MAAM,EAAE;YAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;IACnE,CAAC;AACH,CAAC,CAAC;AAEF,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC1B,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,OAAO,CAAC,KAAK,CAAC,wEAAwE,CAAC,CAAC;IACxF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { BaseContract } from "ethers";
|
|
2
|
+
import { TargetConfig } from "./config";
|
|
3
|
+
export interface AuthorityDecision {
|
|
4
|
+
mode: "execute" | "calldata";
|
|
5
|
+
signer: string;
|
|
6
|
+
configuredAdmin: string;
|
|
7
|
+
chainAdmin?: string;
|
|
8
|
+
executor?: string;
|
|
9
|
+
reason: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const assertSelectedSimulationSignerAuthorized: (decision: AuthorityDecision, stepId: string) => void;
|
|
12
|
+
interface ControlledMulticallAuthorityContract {
|
|
13
|
+
callers: (caller: string, overrides?: {
|
|
14
|
+
blockTag: number;
|
|
15
|
+
}) => Promise<boolean>;
|
|
16
|
+
factoryCallers: (factory: string, caller: string, overrides?: {
|
|
17
|
+
blockTag: number;
|
|
18
|
+
}) => Promise<boolean>;
|
|
19
|
+
owner?: (overrides?: {
|
|
20
|
+
blockTag: number;
|
|
21
|
+
}) => Promise<unknown>;
|
|
22
|
+
admin?: (overrides?: {
|
|
23
|
+
blockTag: number;
|
|
24
|
+
}) => Promise<unknown>;
|
|
25
|
+
}
|
|
26
|
+
export declare const decideControlledMulticallAuthority: (contract: ControlledMulticallAuthorityContract, factory: string, target: TargetConfig, signerAddress: string, blockTag?: number) => Promise<AuthorityDecision>;
|
|
27
|
+
export declare const decideAuthority: (contract: BaseContract, target: TargetConfig, signerAddress: string, blockTag?: number) => Promise<AuthorityDecision>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decideAuthority = exports.decideControlledMulticallAuthority = exports.assertSelectedSimulationSignerAuthorized = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const config_1 = require("./config");
|
|
6
|
+
const assertSelectedSimulationSignerAuthorized = (decision, stepId) => {
|
|
7
|
+
if (decision.mode === "execute")
|
|
8
|
+
return;
|
|
9
|
+
const requiredExecutor = decision.executor || decision.configuredAdmin;
|
|
10
|
+
throw new Error(`selected simulation signer is not authorized for step ${stepId}; required executor ${requiredExecutor}`);
|
|
11
|
+
};
|
|
12
|
+
exports.assertSelectedSimulationSignerAuthorized = assertSelectedSimulationSignerAuthorized;
|
|
13
|
+
const readChainAdmin = async (contract, blockTag) => {
|
|
14
|
+
const callable = contract;
|
|
15
|
+
for (const methodName of ["owner", "admin"]) {
|
|
16
|
+
const method = callable[methodName];
|
|
17
|
+
if (typeof method !== "function")
|
|
18
|
+
continue;
|
|
19
|
+
try {
|
|
20
|
+
const value = await method(...(blockTag === undefined ? [] : [{ blockTag }]));
|
|
21
|
+
if (typeof value === "string" && (0, ethers_1.isAddress)(value)) {
|
|
22
|
+
return (0, ethers_1.getAddress)(value);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// Some proxy admin methods intentionally revert for non-admin callers.
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return undefined;
|
|
30
|
+
};
|
|
31
|
+
const decideControlledMulticallAuthority = async (contract, factory, target, signerAddress, blockTag) => {
|
|
32
|
+
const normalizedSignerAddress = (0, ethers_1.getAddress)(signerAddress);
|
|
33
|
+
const normalizedFactory = (0, ethers_1.getAddress)(factory);
|
|
34
|
+
let callerAllowed;
|
|
35
|
+
let factoryAllowed;
|
|
36
|
+
try {
|
|
37
|
+
[callerAllowed, factoryAllowed] = await Promise.all([
|
|
38
|
+
blockTag === undefined
|
|
39
|
+
? contract.callers(normalizedSignerAddress)
|
|
40
|
+
: contract.callers(normalizedSignerAddress, { blockTag }),
|
|
41
|
+
blockTag === undefined
|
|
42
|
+
? contract.factoryCallers(normalizedFactory, normalizedSignerAddress)
|
|
43
|
+
: contract.factoryCallers(normalizedFactory, normalizedSignerAddress, { blockTag }),
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
throw new Error("Cannot determine controlled multicall authority: "
|
|
48
|
+
+ (error instanceof Error ? error.message : String(error)));
|
|
49
|
+
}
|
|
50
|
+
const configuredAdmin = (0, config_1.resolveAdmin)(target, normalizedSignerAddress);
|
|
51
|
+
const chainAdmin = await readChainAdmin(contract, blockTag);
|
|
52
|
+
if (callerAllowed && factoryAllowed) {
|
|
53
|
+
return {
|
|
54
|
+
mode: "execute",
|
|
55
|
+
signer: normalizedSignerAddress,
|
|
56
|
+
configuredAdmin,
|
|
57
|
+
chainAdmin,
|
|
58
|
+
reason: "operator has controlled multicall caller and factory authority",
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const explicitConfiguredAdmin = typeof target.admin === "string" && (0, ethers_1.isAddress)(target.admin)
|
|
62
|
+
? (0, ethers_1.getAddress)(target.admin)
|
|
63
|
+
: undefined;
|
|
64
|
+
const executor = chainAdmin || explicitConfiguredAdmin;
|
|
65
|
+
if (!executor || executor.toLowerCase() === normalizedSignerAddress.toLowerCase()) {
|
|
66
|
+
throw new Error("Controlled multicall permissions are missing and cannot resolve an external executor");
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
mode: "calldata",
|
|
70
|
+
signer: normalizedSignerAddress,
|
|
71
|
+
configuredAdmin,
|
|
72
|
+
chainAdmin,
|
|
73
|
+
executor,
|
|
74
|
+
reason: [
|
|
75
|
+
"controlled multicall authority requires external execution",
|
|
76
|
+
callerAllowed ? undefined : "caller permission missing",
|
|
77
|
+
factoryAllowed ? undefined : "factory caller permission missing",
|
|
78
|
+
].filter(Boolean).join("; "),
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
exports.decideControlledMulticallAuthority = decideControlledMulticallAuthority;
|
|
82
|
+
const decideAuthority = async (contract, target, signerAddress, blockTag) => {
|
|
83
|
+
const normalizedSignerAddress = (0, ethers_1.getAddress)(signerAddress);
|
|
84
|
+
const configuredAdmin = (0, config_1.resolveAdmin)(target, normalizedSignerAddress);
|
|
85
|
+
const chainAdmin = await readChainAdmin(contract, blockTag);
|
|
86
|
+
if (chainAdmin) {
|
|
87
|
+
if (chainAdmin.toLowerCase() === normalizedSignerAddress.toLowerCase()) {
|
|
88
|
+
return {
|
|
89
|
+
mode: "execute",
|
|
90
|
+
signer: normalizedSignerAddress,
|
|
91
|
+
configuredAdmin,
|
|
92
|
+
chainAdmin,
|
|
93
|
+
reason: "signer is chain admin",
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
mode: "calldata",
|
|
98
|
+
signer: normalizedSignerAddress,
|
|
99
|
+
configuredAdmin,
|
|
100
|
+
chainAdmin,
|
|
101
|
+
executor: chainAdmin,
|
|
102
|
+
reason: "signer is not chain admin",
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
if (configuredAdmin.toLowerCase() !== normalizedSignerAddress.toLowerCase()) {
|
|
106
|
+
return {
|
|
107
|
+
mode: "calldata",
|
|
108
|
+
signer: normalizedSignerAddress,
|
|
109
|
+
configuredAdmin,
|
|
110
|
+
executor: configuredAdmin,
|
|
111
|
+
reason: "configured admin differs from signer",
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
mode: "execute",
|
|
116
|
+
signer: normalizedSignerAddress,
|
|
117
|
+
configuredAdmin,
|
|
118
|
+
reason: "no chain admin check available",
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
exports.decideAuthority = decideAuthority;
|
|
122
|
+
//# sourceMappingURL=authority.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authority.js","sourceRoot":"","sources":["../../../runtime/workflow/lib/authority.ts"],"names":[],"mappings":";;;AACA,mCAA+C;AAC/C,qCAAsD;AAW/C,MAAM,wCAAwC,GAAG,CACtD,QAA2B,EAC3B,MAAc,EACR,EAAE;IACR,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO;IACxC,MAAM,gBAAgB,GAAG,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,eAAe,CAAC;IACvE,MAAM,IAAI,KAAK,CACb,yDAAyD,MAAM,uBAAuB,gBAAgB,EAAE,CACzG,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,wCAAwC,4CASnD;AAEF,MAAM,cAAc,GAAG,KAAK,EAC1B,QAAsB,EACtB,QAAiB,EACY,EAAE;IAC/B,MAAM,QAAQ,GAAG,QAA8C,CAAC;IAEhE,KAAK,MAAM,UAAU,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;QAC5C,MAAM,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;QACpC,IAAI,OAAO,MAAM,KAAK,UAAU;YAAE,SAAS;QAE3C,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,MAAO,MAAmD,CACtE,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAClD,CAAC;YACF,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAA,kBAAS,EAAC,KAAK,CAAC,EAAE,CAAC;gBAClD,OAAO,IAAA,mBAAU,EAAC,KAAK,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;Y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AQ,EAAE,QAAQ,CAAC,CAAC;IAE5D,IAAI,UAAU,EAAE,CAAC;QACf,IAAI,UAAU,CAAC,WAAW,EAAE,KAAK,uBAAuB,CAAC,WAAW,EAAE,EAAE,CAAC;YACvE,OAAO;gBACL,IAAI,EAAE,SAAS;gBACf,MAAM,EAAE,uBAAuB;gBAC/B,eAAe;gBACf,UAAU;gBACV,MAAM,EAAE,uBAAuB;aAChC,CAAC;QACJ,CAAC;QAED,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,uBAAuB;YAC/B,eAAe;YACf,UAAU;YACV,QAAQ,EAAE,UAAU;YACpB,MAAM,EAAE,2BAA2B;SACpC,CAAC;IACJ,CAAC;IAED,IAAI,eAAe,CAAC,WAAW,EAAE,KAAK,uBAAuB,CAAC,WAAW,EAAE,EAAE,CAAC;QAC5E,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,uBAAuB;YAC/B,eAAe;YACf,QAAQ,EAAE,eAAe;YACzB,MAAM,EAAE,sCAAsC;SAC/C,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,uBAAuB;QAC/B,eAAe;QACf,MAAM,EAAE,gCAAgC;KACzC,CAAC;AACJ,CAAC,CAAC;AA/CW,QAAA,eAAe,mBA+C1B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.encodeCall = void 0;
|
|
4
|
+
const encodeCall = (contractInterface, method, args) => {
|
|
5
|
+
return contractInterface.encodeFunctionData(method, args);
|
|
6
|
+
};
|
|
7
|
+
exports.encodeCall = encodeCall;
|
|
8
|
+
//# sourceMappingURL=calldata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calldata.js","sourceRoot":"","sources":["../../../runtime/workflow/lib/calldata.ts"],"names":[],"mappings":";;;AAEO,MAAM,UAAU,GAAG,CACxB,iBAA4B,EAC5B,MAAc,EACd,IAAe,EACP,EAAE;IACV,OAAO,iBAAiB,CAAC,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC5D,CAAC,CAAC;AANW,QAAA,UAAU,cAMrB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { BaseContract } from "ethers";
|
|
2
|
+
import { WorkflowStep } from "./parameters";
|
|
3
|
+
import type { WorkflowContext } from "../run";
|
|
4
|
+
export interface ContractCall {
|
|
5
|
+
method: string;
|
|
6
|
+
args?: unknown[];
|
|
7
|
+
value?: string | number;
|
|
8
|
+
expect?: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface ResolvedContract {
|
|
11
|
+
contractName: string;
|
|
12
|
+
abiName: string;
|
|
13
|
+
address: string;
|
|
14
|
+
contract: BaseContract;
|
|
15
|
+
}
|
|
16
|
+
export declare const resolveContract: (context: WorkflowContext, step: WorkflowStep) => Promise<ResolvedContract>;
|
|
17
|
+
export declare const resolveStepCalls: (step: WorkflowStep) => ContractCall[];
|
|
18
|
+
export declare const resolveCallArgs: (context: WorkflowContext, call: ContractCall) => unknown[];
|
|
19
|
+
export declare const stringifyCallResult: (value: unknown) => string;
|
|
20
|
+
export declare const normalizeCallValue: (value: unknown) => string;
|
|
21
|
+
export declare const runContractWriteCalls: (context: WorkflowContext, step: WorkflowStep) => Promise<void>;
|
|
22
|
+
export declare const runContractViewCalls: (context: WorkflowContext, step: WorkflowStep) => Promise<void>;
|
|
23
|
+
export declare const runContractCheckCalls: (context: WorkflowContext, step: WorkflowStep) => Promise<void>;
|