forked from reserve-protocol/protocol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.ts
129 lines (120 loc) · 3.24 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
import '@nomiclabs/hardhat-ethers'
import '@nomiclabs/hardhat-etherscan'
import '@nomiclabs/hardhat-waffle'
import '@openzeppelin/hardhat-upgrades'
import '@typechain/hardhat'
import 'hardhat-contract-sizer'
import 'hardhat-gas-reporter'
import 'solidity-coverage'
import '@withtally/tally-publish-dao'
import dotenv from 'dotenv'
import { HardhatUserConfig } from 'hardhat/types'
import forkBlockNumber from './test/integration/fork-block-numbers'
dotenv.config()
// eslint-disable-next-line node/no-missing-require
require('./tasks')
const MAINNET_RPC_URL = process.env.MAINNET_RPC_URL || process.env.ALCHEMY_MAINNET_RPC_URL || ''
const ROPSTEN_RPC_URL = process.env.ROPSTEN_RPC_URL || ''
const GOERLI_RPC_URL = process.env.GOERLI_RPC_URL || ''
const MNEMONIC = process.env.MNEMONIC || ''
const TIMEOUT = process.env.SLOW ? 3_000_000 : 300_000
const src_dir = process.env.PROTO ? './contracts/' + process.env.PROTO : './contracts'
const settings = process.env.NO_OPT ? {} : { optimizer: { enabled: true, runs: 200 } }
const config: any = {
defaultNetwork: 'hardhat',
networks: {
hardhat: {
forking: {
url: MAINNET_RPC_URL,
blockNumber: process.env.MAINNET_BLOCK
? Number(process.env.MAINNET_BLOCK)
: forkBlockNumber['default'],
enabled: !!process.env.FORK,
},
gas: 0x1ffffffff,
blockGasLimit: 0x1fffffffffffff,
allowUnlimitedContractSize: true,
},
localhost: {
gas: 0x1ffffffff,
blockGasLimit: 0x1fffffffffffff,
allowUnlimitedContractSize: true,
},
ropsten: {
chainId: 3,
url: ROPSTEN_RPC_URL,
accounts: {
mnemonic: MNEMONIC,
},
},
goerli: {
chainId: 5,
url: GOERLI_RPC_URL,
accounts: {
mnemonic: MNEMONIC,
},
},
mainnet: {
chainId: 1,
url: MAINNET_RPC_URL,
accounts: {
mnemonic: MNEMONIC,
},
// gasPrice: 10_000_000_000,
},
},
solidity: {
compilers: [
{
version: '0.8.9',
settings,
debug: {
// How to treat revert (and require) reason strings.
// "default" does not inject compiler-generated revert strings and keeps user-supplied ones
// "strip" removes all revert strings (if literals are used) keeping side-effects
// "debug" injects strings for compiler-generated internal reverts
revertStrings: 'default',
},
},
{
version: '0.6.12',
settings: { optimizer: { enabled: false } },
},
{
version: '0.4.24',
settings: { optimizer: { enabled: false } },
},
],
},
paths: {
sources: src_dir,
},
mocha: {
timeout: TIMEOUT,
slow: 1000,
},
contractSizer: {
alphaSort: false,
disambiguatePaths: false,
runOnCompile: false,
strict: false,
only: [],
except: ['Extension'],
},
gasReporter: {
enabled: !!process.env.REPORT_GAS,
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
},
}
if (process.env.ONLY_FAST) {
config.mocha.grep = '/#fast/'
config.mocha.slow = 200
config.gasReporter.enabled = false
}
if (process.env.JOBS) {
config.mocha.parallel = true
config.mocha.jobs = process.env.JOBS
}
export default <HardhatUserConfig>config