hardhat.config.js 897 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. const fs = require('fs');
  2. const path = require('path');
  3. require('@nomiclabs/hardhat-truffle5');
  4. require('@nomiclabs/hardhat-solhint');
  5. require('solidity-coverage');
  6. require('hardhat-gas-reporter');
  7. for (const f of fs.readdirSync(path.join(__dirname, 'hardhat'))) {
  8. require(path.join(__dirname, 'hardhat', f));
  9. }
  10. const enableGasReport = !!process.env.ENABLE_GAS_REPORT;
  11. const enableProduction = process.env.COMPILE_MODE === 'production';
  12. /**
  13. * @type import('hardhat/config').HardhatUserConfig
  14. */
  15. module.exports = {
  16. solidity: {
  17. version: '0.8.0',
  18. settings: {
  19. optimizer: {
  20. enabled: enableGasReport || enableProduction,
  21. runs: 200,
  22. },
  23. },
  24. },
  25. networks: {
  26. hardhat: {
  27. blockGasLimit: 10000000,
  28. },
  29. },
  30. gasReporter: {
  31. enable: enableGasReport,
  32. currency: 'USD',
  33. outputFile: process.env.CI ? 'gas-report.txt' : undefined,
  34. },
  35. };