1
1
import { parseUnits } from "ethers/lib/utils" ;
2
- import { HardhatRuntimeEnvironment } from "hardhat/types" ;
2
+ import { HardhatRuntimeEnvironment , HttpNetworkConfig } from "hardhat/types" ;
3
3
import { DeployFunction } from "hardhat-deploy/types" ;
4
4
import getContractAddress from "./utils/getContractAddress" ;
5
5
import { KlerosCore__factory } from "../typechain-types" ;
@@ -18,15 +18,11 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme
18
18
const chainId = Number ( await getChainId ( ) ) ;
19
19
console . log ( "Deploying to chainId %s with deployer %s" , chainId , deployer ) ;
20
20
21
- const homeNetworks = {
22
- GNOSIS_MAINNET : config . networks . arbitrum ,
23
- GNOSIS_CHIADO : config . networks . arbitrumGoerli ,
24
- HARDHAT : config . networks . localhost ,
25
- } ;
26
-
27
21
// Hack to predict the deployment address on the home chain.
28
22
// 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 ) ;
30
26
let nonce = await homeChainProvider . getTransactionCount ( deployer ) ;
31
27
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.
32
28
const homeGatewayAddress = getContractAddress ( deployer , nonce ) ; // HomeGateway deploy tx will be the next tx home network
0 commit comments