hardhat.config.js 981 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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('@nomiclabs/hardhat-solhint');
  15. require('solidity-coverage');
  16. if (argv.enableGasReport) {
  17. require('hardhat-gas-reporter');
  18. }
  19. for (const f of fs.readdirSync(path.join(__dirname, 'hardhat'))) {
  20. require(path.join(__dirname, 'hardhat', f));
  21. }
  22. /**
  23. * @type import('hardhat/config').HardhatUserConfig
  24. */
  25. module.exports = {
  26. solidity: {
  27. version: '0.8.3',
  28. settings: {
  29. optimizer: {
  30. enabled: argv.enableGasReport || argv.compileMode === 'production',
  31. runs: 200,
  32. },
  33. },
  34. },
  35. networks: {
  36. hardhat: {
  37. blockGasLimit: 10000000,
  38. },
  39. },
  40. gasReporter: {
  41. currency: 'USD',
  42. outputFile: argv.ci ? 'gas-report.txt' : undefined,
  43. },
  44. };