-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.config.ts
136 lines (129 loc) · 3.08 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/// ENVVAR
// - COMPILER: compiler version (default: 0.8.24)
// - SRC: contracts folder to compile (default: contracts)
// - RUNS: number of optimization runs (default: 200)
// - IR: enable IR compilation (default: false)
// - COVERAGE: enable coverage report (default: false)
// - GAS: enable gas report (default: false)
// - COINMARKETCAP: coinmarketcap api key for USD value in gas report
// - CI: output gas report to file instead of stdout
const fs = require('fs');
const path = require('path');
const { argv } = require('yargs/yargs')()
.env('')
.options({
// Compilation settings
compiler: {
alias: 'compileVersion',
type: 'string',
default: '0.8.24',
},
src: {
alias: 'source',
type: 'string',
default: 'contracts',
},
runs: {
alias: 'optimizationRuns',
type: 'number',
default: 200,
},
ir: {
alias: 'enableIR',
type: 'boolean',
default: false,
},
evm: {
alias: 'evmVersion',
type: 'string',
default: 'cancun',
},
// Extra modules
coverage: {
type: 'boolean',
default: false,
},
gas: {
alias: 'enableGasReport',
type: 'boolean',
default: false,
},
coinmarketcap: {
alias: 'coinmarketcapApiKey',
type: 'string',
},
});
require('hardhat-resolc');
require('hardhat-revive-node');
require('@nomicfoundation/hardhat-chai-matchers');
require('@nomicfoundation/hardhat-ethers');
require('hardhat-exposed');
require('hardhat-gas-reporter');
// require('hardhat-ignore-warnings');
require('solidity-coverage');
require('solidity-docgen');
for (const f of fs.readdirSync(path.join(__dirname, 'hardhat'))) {
require(path.join(__dirname, 'hardhat', f));
}
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: "0.8.28",
networks: {
hardhat: {
polkavm: true,
// allowUnlimitedContractSize: true,
nodeConfig: {
nodeBinaryPath: './substrate-node',
rpcPort: 8000,
dev: true,
},
adapterConfig: {
adapterBinaryPath: './eth-rpc',
dev: true,
}
},
},
resolc: {
compilerSource: 'binary',
settings: {
optimizer: {
enabled: true,
runs: 400,
},
evmVersion: "cancun",
compilerPath: "./resolc",
standardJson: true,
},
},
warnings: {
'contracts-exposed/**/*': {
'code-size': 'off',
'initcode-size': 'off',
},
'*': {
'unused-param': !argv.coverage, // coverage causes unused-param warnings
'transient-storage': false,
default: 'error',
},
},
exposed: {
imports: true,
initializers: true,
exclude: ['vendor/**/*', '**/*WithInit.sol'],
},
gasReporter: {
enabled: argv.gas,
showMethodSig: true,
includeBytecodeInJSON: true,
currency: 'USD',
coinmarketcap: argv.coinmarketcap,
},
paths: {
sources: argv.src,
artifacts: './artifacts-pvm',
cache: './cache-pvm'
},
docgen: require('./docs/config'),
};