Skip to content

Commit

Permalink
Fix gas report generation (#4824)
Browse files Browse the repository at this point in the history
Co-authored-by: ernestognw <ernestognw@gmail.com>
  • Loading branch information
Amxx and ernestognw authored Jan 12, 2024
1 parent e68720e commit efb8c1a
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 579 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
runs-on: ubuntu-latest
env:
FORCE_COLOR: 1
# Needed for "eth-gas-reporter" to produce a "gasReporterOutput.json" as documented in
# https://github.com/cgewecke/eth-gas-reporter/blob/v0.2.27/docs/gasReporterOutput.md
CI: true
GAS: true
steps:
- uses: actions/checkout@v4
Expand Down
32 changes: 10 additions & 22 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ const argv = require('yargs/yargs')()
type: 'boolean',
default: false,
},
gasReport: {
alias: 'enableGasReportPath',
type: 'string',
implies: 'gas',
default: undefined,
},
mode: {
alias: 'compileMode',
type: 'string',
Expand Down Expand Up @@ -55,10 +49,12 @@ const argv = require('yargs/yargs')()
},
}).argv;

require('@nomicfoundation/hardhat-toolbox');
require('@nomicfoundation/hardhat-chai-matchers');
require('@nomicfoundation/hardhat-ethers');
require('hardhat-ignore-warnings');
require('hardhat-exposed');
require('hardhat-gas-reporter');
require('hardhat-ignore-warnings');
require('solidity-coverage');
require('solidity-docgen');
argv.foundry && require('@nomicfoundation/hardhat-foundry');

Expand Down Expand Up @@ -101,30 +97,22 @@ module.exports = {
networks: {
hardhat: {
allowUnlimitedContractSize: !withOptimizations,
initialBaseFeePerGas: argv.coverage ? 0 : undefined,
},
},
exposed: {
imports: true,
initializers: true,
exclude: ['vendor/**/*'],
},
docgen: require('./docs/config'),
};

if (argv.gas) {
require('hardhat-gas-reporter');
module.exports.gasReporter = {
gasReporter: {
enabled: argv.gas,
showMethodSig: true,
currency: 'USD',
outputFile: argv.gasReport,
coinmarketcap: argv.coinmarketcap,
};
}

if (argv.coverage) {
require('solidity-coverage');
module.exports.networks.hardhat.initialBaseFeePerGas = 0;
}
},
docgen: require('./docs/config'),
};

function hasFoundry() {
return proc.spawnSync('forge', ['-V'], { stdio: 'ignore' }).error === undefined;
Expand Down
18 changes: 0 additions & 18 deletions hardhat/env-contract.js

This file was deleted.

Loading

0 comments on commit efb8c1a

Please sign in to comment.