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

Commit

Permalink
Add ethPrice, gasPrice to config object so hh-gas-reporter can set (#264
Browse files Browse the repository at this point in the history
)
  • Loading branch information
cgewecke committed Nov 26, 2021
1 parent 82db37f commit deadc07
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/utils.js
Expand Up @@ -175,6 +175,8 @@ const utils = {
* @param {Object} config
*/
setGasAndPriceRates: async function(config) {
if (config.ethPrice && config.gasPrice) return;

const token = config.token.toUpperCase();
const gasPriceApi = config.gasPriceApi;
const coinmarketcap =
Expand All @@ -197,7 +199,7 @@ const utils = {
}
}

// Gas price data: ethgasstation
// Gas price data: etherscan (or `gasPriceAPI`)
if (!config.gasPrice) {
try {
let response = await request.get(gasPriceApi);
Expand Down
4 changes: 2 additions & 2 deletions mock/config-template.js
Expand Up @@ -11,10 +11,10 @@ module.exports = {
reporter: "eth-gas-reporter",
reporterOptions: {
currency: "chf",
gasPrice: 21,
token: "ETH",
coinmarketcap: process.env.COINMARKETCAP_API_KEY || null,
gasPriceApi:
"https://api.etherscan.io/api?module=proxy&action=eth_gasPrice&apikey=YourApiKeyToken",
"https://api.etherscan.io/api?module=proxy&action=eth_gasPrice",
onlyCalledMethods: false,
noColors: true,
rst: true,
Expand Down
5 changes: 5 additions & 0 deletions mock/package.json
Expand Up @@ -33,6 +33,11 @@
"peerDependencies": {
"@codechecks/client": "^0.1.0"
},
"peerDependenciesMeta": {
"@codechecks/client": {
"optional": true
}
},
"dependencies": {
"@ethersproject/abi": "^5.0.0-beta.146",
"@solidity-parser/parser": "^0.14.0",
Expand Down

0 comments on commit deadc07

Please sign in to comment.