cgewecke / hardhat-gas-reporter

Gas Usage Analytics for Hardhat
MIT License
409 stars 56 forks source link

token option has no effect #140

Closed Obyka closed 7 months ago

Obyka commented 1 year ago

I'm trying to use hardhat-gas-reporter with Polygon. To do so, I have :

When I generate the report, the token and gas prices are still based on Ethereum instead of Polygon Here is my config and my output:

  gasReporter: {
    currency: "CHF",
    token: "MATIC",
    coinmarketcap: process.env.COINMARKETCAP || null,
    enabled: true,
  },

image

Calls are being made to the coinmarket API, but with ETH as symbol. image

What I expected: An output with MATIC price and symbol

cgewecke commented 7 months ago

I'm not sure why this wasn't working for you, nothing jumps out as wrong in your config. I just now used:

gasReporter: {
    coinmarketcap: process.env.CMC_API_KEY,
    token: "MATIC",
    gasPriceApi: "https://api.polygonscan.com/api?module=proxy&action=eth_gasPrice"
  }

and got:

Screen Shot 2024-01-30 at 7 34 30 PM

which is pretty close to polygonscan rn:

Screen Shot 2024-01-30 at 7 35 04 PM

Closing