cgewecke / eth-gas-reporter

Gas usage per unit test. Average gas usage per method. A mocha reporter.
MIT License
603 stars 94 forks source link

Gas reporter conversion to dollars overestimates by ~70x? #259

Closed grapevinegizmos closed 2 years ago

grapevinegizmos commented 2 years ago

See the recent reported results below:

Note that "createContract" for example, which has Gwei average gas of 4,684,454 is showing $1,145.25. 4,684,454 Gwei is 0.004684454 Eth, which is about $16.36.

So what is going wrong that is report $1145? My hardhat.config.ts is shown below:

gasReporter: { / enabled: process.env.REPORT_GAS !== undefined,/ enabled: true, currency: "USD", coinmarketcap: "537xxxxx-xxxx-xxxx-xxxx-xxxxxxxx8056" },

image

cgewecke commented 2 years ago

I think the reporter is showing the correct value. The measurement for createContract is:

4,684,454 gas * 70 gwei gas price = 0.3279118 ETH
0.3279118 ETH * 3492.57 usd/eth = ~1145.25 USD

You can double-check this here: https://coincost.icu/en/eth-gas-calculator

grapevinegizmos commented 2 years ago

Yep, sorry, missed the part about gas price of 70 gwei per gas unit.