0

I can create a provider fairly easily to Rinkeby, Ropsten and the other testnets but I can't seem to figure out how to create a provider that connects to a hardhat mainnet fork.

1 Answer 1

1

In hardhat, I suppose you must have enabled mainnet forking already

hardhat: {
  forking: {
    url: ''https://mainnet.infura.io/v3/key',
      blockNumber: 13413700,
    },
}

Then, you can get the ethers provider by using hre.ethers.provider in your code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.