-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Expand file tree
/
Copy pathhardhat.config.ts
More file actions
103 lines (100 loc) · 2.84 KB
/
Copy pathhardhat.config.ts
File metadata and controls
103 lines (100 loc) · 2.84 KB
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
import { defineConfig } from 'hardhat/config';
// Plugins
import hardhatEthers from '@nomicfoundation/hardhat-ethers';
import hardhatEthersChaiMatchers from '@nomicfoundation/hardhat-ethers-chai-matchers';
import hardhatIgnoreWarnings from 'hardhat-ignore-warnings';
import hardhatMocha from '@nomicfoundation/hardhat-mocha';
import hardhatNetworkHelpers from '@nomicfoundation/hardhat-network-helpers';
import hardhatPredeploy from 'hardhat-predeploy';
import hardhatDocgen from './hardhat/hardhat-solidity-docgen/plugin.ts';
import hardhatExposed from './hardhat/hardhat-exposed/plugin.ts';
import hardhatTranspiler from './hardhat/hardhat-transpiler/plugin.ts';
import hardhatOzContractsHelpers from './hardhat/hardhat-oz-contracts-helpers/plugin.ts';
import './hardhat/async-test-sanity.ts';
// Parameters
import yargs from 'yargs/yargs';
const argv = await yargs()
.env('')
.options({
compiler: { type: 'string', default: '0.8.35' },
src: { type: 'string', default: 'contracts' },
runs: { type: 'number', default: 200 },
ir: { type: 'boolean', default: false },
evm: { type: 'string', default: 'osaka' },
})
.parse();
// Configuration
export default defineConfig({
plugins: [
// Imported plugins
hardhatEthers,
hardhatEthersChaiMatchers,
hardhatIgnoreWarnings,
hardhatMocha,
hardhatNetworkHelpers,
hardhatPredeploy,
// Local plugins
hardhatDocgen,
hardhatExposed,
hardhatTranspiler,
hardhatOzContractsHelpers,
],
paths: {
sources: argv.src,
},
solidity: {
version: argv.compiler,
settings: {
optimizer: {
enabled: true,
runs: argv.runs,
},
evmVersion: argv.evm,
viaIR: argv.ir,
outputSelection: { '*': { '*': ['storageLayout'] } },
},
},
networks: {
default: {
type: 'edr-simulated',
hardfork: argv.evm,
// Exposed contracts often exceed the maximum contract size. For normal contract,
// we rely on the `code-size` compiler warning, that will cause a compilation error.
allowUnlimitedContractSize: true,
},
},
test: {
solidity: {
fuzz: {
runs: 5000,
maxTestRejects: 150000,
},
fsPermissions: {
readDirectory: ['node_modules/hardhat-predeploy/bin'],
},
},
},
coverage: {
skipFiles: ['contracts/mocks/**', 'contracts-exposed/**', 'lib/**'],
},
warnings: {
'lib/**/*': 'off',
'npm/**/*': 'off',
'test/**/*': 'off',
'contracts-exposed/**/*': {
'code-size': 'off',
'initcode-size': 'off',
},
'*': {
'transient-storage': 'off',
6335: 'warn', // is-future-solidity-keyword
default: 'error',
},
},
exposed: {
initializers: true,
include: ['contracts/**/*.sol'],
exclude: ['**/*WithInit.sol'],
},
docgen: await import('./docs/config.mjs').then(m => m.default),
});