hardhat.config.js 942 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /// ENVVAR
  2. // - ENABLE_GAS_REPORT
  3. // - CI
  4. // - COMPILE_MODE
  5. const fs = require('fs');
  6. const path = require('path');
  7. const argv = require('yargs/yargs')()
  8. .env('')
  9. .boolean('enableGasReport')
  10. .boolean('ci')
  11. .string('compileMode')
  12. .argv;
  13. require('@nomiclabs/hardhat-truffle5');
  14. require('solidity-coverage');
  15. if (argv.enableGasReport) {
  16. require('hardhat-gas-reporter');
  17. }
  18. for (const f of fs.readdirSync(path.join(__dirname, 'hardhat'))) {
  19. require(path.join(__dirname, 'hardhat', f));
  20. }
  21. /**
  22. * @type import('hardhat/config').HardhatUserConfig
  23. */
  24. module.exports = {
  25. solidity: {
  26. version: '0.8.3',
  27. settings: {
  28. optimizer: {
  29. enabled: argv.enableGasReport || argv.compileMode === 'production',
  30. runs: 200,
  31. },
  32. },
  33. },
  34. networks: {
  35. hardhat: {
  36. blockGasLimit: 10000000,
  37. },
  38. },
  39. gasReporter: {
  40. currency: 'USD',
  41. outputFile: argv.ci ? 'gas-report.txt' : undefined,
  42. },
  43. };