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

how to use hardcoded gasPrice and gasLimit for all transactions #2485

Closed
shunjizhan opened this issue Mar 14, 2022 · 4 comments
Closed

how to use hardcoded gasPrice and gasLimit for all transactions #2485

shunjizhan opened this issue Mar 14, 2022 · 4 comments
Assignees

Comments

@shunjizhan
Copy link

shunjizhan commented Mar 14, 2022

Hi, according to the doc, in hardhat config, gas will override gasLimit, and gasPrice will override gasPrice for every transaction. However, when I set a hardcoded value for the gas params:

networks: {
  myNetwork: {
      gasPrice: 204369036266, 
      gas: 53064000,
  }
}

I saw my contract deployment transaction only used 204369036266 as gasPrice, but didn't use 53064000 as gasLimit, and it queried eth_estimateGas and used the result for gasLimit.

Is this expected? Did I misunderstand what the docs mean?

Basically I am trying to use these hardcoded gas params for every transaction, including contract deployment and call, in truffle if I put the same setting in truffle config it will work, so I was wondering how should I do it with hardhat? Thanks for the help!

@fvictorio
Copy link
Member

Sadly this doesn't work with ethers.js. The docs should be clearer about this fact, sorry about that.

@fvictorio
Copy link
Member

To clarify: this works when sending "low level" transactions, and I think it also works with hardhat-web3, but most people use ethers.js with hardhat-ethers now, so this part of the docs is misleading.

@shunjizhan
Copy link
Author

Thanks! And it would be nice to clarify this in the doc so other devs won't get confused for this same issue : )

@fvictorio
Copy link
Member

Oh yes, we have an open PR for that, we just need to get it merged 🙂

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants