Skip to content

Commit

Permalink
Merge pull request #14 from ava-labs/feature/hardhat-forking-config
Browse files Browse the repository at this point in the history
Add configs for hardhat forking
  • Loading branch information
Connor Daly authored May 25, 2021
2 parents a3a092e + 9e92537 commit 0627fcc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
require("@nomiclabs/hardhat-waffle");
require("@nomiclabs/hardhat-ethers");


// When using the hardhat network, you may choose to fork Fuji or Avalanche Mainnet
// This will allow you to debug contracts using the hardhat network while keeping the current network state
// To enable forking, turn one of these booleans on, and then run your tasks/scripts using ``--network hardhat``
// For more information go to the hardhat guide
// https://hardhat.org/hardhat-network/
// https://hardhat.org/guides/mainnet-forking.html
const FORK_FUJI = false;
const FORK_MAINNET = false;
const forkingData = FORK_FUJI ? {
url: 'https://api.avax-test.network/ext/bc/C/rpc',
} : FORK_MAINNET ? {
url: 'https://api.avax.network/ext/bc/C/rpc'
} : undefined

// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task("accounts", "Prints the list of accounts", async () => {
Expand Down Expand Up @@ -46,7 +61,8 @@ module.exports = {
networks: {
hardhat: {
gasPrice: 225000000000,
chainId: 43112,
chainId: !forkingData ? 43112 : undefined, //Only specify a chainId if we are not forking
forking: forkingData
},
avash: {
url: 'http://localhost:9650/ext/bc/C/rpc',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"ethereum-waffle": "^3.2.1",
"ethereumjs-tx": "^2.1.2",
"ethers": "^5.0.24",
"hardhat": "^2.0.6",
"hardhat": "^2.2.0",
"web3": "^1.3.1"
},
"version": "1.0.0",
Expand Down

0 comments on commit 0627fcc

Please sign in to comment.