PatrickAlphaC / hardhat-fund-me-fcc

82 stars 184 forks source link

Fixes for the issue: cannot estimate gas; transaction may fail or may require manual gas limit #26

Closed alymurtazamemon closed 2 years ago

alymurtazamemon commented 2 years ago

While running the staging test, I faced the following issue: cannot estimate gas; the transaction may fail or may require a manual gas limit. I looked into the repo, someone already has updated the FundMe.staging.test.js and added the gasLimit while calling the withdraw function.

await fundMe.withdraw({
      gasLimit: 100000,
})

This solution did not resolve the above issue, so I did some research about it and found the solution and that is to specify the gas key/value to network inside the hardhat.config file.

The following files have been updated:

1. FundMe.staging.test.js

removed the gasLimit from the withdraw function while calling.

await fundMe.withdraw();

2. hardhat.config

added the gas key/value to rinkeby network.

networks: {
    rinkeby: {
      url: process.env.RPC_URL,
      accounts: [process.env.PRIVATE_KEY],
      chainId: 4,
      blockConfirmations: 6,
      gas: 6000000, // gas added here
    },
  },
PatrickAlphaC commented 2 years ago

Awesome! Thank you!