@@ -15,7 +15,7 @@ import Web3 from "web3";
1515import { CHAINS } from "@pythnetwork/xc-admin-common" ;
1616import * as fs from "fs" ;
1717
18- const { getDefaultConfig } = require ( "./ contractManagerConfig") ;
18+ import { getDefaultConfig } from "../../target_chains/ethereum/contracts/scripts/ contractManagerConfig";
1919
2020const parser = yargs ( hideBin ( process . argv ) )
2121 . usage (
@@ -45,8 +45,13 @@ const parser = yargs(hideBin(process.argv))
4545 } ,
4646 } ) ;
4747
48- async function memoize ( key : string , fn : ( ) => Promise < any > ) {
49- const path = `./cache/${ key } .json` ;
48+ async function memoize (
49+ key : string ,
50+ fn : ( ) => Promise < string > ,
51+ ) : Promise < string > {
52+ const cacheDir = "../../target_chains/ethereum/contracts/cache" ;
53+ const path = `${ cacheDir } /${ key } .json` ;
54+
5055 if ( fs . existsSync ( path ) ) {
5156 return JSON . parse ( fs . readFileSync ( path ) . toString ( ) ) ;
5257 }
@@ -59,11 +64,14 @@ async function main() {
5964 const argv = await parser . argv ;
6065 const privateKey = argv [ "private-key" ] ;
6166 const network = argv [ "network" ] ;
62- const setupInfo = require ( argv [ "contract" ] + "/ReceiverSetup.json" ) ;
63- const implementationInfo = require (
64- argv [ "contract" ] + "/ReceiverImplementation.json" ,
67+
68+ const setupInfo = await import ( argv [ "contract" ] + "/ReceiverSetup.json" ) ;
69+ const implementationInfo = await import (
70+ argv [ "contract" ] + "/ReceiverImplementation.json"
71+ ) ;
72+ const receiverInfo = await import (
73+ argv [ "contract" ] + "/WormholeReceiver.json"
6574 ) ;
66- const receiverInfo = require ( argv [ "contract" ] + "/WormholeReceiver.json" ) ;
6775
6876 const payloads : Buffer [ ] = [ ] ;
6977 for ( const chain of Object . values ( DefaultStore . chains ) ) {
0 commit comments