-
Notifications
You must be signed in to change notification settings - Fork 13
/
hardhat.config.ts
220 lines (208 loc) · 6.61 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
import "dotenv/config";
import "hardhat-deploy";
import "@nomiclabs/hardhat-ethers";
import "hardhat-gas-reporter";
import "@typechain/hardhat";
import "solidity-coverage";
import "@nomiclabs/hardhat-etherscan";
import "@openzeppelin/hardhat-upgrades";
import { HardhatUserConfig } from "hardhat/types";
import { accounts, node_url } from "./scripts/utils/network";
// While waiting for hardhat PR: https://github.com/nomiclabs/hardhat/pull/1542
if (process.env.HARDHAT_FORK) {
process.env["HARDHAT_DEPLOY_FORK"] = process.env.HARDHAT_FORK;
}
const MNEMONIC_DEVNET = process.env.MNEMONIC_DEVNET || process.env.MNEMONIC || "";
const MNEMONIC_TESTNET = process.env.MNEMONIC_TESTNET || process.env.MNEMONIC || "";
const MNEMONIC_MAINNET = process.env.MNEMONIC_MAINNET || process.env.MNEMONIC || "";
const INFURA_KEY = process.env.INFURA_KEY || "";
const config: HardhatUserConfig = {
solidity: {
version: "0.8.7",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
namedAccounts: {
deployer: 0,
},
networks: {
hardhat: {
initialBaseFeePerGas: 0, // to fix : https://github.com/sc-forks/solidity-coverage/issues/652, see https://github.com/sc-forks/solidity-coverage/issues/652#issuecomment-896330136
// process.env.HARDHAT_FORK will specify the network that the fork is made from.
// this line ensure the use of the corresponding accounts
accounts: accounts(process.env.HARDHAT_FORK),
forking: process.env.HARDHAT_FORK
? {
// TODO once PR merged : network: process.env.HARDHAT_FORK,
url: node_url(process.env.HARDHAT_FORK),
blockNumber: process.env.HARDHAT_FORK_NUMBER
? parseInt(process.env.HARDHAT_FORK_NUMBER)
: undefined,
}
: undefined,
// allowUnlimitedContractSize: true,
},
ethereumMainnet: {
url: `https://mainnet.infura.io/v3/${INFURA_KEY}`,
accounts: {
mnemonic: MNEMONIC_MAINNET,
},
},
ethereumTestnet: {
url: `https://kovan.infura.io/v3/${INFURA_KEY}`,
accounts: {
mnemonic: MNEMONIC_TESTNET,
},
gasPrice: 2.5 * 1e9,
},
bscTestnet: {
url: `https://data-seed-prebsc-1-s1.binance.org:8545`,
accounts: {
mnemonic: MNEMONIC_TESTNET,
},
},
bscMainnet: {
url: `https://bsc-dataseed1.binance.org/`,
accounts: {
mnemonic: MNEMONIC_MAINNET,
},
// gasPrice: 10 * 1e9,
},
polygonTestnet: {
url: `https://matic-mumbai.chainstacklabs.com/`,
accounts: {
mnemonic: MNEMONIC_TESTNET,
},
},
polygonMainnet: {
url: `https://polygon-rpc.com/`,
accounts: {
mnemonic: MNEMONIC_MAINNET,
},
},
fantomTestnet: {
url: `https://rpc.testnet.fantom.network/`,
accounts: {
mnemonic: MNEMONIC_TESTNET,
},
},
fantomMainnet: {
url: "https://rpc.ftm.tools",
accounts: {
mnemonic: MNEMONIC_MAINNET,
},
},
avalancheTestnet: {
url: `https://api.avax-test.network/ext/bc/C/rpc`,
accounts: {
mnemonic: MNEMONIC_TESTNET,
},
},
avalancheMainnet: {
url: `https://api.avax.network/ext/bc/C/rpc`,
accounts: {
mnemonic: MNEMONIC_MAINNET,
},
},
arbitrumTestnet: {
url: `https://goerli-rollup.arbitrum.io/rpc`,
accounts: {
mnemonic: MNEMONIC_TESTNET,
},
// gasPrice: 0, // https://developer.offchainlabs.com/docs/contract_deployment
// gas: 80000000,
},
arbitrumMainnet: {
url: `https://arb1.arbitrum.io/rpc`,
accounts: {
mnemonic: MNEMONIC_MAINNET,
},
// gasPrice: 0,
// gas: 80000000,
},
goerliTestnet: {
url: `https://goerli.infura.io/v3/${INFURA_KEY}`,
accounts: {
mnemonic: MNEMONIC_TESTNET,
},
gasPrice: 2000000000,
},
moonbeamTestnet: {
url: `https://rpc.api.moonbase.moonbeam.network`,
accounts: {
mnemonic: MNEMONIC_TESTNET,
},
},
moonbeamMainnet: {
url: `https://rpc.api.moonbeam.network`,
accounts: {
mnemonic: MNEMONIC_MAINNET,
},
},
kavaTestnet: {
url: `https://evm.testnet.kava.io`,
accounts: {
mnemonic: MNEMONIC_TESTNET,
},
},
kavaMainnet: {
url: `https://evm.kava.io`,
accounts: {
mnemonic: MNEMONIC_MAINNET,
},
},
optimismTestnet: {
url: `https://goerli.optimism.io`,
accounts: {
mnemonic: MNEMONIC_TESTNET,
},
},
optimismMainnet: {
url: `https://mainnet.optimism.io`,
accounts: {
mnemonic: MNEMONIC_MAINNET,
},
},
},
deterministicDeployment: (network: string) => {
// Skip on hardhat's local network.
if (network === "31337") {
return undefined;
}
return {
factory: "0x2222229fb3318a6375fa78fd299a9a42ac6a8fbf",
deployer: "0x90899d3cc800c0a9196aec83da43e46582cb7435",
// Must be deployed manually. Required funding may be more on
// certain chains (e.g. Ethereum mainnet).
funding: "10000000000000000",
signedTx: "0x00",
};
},
paths: {
sources: "src",
},
gasReporter: {
currency: "USD",
gasPrice: 100,
enabled: process.env.REPORT_GAS ? true : false,
coinmarketcap: process.env.COINMARKETCAP_API_KEY,
maxMethodDiff: 10,
},
typechain: {
outDir: "typechain",
target: "ethers-v5",
},
mocha: {
timeout: 0,
},
etherscan: {
// Your API key for Etherscan
// Obtain one at https://etherscan.io/
apiKey: process.env.BSCSCAN_KEY,
},
};
export default config;