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:
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
......
......@@ -4,20 +4,25 @@ 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: {
......@@ -25,4 +30,9 @@ module.exports = {
blockGasLimit: 10000000,
},
},
gasReporter: {
enable: enableGasReport,
currency: 'USD',
outputFile: process.env.CI ? 'gas-report.txt' : undefined,
},
};
......@@ -24,7 +24,8 @@
"prepack": "scripts/prepack.sh",
"release": "scripts/release/release.sh",
"version": "scripts/release/version.sh",
"test": "hardhat test"
"test": "hardhat test",
"gas-report": "env ENABLE_GAS_REPORT=1 npm run test"
},
"repository": {
"type": "git",
......@@ -64,6 +65,7 @@
"ethereumjs-util": "^7.0.7",
"ethereumjs-wallet": "^1.0.1",
"hardhat": "^2.0.6",
"hardhat-gas-reporter": "^1.0.4",
"lodash.startcase": "^4.4.0",
"lodash.zip": "^4.2.0",
"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