11import { parseUnits } from "ethers/lib/utils" ;
2- import { HardhatRuntimeEnvironment } from "hardhat/types" ;
2+ import { HardhatRuntimeEnvironment , HttpNetworkConfig } from "hardhat/types" ;
33import { DeployFunction } from "hardhat-deploy/types" ;
44import getContractAddress from "./utils/getContractAddress" ;
55import { KlerosCore__factory } from "../typechain-types" ;
@@ -18,15 +18,11 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme
1818 const chainId = Number ( await getChainId ( ) ) ;
1919 console . log ( "Deploying to chainId %s with deployer %s" , chainId , deployer ) ;
2020
21- const homeNetworks = {
22- GNOSIS_MAINNET : config . networks . arbitrum ,
23- GNOSIS_CHIADO : config . networks . arbitrumGoerli ,
24- HARDHAT : config . networks . localhost ,
25- } ;
26-
2721 // Hack to predict the deployment address on the home chain.
2822 // TODO: use deterministic deployments
29- const homeChainProvider = new ethers . providers . JsonRpcProvider ( homeNetworks [ ForeignChains [ chainId ] ] . url ) ;
23+ const network = config . networks [ hre . network . name ] ;
24+ const homeNetwork = config . networks [ network . companionNetworks . home ] as HttpNetworkConfig ;
25+ const homeChainProvider = new ethers . providers . JsonRpcProvider ( homeNetwork . url ) ;
3026 let nonce = await homeChainProvider . getTransactionCount ( deployer ) ;
3127 nonce += 1 ; // HomeGatewayToEthereum Proxy deploy tx will be the 2nd tx after this on its home network, so we add 1 to the current nonce.
3228 const homeGatewayAddress = getContractAddress ( deployer , nonce ) ; // HomeGateway deploy tx will be the next tx home network
0 commit comments