Unverified Commit 1ba03b16 by Hadrien Croubois Committed by GitHub

Add support for eth-gas-reporter (#2501)

Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
parent 9c1e7039
...@@ -26,6 +26,11 @@ jobs: ...@@ -26,6 +26,11 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true' if: steps.cache.outputs.cache-hit != 'true'
- run: npm run lint - run: npm run lint
- run: npm run test - run: npm run test
env:
FORCE_COLOR: 1
ENABLE_GAS_REPORT: 1
- name: Print gas report
run: cat gas-report.txt
coverage: coverage:
runs-on: ubuntu-latest runs-on: ubuntu-latest
......
...@@ -4,20 +4,25 @@ const path = require('path'); ...@@ -4,20 +4,25 @@ const path = require('path');
require('@nomiclabs/hardhat-truffle5'); require('@nomiclabs/hardhat-truffle5');
require('@nomiclabs/hardhat-solhint'); require('@nomiclabs/hardhat-solhint');
require('solidity-coverage'); require('solidity-coverage');
require('hardhat-gas-reporter');
for (const f of fs.readdirSync(path.join(__dirname, 'hardhat'))) { for (const f of fs.readdirSync(path.join(__dirname, 'hardhat'))) {
require(path.join(__dirname, 'hardhat', f)); require(path.join(__dirname, 'hardhat', f));
} }
const enableGasReport = !!process.env.ENABLE_GAS_REPORT;
/** /**
* @type import('hardhat/config').HardhatUserConfig * @type import('hardhat/config').HardhatUserConfig
*/ */
module.exports = { module.exports = {
solidity: '0.8.0', solidity: {
settings: { version: '0.8.0',
optimizer: { settings: {
enabled: false, optimizer: {
runs: 200, enabled: enableGasReport,
runs: 200,
},
}, },
}, },
networks: { networks: {
...@@ -25,4 +30,9 @@ module.exports = { ...@@ -25,4 +30,9 @@ module.exports = {
blockGasLimit: 10000000, blockGasLimit: 10000000,
}, },
}, },
gasReporter: {
enable: enableGasReport,
currency: 'USD',
outputFile: process.env.CI ? 'gas-report.txt' : undefined,
},
}; };
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
"prepack": "scripts/prepack.sh", "prepack": "scripts/prepack.sh",
"release": "scripts/release/release.sh", "release": "scripts/release/release.sh",
"version": "scripts/release/version.sh", "version": "scripts/release/version.sh",
"test": "hardhat test" "test": "hardhat test",
"gas-report": "env ENABLE_GAS_REPORT=1 npm run test"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
...@@ -64,6 +65,7 @@ ...@@ -64,6 +65,7 @@
"ethereumjs-util": "^7.0.7", "ethereumjs-util": "^7.0.7",
"ethereumjs-wallet": "^1.0.1", "ethereumjs-wallet": "^1.0.1",
"hardhat": "^2.0.6", "hardhat": "^2.0.6",
"hardhat-gas-reporter": "^1.0.4",
"lodash.startcase": "^4.4.0", "lodash.startcase": "^4.4.0",
"lodash.zip": "^4.2.0", "lodash.zip": "^4.2.0",
"micromatch": "^4.0.2", "micromatch": "^4.0.2",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment