Skip to content

Commit

Permalink
Add support for eth-gas-reporter (#2501)
Browse files Browse the repository at this point in the history
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
  • Loading branch information
Amxx and frangio committed Feb 9, 2021
1 parent 9c1e703 commit 1ba03b1
Show file tree
Hide file tree
Showing 4 changed files with 536 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Expand Up @@ -26,6 +26,11 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
- run: npm run lint
- run: npm run test
env:
FORCE_COLOR: 1
ENABLE_GAS_REPORT: 1
- name: Print gas report
run: cat gas-report.txt

coverage:
runs-on: ubuntu-latest
Expand Down
20 changes: 15 additions & 5 deletions hardhat.config.js
Expand Up @@ -4,25 +4,35 @@ const path = require('path');
require('@nomiclabs/hardhat-truffle5');
require('@nomiclabs/hardhat-solhint');
require('solidity-coverage');
require('hardhat-gas-reporter');

for (const f of fs.readdirSync(path.join(__dirname, 'hardhat'))) {
require(path.join(__dirname, 'hardhat', f));
}

const enableGasReport = !!process.env.ENABLE_GAS_REPORT;

/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: '0.8.0',
settings: {
optimizer: {
enabled: false,
runs: 200,
solidity: {
version: '0.8.0',
settings: {
optimizer: {
enabled: enableGasReport,
runs: 200,
},
},
},
networks: {
hardhat: {
blockGasLimit: 10000000,
},
},
gasReporter: {
enable: enableGasReport,
currency: 'USD',
outputFile: process.env.CI ? 'gas-report.txt' : undefined,
},
};

0 comments on commit 1ba03b1

Please sign in to comment.