-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.ts
88 lines (82 loc) · 1.8 KB
/
hardhat.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import { HardhatUserConfig } from 'hardhat/config';
import '@nomicfoundation/hardhat-toolbox';
import '@nomiclabs/hardhat-ethers';
import '@nomiclabs/hardhat-etherscan';
import '@nomiclabs/hardhat-waffle';
import '@typechain/hardhat';
import yargs from 'yargs/yargs';
const argv = yargs()
.env('')
.options({
coverage: {
type: 'boolean',
default: false,
},
gas: {
alias: 'enableGasReport',
type: 'boolean',
default: false,
},
gasReport: {
alias: 'enableGasReportPath',
type: 'string',
implies: 'gas',
default: undefined,
},
mode: {
alias: 'compileMode',
type: 'string',
choices: ['production', 'development'],
default: 'development',
},
ir: {
alias: 'enableIR',
type: 'boolean',
default: false,
},
compiler: {
alias: 'compileVersion',
type: 'string',
default: '0.8.9',
},
coinmarketcap: {
alias: 'coinmarketcapApiKey',
type: 'string',
},
})
.parseSync();
if (argv.gas) {
require('hardhat-gas-reporter');
}
const withOptimizations = argv.gas || argv.compileMode === 'production';
const config: HardhatUserConfig = {
solidity: {
version: argv.compiler,
settings: {
optimizer: {
enabled: withOptimizations,
runs: 200,
},
viaIR: withOptimizations && argv.ir,
},
},
networks: {
hardhat: {
blockGasLimit: 10000000,
allowUnlimitedContractSize: !withOptimizations,
},
},
gasReporter: {
showMethodSig: true,
currency: 'USD',
outputFile: argv.gasReport,
coinmarketcap: argv.coinmarketcap,
},
};
if (argv.coverage) {
require('solidity-coverage');
if (config.networks?.hardhat) {
config.networks.hardhat.initialBaseFeePerGas = 0;
}
}
export default config;