Skip to content

Commit 2172247

Browse files
committed
fix: deploy script issue for the devnet foreign gateway
1 parent 76763b6 commit 2172247

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

contracts/deploy/01-foreign-gateway-on-ethereum.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HardhatRuntimeEnvironment } from "hardhat/types";
1+
import { HardhatRuntimeEnvironment, HttpNetworkConfig } from "hardhat/types";
22
import { DeployFunction } from "hardhat-deploy/types";
33
import getContractAddress from "./utils/getContractAddress";
44
import { KlerosCore__factory } from "../typechain-types";
@@ -15,15 +15,11 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme
1515
const chainId = Number(await getChainId());
1616
console.log("Deploying to chainId %s with deployer %s", chainId, deployer);
1717

18-
const homeNetworks = {
19-
ETHEREUM_MAINNET: config.networks.arbitrum,
20-
ETHEREUM_GOERLI: config.networks.arbitrumGoerli,
21-
HARDHAT: config.networks.localhost,
22-
};
23-
2418
// Hack to predict the deployment address on the home chain.
2519
// TODO: use deterministic deployments
26-
const homeChainProvider = new ethers.providers.JsonRpcProvider(homeNetworks[ForeignChains[chainId]].url);
20+
const network = config.networks[hre.network.name];
21+
const homeNetwork = config.networks[network.companionNetworks.home] as HttpNetworkConfig;
22+
const homeChainProvider = new ethers.providers.JsonRpcProvider(homeNetwork.url);
2723
let nonce = await homeChainProvider.getTransactionCount(deployer);
2824
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.
2925
const homeGatewayAddress = getContractAddress(deployer, nonce);

contracts/deploy/01-foreign-gateway-on-gnosis.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { parseUnits } from "ethers/lib/utils";
2-
import { HardhatRuntimeEnvironment } from "hardhat/types";
2+
import { HardhatRuntimeEnvironment, HttpNetworkConfig } from "hardhat/types";
33
import { DeployFunction } from "hardhat-deploy/types";
44
import getContractAddress from "./utils/getContractAddress";
55
import { 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

Comments
 (0)