Ver Fonte

Merge pull request #3010 from pyth-network/move-deploy-receiver

chore: moved batch deploy receiver to contract_manager
Nidhi Singh há 2 meses atrás
pai
commit
b7ed7fbb6f
1 ficheiros alterados com 15 adições e 7 exclusões
  1. 15 7
      contract_manager/scripts/batchDeployReceivers.ts

+ 15 - 7
target_chains/ethereum/contracts/scripts/batchDeployReceivers.ts → contract_manager/scripts/batchDeployReceivers.ts

@@ -15,7 +15,7 @@ import Web3 from "web3";
 import { CHAINS } from "@pythnetwork/xc-admin-common";
 import * as fs from "fs";
 
-const { getDefaultConfig } = require("./contractManagerConfig");
+import { getDefaultConfig } from "../../target_chains/ethereum/contracts/scripts/contractManagerConfig";
 
 const parser = yargs(hideBin(process.argv))
   .usage(
@@ -45,8 +45,13 @@ const parser = yargs(hideBin(process.argv))
     },
   });
 
-async function memoize(key: string, fn: () => Promise<any>) {
-  const path = `./cache/${key}.json`;
+async function memoize(
+  key: string,
+  fn: () => Promise<string>,
+): Promise<string> {
+  const cacheDir = "../../target_chains/ethereum/contracts/cache";
+  const path = `${cacheDir}/${key}.json`;
+
   if (fs.existsSync(path)) {
     return JSON.parse(fs.readFileSync(path).toString());
   }
@@ -59,11 +64,14 @@ async function main() {
   const argv = await parser.argv;
   const privateKey = argv["private-key"];
   const network = argv["network"];
-  const setupInfo = require(argv["contract"] + "/ReceiverSetup.json");
-  const implementationInfo = require(
-    argv["contract"] + "/ReceiverImplementation.json",
+
+  const setupInfo = await import(argv["contract"] + "/ReceiverSetup.json");
+  const implementationInfo = await import(
+    argv["contract"] + "/ReceiverImplementation.json"
+  );
+  const receiverInfo = await import(
+    argv["contract"] + "/WormholeReceiver.json"
   );
-  const receiverInfo = require(argv["contract"] + "/WormholeReceiver.json");
 
   const payloads: Buffer[] = [];
   for (const chain of Object.values(DefaultStore.chains)) {