Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Commit

Permalink
Improve docs for missing price data (#266)
Browse files Browse the repository at this point in the history
* Improve docs for missing pricing data (#255)

* Add note about gas usage measurement accuracy for non-eth networks

Co-authored-by: Mark Miro <markmirony+github@gmail.com>
  • Loading branch information
cgewecke and markmiro committed Nov 29, 2021
1 parent deadc07 commit a346217
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Expand Up @@ -79,6 +79,8 @@ your own API key [here][55] and set it with the `coinmarketcap` option.

In order to retrieve the gas price of a particular blockchain, you can configure the `token` and `gasPriceApi` (API key rate limit may apply).

**NOTE**: HardhatEVM and ganache-cli implement the Ethereum blockchain. To get accurate gas measurements for other chains you may need to run your tests against development clients developed specifically for those networks.

| Option | Type | Default | Description |
| ----------------- | ---------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| currency | _String_ | 'EUR' | National currency to represent gas costs in. Exchange rates loaded at runtime from the `coinmarketcap` api. Available currency codes can be found [here](https://coinmarketcap.com/api/documentation/v1/#section/Standards-and-Conventions). |
Expand Down Expand Up @@ -138,6 +140,10 @@ An advanced use guide is available [here](https://github.com/cgewecke/eth-gas-re
- Method calls that throw are filtered from the stats.
- Contracts that are only ever created by other contracts within Solidity are not shown in the deployments table.

### Troubleshooting

- [Missing price data](./docs/missingPriceData.md)

### Contributions

Feel free to open PRs or issues. There is an integration test and one of the mock test cases is expected to fail. If you're adding an option, you can vaildate it in CI by adding it to the mock options config located [here](https://github.com/cgewecke/eth-gas-reporter/blob/master/mock/config-template.js#L13-L19).
Expand All @@ -164,4 +170,5 @@ All the ideas in this utility have been borrowed from elsewhere. Many thanks to:
- [@gnidan](https://github.com/gnidan)
- [@fodisi](https://github.com/fodisi)
- [@vicnaum](https://github.com/vicnaum)
- [@markmiro](https://github.com/markmiro)
- [@lucaperret](https://github.com/lucaperret)
16 changes: 16 additions & 0 deletions docs/missingPriceData.md
@@ -0,0 +1,16 @@
# Missing Price Data

Two possible reasons for this:
- [Default API key](https://github.com/cgewecke/eth-gas-reporter/blob/23fc57687b4e190c7e28571a14773d96cdbf7d63/lib/config.js#L12) reached a usage cap.
- The tests ran too quickly and price data couldn't be fetched before returning the test. You can manually slow down your tests with a dummy

To slow down unit tests, you can add a dummy test like this:
```js
// Wait so the reporter has time to fetch and return prices from APIs.
// https://github.com/cgewecke/eth-gas-reporter/issues/254
describe("eth-gas-reporter workaround", () => {
it("should kill time", (done) => {
setTimeout(done, 2000);
});
});
```

0 comments on commit a346217

Please sign in to comment.