0

Problem: Hardhat gas reporter does not display gas reports. The tests are written in Waffle. All tests pass correctly. I want to understand what am I doing wrong and how can I mend this? Here is my hardhat.congif.js -

require("@nomiclabs/hardhat-waffle");
require("hardhat-gas-reporter");

module.exports = {
    gasReporter: {
       enabled: true,
       src: "./src"
}}

Hardhat results empty

1
  • Are you sure your testcases actually run and called your contract's functions? My case was that those testcases were skipped thus gas-reporter reported empty one. Commented Sep 12, 2022 at 6:41

1 Answer 1

2

I was having this same problem. Later i found i was not giving proper parameters.

I think you should provide at least currency, and an api key (to fetch gas related data). It worked for me.

here is my code:

 gasReporter: {
enabled: true,
currency: "USD", // currency to show
outputFile: "gas-report.txt", // optional
noColors: true, //optional
coinmarketcap: process.env.COINMARKETCAP_API_KEY, //to fetch gas data
token: "MATIC" // for polygon blockchain(optional).

},

Result output: enter image description here

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.