Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hardhat ether version update #379

Merged
merged 11 commits into from
Dec 13, 2024
Merged
17 changes: 8 additions & 9 deletions contracts/deploy/01-outbox/01-arb-sepolia-to-chiado-outbox.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parseEther } from "ethers/lib/utils";
import { parseEther } from "ethers";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import getContractAddress from "../../deploy-helpers/getContractAddress";
Expand Down Expand Up @@ -26,18 +26,17 @@ const paramsByChainId = {
epochPeriod: 600, // 10 min
minChallengePeriod: 600, // 10 min
numEpochTimeout: 24, // 6 hours
amb: ethers.constants.AddressZero,
amb: ethers.ZeroAddress,
sequencerLimit: 0,
maxMissingBlocks: 10000000000000,
routerChainId: 31337,
WETH: ethers.constants.AddressZero,
WETH: ethers.ZeroAddress,
},
};

const deployOutbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { ethers, deployments, getNamedAccounts, getChainId, config } = hre;
const { deploy } = deployments;
const { providers } = ethers;

// fallback to hardhat node signers on local network
const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address;
Expand Down Expand Up @@ -85,7 +84,7 @@ const deployOutbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
minChallengePeriod,
numEpochTimeout,
amb,
ethers.constants.AddressZero,
ethers.ZeroAddress,
sequencerLimit,
maxMissingBlocks,
routerChainId,
Expand All @@ -98,14 +97,14 @@ const deployOutbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
// ----------------------------------------------------------------------------------------------
const liveDeployer = async () => {
const gasOptions = {
maxFeePerGas: ethers.utils.parseUnits("1", "gwei"),
maxPriorityFeePerGas: ethers.utils.parseUnits("1", "gwei"),
maxFeePerGas: String(ethers.parseUnits("1", "gwei")),
maxPriorityFeePerGas: String(ethers.parseUnits("1", "gwei")),
};

const senderChainProvider = new providers.JsonRpcProvider(senderNetworks[ReceiverChains[chainId]].url);
const senderChainProvider = new ethers.JsonRpcProvider(senderNetworks[ReceiverChains[chainId]].url);
let nonce = await senderChainProvider.getTransactionCount(deployer);

const routerChainProvider = new providers.JsonRpcProvider(routerNetworks[ReceiverChains[chainId]].url);
const routerChainProvider = new ethers.JsonRpcProvider(routerNetworks[ReceiverChains[chainId]].url);
let nonceRouter = await routerChainProvider.getTransactionCount(deployer);

const routerAddress = getContractAddress(deployer, nonceRouter);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parseEther } from "ethers/lib/utils";
import { parseEther } from "ethers";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import getContractAddress from "../../deploy-helpers/getContractAddress";
Expand Down Expand Up @@ -26,14 +26,13 @@ const paramsByChainId = {
minChallengePeriod: 600, // 10 min (assume no sequencer backdating)
numEpochTimeout: 10000000000000, // 6 hours
maxMissingBlocks: 10000000000000,
arbitrumBridge: ethers.constants.AddressZero,
arbitrumBridge: ethers.ZeroAddress,
},
};

const deployOutbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { ethers, deployments, getNamedAccounts, getChainId, config } = hre;
const { deploy } = deployments;
const { providers } = ethers;

// fallback to hardhat node signers on local network
const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address;
Expand Down Expand Up @@ -98,7 +97,7 @@ const deployOutbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {

// ----------------------------------------------------------------------------------------------
const liveDeployer = async () => {
const senderChainProvider = new providers.JsonRpcProvider(senderNetworks[ReceiverChains[chainId]].url);
const senderChainProvider = new ethers.JsonRpcProvider(senderNetworks[ReceiverChains[chainId]].url);
let nonce = await senderChainProvider.getTransactionCount(deployer);

const veaInboxAddress = getContractAddress(deployer, nonce);
Expand Down
7 changes: 3 additions & 4 deletions contracts/deploy/01-outbox/01-arb-to-eth-outbox.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parseEther } from "ethers/lib/utils";
import { parseEther } from "ethers";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import getContractAddress from "../../deploy-helpers/getContractAddress";
Expand Down Expand Up @@ -35,14 +35,13 @@ const paramsByChainId = {
minChallengePeriod: 600, // 10 min
numEpochTimeout: 10000000000000, // never
maxMissingBlocks: 10,
arbitrumBridge: ethers.constants.AddressZero,
arbitrumBridge: ethers.ZeroAddress,
},
};

const deployOutbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { ethers, deployments, getNamedAccounts, getChainId, config } = hre;
const { deploy } = deployments;
const { providers } = ethers;

// fallback to hardhat node signers on local network
const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address;
Expand Down Expand Up @@ -120,7 +119,7 @@ const deployOutbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
// ----------------------------------------------------------------------------------------------
const liveDeployer = async () => {
console.log(config.networks);
const senderChainProvider = new providers.JsonRpcProvider(senderNetworks[ReceiverChains[chainId]].url);
const senderChainProvider = new ethers.JsonRpcProvider(senderNetworks[ReceiverChains[chainId]].url);
let nonce = await senderChainProvider.getTransactionCount(deployer);

const veaInboxAddress = getContractAddress(deployer, nonce);
Expand Down
11 changes: 5 additions & 6 deletions contracts/deploy/01-outbox/01-arb-to-gnosis-outbox.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parseEther } from "ethers/lib/utils";
import { parseEther } from "ethers";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import getContractAddress from "../../deploy-helpers/getContractAddress";
Expand Down Expand Up @@ -42,8 +42,8 @@ const paramsByChainId = {
minChallengePeriod: 600, // 10 min (assume no sequencer backdating)
numEpochTimeout: 21600, // 6 hours
claimDelay: 2,
amb: ethers.constants.AddressZero,
routerAddress: ethers.constants.AddressZero,
amb: ethers.ZeroAddress,
routerAddress: ethers.ZeroAddress,
maxMissingBlocks: 10000000000000,
routerChainId: 31337,
sequencerLimit: 864,
Expand All @@ -53,7 +53,6 @@ const paramsByChainId = {
const deployOutbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { ethers, deployments, getNamedAccounts, getChainId, config } = hre;
const { deploy } = deployments;
const { providers } = ethers;

// fallback to hardhat node signers on local network
const [namedAccounts, signers, rawChainId] = await Promise.all([
Expand Down Expand Up @@ -139,7 +138,7 @@ const deployOutbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {

// ----------------------------------------------------------------------------------------------
const liveDeployer = async () => {
const routerChainProvider = new providers.JsonRpcProvider(routerNetworks[ReceiverChains[chainId]].url);
const routerChainProvider = new ethers.JsonRpcProvider(routerNetworks[ReceiverChains[chainId]].url);
let nonceRouter = await routerChainProvider.getTransactionCount(deployer);

const routerAddress = getContractAddress(deployer, nonceRouter);
Expand All @@ -161,7 +160,7 @@ const deployOutbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
WETH,
],
log: true,
gasPrice: ethers.utils.parseUnits("1", "gwei"), // chiado rpc response underprices gas
gasPrice: String(10 ** 9), // chiado rpc response underprices gas, 1 gwei
});

console.log("VeaOutboxArbToGnosis deployed to:", txn.address);
Expand Down
15 changes: 7 additions & 8 deletions contracts/deploy/01-outbox/01-chiado-to-arb-sepolia-outbox.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parseEther } from "ethers/lib/utils";
import { parseEther } from "ethers";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import getContractAddress from "../../deploy-helpers/getContractAddress";
Expand All @@ -25,7 +25,7 @@ const paramsByChainId = {
epochPeriod: 600, // 10 min
challengePeriod: 600, // 10 min
numEpochTimeout: 24, // 6 hours
amb: ethers.constants.AddressZero,
amb: ethers.ZeroAddress,
sequencerDelayLimit: 86400,
sequencerFutureLimit: 3600,
maxMissingBlocks: 10000000000000,
Expand All @@ -36,7 +36,6 @@ const paramsByChainId = {
const deployOutbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { ethers, deployments, getNamedAccounts, getChainId, config } = hre;
const { deploy } = deployments;
const { providers } = ethers;

// fallback to hardhat node signers on local network
const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address;
Expand Down Expand Up @@ -77,7 +76,7 @@ const deployOutbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
challengePeriod,
numEpochTimeout,
amb,
ethers.constants.AddressZero,
ethers.ZeroAddress,
sequencerLimit,
maxMissingBlocks,
routerChainId,
Expand All @@ -92,14 +91,14 @@ const deployOutbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
// ----------------------------------------------------------------------------------------------
const liveDeployer = async () => {
const gasOptions = {
maxFeePerGas: ethers.utils.parseUnits("1", "gwei"),
maxPriorityFeePerGas: ethers.utils.parseUnits("1", "gwei"),
maxFeePerGas: String(ethers.parseUnits("1", "gwei")),
maxPriorityFeePerGas: String(ethers.parseUnits("1", "gwei")),
};

const senderChainProvider = new providers.JsonRpcProvider(senderNetworks[ReceiverChains[chainId]].url);
const senderChainProvider = new ethers.JsonRpcProvider(senderNetworks[ReceiverChains[chainId]].url);
let nonce = await senderChainProvider.getTransactionCount(deployer);
madhurMongia marked this conversation as resolved.
Show resolved Hide resolved

const routerChainProvider = new providers.JsonRpcProvider(routerNetworks[ReceiverChains[chainId]].url);
const routerChainProvider = new ethers.JsonRpcProvider(routerNetworks[ReceiverChains[chainId]].url);
let nonceRouter = await routerChainProvider.getTransactionCount(deployer);

const routerAddress = getContractAddress(deployer, nonceRouter);
Expand Down
14 changes: 6 additions & 8 deletions contracts/deploy/01-outbox/01-gnosis-to-arb-outbox.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { parseEther } from "ethers/lib/utils";
import { parseEther } from "ethers";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import getContractAddress from "../../deploy-helpers/getContractAddress";
import { ethers } from "hardhat";

enum ReceiverChains {
ARBITRUM_SEPOLIA = 421614,
Expand Down Expand Up @@ -40,7 +39,6 @@ const paramsByChainId = {
const deployOutbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { ethers, deployments, getNamedAccounts, getChainId, config } = hre;
const { deploy } = deployments;
const { providers } = ethers;

// fallback to hardhat node signers on local network
const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address;
Expand Down Expand Up @@ -83,7 +81,7 @@ const deployOutbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
challengePeriod,
numEpochTimeout,
amb,
ethers.constants.AddressZero,
ethers.ZeroAddress,
sequencerLimit,
maxMissingBlocks,
routerChainId,
Expand All @@ -98,14 +96,14 @@ const deployOutbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
// ----------------------------------------------------------------------------------------------
const liveDeployer = async () => {
const gasOptions = {
maxFeePerGas: ethers.utils.parseUnits("1", "gwei"),
maxPriorityFeePerGas: ethers.utils.parseUnits("1", "gwei"),
maxFeePerGas: String(ethers.parseUnits("1", "gwei")),
maxPriorityFeePerGas: String(ethers.parseUnits("1", "gwei")),
};

const senderChainProvider = new providers.JsonRpcProvider(senderNetworks[ReceiverChains[chainId]].url);
const senderChainProvider = new ethers.JsonRpcProvider(senderNetworks[ReceiverChains[chainId]].url);
let nonce = await senderChainProvider.getTransactionCount(deployer);

const routerChainProvider = new providers.JsonRpcProvider(routerNetworks[ReceiverChains[chainId]].url);
const routerChainProvider = new ethers.JsonRpcProvider(routerNetworks[ReceiverChains[chainId]].url);
let nonceRouter = await routerChainProvider.getTransactionCount(deployer);

const routerAddress = getContractAddress(deployer, nonceRouter);
Expand Down
4 changes: 1 addition & 3 deletions contracts/deploy/02-inbox/02-arb-to-gnosis-inbox.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import getContractAddress from "../../deploy-helpers/getContractAddress";
import { ethers } from "hardhat";
import { providers } from "ethers";

enum SenderChains {
ARBITRUM = 42161,
Expand Down Expand Up @@ -84,7 +82,7 @@ const deployInbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {

// ----------------------------------------------------------------------------------------------
const liveDeployer = async () => {
const routerChainProvider = new providers.JsonRpcProvider(routerNetworks[SenderChains[chainId]].url);
const routerChainProvider = new ethers.JsonRpcProvider(routerNetworks[SenderChains[chainId]].url);
let nonceRouter = await routerChainProvider.getTransactionCount(deployer);

const routerAddress = getContractAddress(deployer, nonceRouter);
Expand Down
6 changes: 3 additions & 3 deletions contracts/deploy/02-inbox/02-chiado-to-arb-sepolia-inbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const paramsByChainId = {
amb: "0x8448E15d0e706C0298dECA99F0b4744030e59d7d", // https://docs.gnosischain.com/bridges/About%20Token%20Bridges/amb-bridge#key-contracts
},
HARDHAT: {
amb: ethers.constants.AddressZero,
amb: ethers.ZeroAddress,
epochPeriod: 600, // 10 minutes
},
};
Expand All @@ -34,8 +34,8 @@ const deployInbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const veaOutboxArb = await hre.companionNetworks.arbitrumSepolia.deployments.get("VeaOutboxGnosisToArbDevnet");

const gasOptions = {
maxFeePerGas: ethers.utils.parseUnits("1", "gwei"),
maxPriorityFeePerGas: ethers.utils.parseUnits("1", "gwei"),
maxFeePerGas: String(ethers.parseUnits("1", "gwei")),
maxPriorityFeePerGas: String(ethers.parseUnits("1", "gwei")),
};

const inbox = await deploy("VeaInboxGnosisToArbDevnet", {
Expand Down
6 changes: 3 additions & 3 deletions contracts/deploy/02-inbox/02-gnosis-to-arb-inbox.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import { ethers } from "hardhat";
import { ethers } from "ethers";

enum SenderChains {
GNOSIS = 100,
Expand Down Expand Up @@ -40,8 +40,8 @@ const deployInbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
);

const gasOptions = {
maxFeePerGas: ethers.utils.parseUnits("1", "gwei"),
maxPriorityFeePerGas: ethers.utils.parseUnits("1", "gwei"),
maxFeePerGas: String(ethers.parseUnits("1", "gwei")),
maxPriorityFeePerGas: String(ethers.parseUnits("1", "gwei")),
};

const inbox = await deploy("VeaInboxGnosisToArb" + (chainId === 100 ? "" : "Testnet"), {
Expand Down
12 changes: 7 additions & 5 deletions contracts/deploy/03-routers/03-arb-sepolia-to-chiado-router.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import { ethers } from "hardhat";
import { ZeroAddress } from "ethers";

enum RouterChains {
ETHEREUM_SEPOLIA = 11155111,
Expand All @@ -13,8 +13,8 @@ const paramsByChainId = {
amb: "0x99Ca51a3534785ED619f46A79C7Ad65Fa8d85e7a",
},
HARDHAT: {
arbitrumBridge: ethers.constants.AddressZero,
amb: ethers.constants.AddressZero,
arbitrumBridge: ZeroAddress,
amb: ZeroAddress,
},
};

Expand All @@ -25,7 +25,9 @@ const deployRouter: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const chainId = Number(await getChainId());

// fallback to hardhat node signers on local network
const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address;
const namedAccounts = await getNamedAccounts();
const signers = await hre.ethers.getSigners();
const deployer = namedAccounts.deployer ?? signers[0].address;
console.log("deployer: %s", deployer);

const { arbitrumBridge, amb } = paramsByChainId[RouterChains[chainId]];
Expand Down Expand Up @@ -58,7 +60,7 @@ const deployRouter: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
};

// ----------------------------------------------------------------------------------------------
if (chainId === 31337) {
if (chainId === RouterChains.HARDHAT) {
await hardhatDeployer();
} else {
await liveDeployer();
Expand Down
Loading
Loading