-
Notifications
You must be signed in to change notification settings - Fork 67
/
hardhat.config.js
284 lines (277 loc) · 6.96 KB
/
hardhat.config.js
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
require("@nomiclabs/hardhat-waffle");
require("@nomiclabs/hardhat-ethers");
require("@nomiclabs/hardhat-etherscan");
require('hardhat-contract-sizer');
const { CHAINS } = require("@pangolindex/sdk");
require("dotenv").config();
const fs = require("fs");
const path = require("path");
// Create hardhat networks from @pangolindex/sdk
let networksFromSdk = {};
for (const chain of Object.values(CHAINS)) {
networksFromSdk[chain.id] = {
url: chain.rpc_uri,
chainId: chain.chain_id,
accounts: [process.env.PRIVATE_KEY],
};
}
networksFromSdk["hardhat"] = {
chainId: 43112,
initialDate: "2021-10-10",
};
// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task("accounts", "Prints the list of accounts", async () => {
const accounts = await ethers.getSigners();
for (const account of accounts) {
console.log(account.address);
}
});
// To learn which networks are defined
task(
"networks",
"Lists all networks defined in the hardhat.config.js file",
async () => {
// Load the hardhat.config.js file
const configFilePath = path.resolve(__dirname, "hardhat.config.js");
const config = require(configFilePath);
// Get the networks defined in the config file
const networks = config.networks;
// Print the name of each network
for (const networkName in networks) {
console.log(networkName);
}
}
);
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: {
compilers: [
{
version: "0.4.16",
},
{
version: "0.5.16",
},
{
version: "0.6.2",
},
{
version: "0.6.6",
settings: {
optimizer: {
enabled: true,
runs: 1000,
},
},
},
{
version: "0.6.12",
},
{
version: "0.7.6",
settings: {
optimizer: {
enabled: true,
runs: 800,
},
},
},
{
version: "0.8.9",
settings: {
optimizer: {
enabled: true,
runs: 1000,
},
},
},
{
version: "0.8.13",
settings: {
optimizer: {
enabled: true,
runs: 2000,
},
},
},
{
version: "0.8.15",
settings: {
optimizer: {
enabled: true,
runs: 2000,
},
},
},
{
version: "0.8.19",
settings: {
optimizer: {
enabled: true,
runs: 2000,
},
},
},
],
overrides: {
"contracts/mini-chef-zapper/MiniChefV2Zapper.sol": {
version: "0.8.11",
},
"contracts/WAVAX.sol": {
version: "0.5.17",
settings: {
// For mocking
outputSelection: {
"*": {
"*": ["storageLayout"],
},
},
},
},
"contracts/WAVAX.sol": {
version: "0.5.17",
settings: {
// For mocking
outputSelection: {
"*": {
"*": ["storageLayout"],
},
},
},
},
"contracts/PangolinV3-periphery/NonfungiblePositionManager.sol": {
version: "0.7.6",
settings: {
optimizer: {
enabled: true,
runs: 20,
},
},
},
},
},
networks: {
hardhat: {
allowUnlimitedContractSize: true,
},
coston: {
url: "https://coston-api.flare.network/ext/bc/C/rpc",
gasPrice: 225000000000,
chainId: 16,
accounts: [
""
]
},
flare: {
url: "https://flare-api.flare.network/ext/C/rpc",
gasPrice: 225000000000,
chainId: 14,
accounts: [
""
]
},
fuji: {
allowUnlimitedContractSize: true,
url: "https://api.avax-test.network/ext/bc/C/rpc",
gasPrice: 225000000000,
chainId: 43113,
accounts: [
""
]
},
avalanche: {
allowUnlimitedContractSize: true,
url: "https://api.avax.network/ext/bc/C/rpc",
gasPrice: 2250000000000,
chainId: 43114,
accounts: [
""
]
},
contractSizer: {
alphaSort: true,
runOnCompile: true,
disambiguatePaths: false,
},
},
etherscan: {
apiKey: {
mainnet: process.env.ETHERSCAN_API_KEY,
ropsten: process.env.ETHERSCAN_API_KEY,
rinkeby: process.env.ETHERSCAN_API_KEY,
goerli: process.env.ETHERSCAN_API_KEY,
kovan: process.env.ETHERSCAN_API_KEY,
// binance smart chain
bsc: process.env.BSCSCAN_API_KEY,
bscTestnet: process.env.BSCSCAN_API_KEY,
// huobi eco chain
heco: process.env.HECOINFO_API_KEY,
hecoTestnet: process.env.HECOINFO_API_KEY,
// fantom mainnet
opera: process.env.FTMSCAN_API_KEY,
ftmTestnet: process.env.FTMSCAN_API_KEY,
// optimism
optimisticEthereum: process.env.OPTIMISTIC_ETHERSCAN_API_KEY,
// optimisticKovan: process.env.OPTIMISTIC_ETHERSCAN_API_KEY, // to avoid the error
// polygon
polygon: process.env.POLYGONSCAN_API_KEY,
polygonMumbai: process.env.POLYGONSCAN_API_KEY,
// arbitrum
arbitrumOne: process.env.ARBISCAN_API_KEY,
arbitrumTestnet: process.env.ARBISCAN_API_KEY,
// avalanche
avalanche: "avalanche",
avalancheFujiTestnet: process.env.SNOWTRACE_API_KEY,
fuji: process.env.SNOWTRACE_API_KEY,
// moonbeam
moonriver: process.env.MOONRIVER_MOONSCAN_API_KEY,
moonbaseAlpha: process.env.MOONBEAM_MOONSCAN_API_KEY,
// xdai and sokol don't need an API key, but you still need
// to specify one; any string placeholder will work
xdai: "api-key",
sokol: "api-key",
flare: "api-key",
coston2: "api-key",
},
// adding support for non-supported explorers
// see Hardhat Docs for additional information
// https://hardhat.org/hardhat-runner/plugins/nomiclabs-hardhat-etherscan#adding-support-for-other-networks
customChains: [
{
network: "flare",
chainId: 14,
urls: {
apiURL: "https://flare-explorer.flare.network/api",
browserURL: "https://flare-explorer.flare.network/",
},
},
{
network: "coston2",
chainId: 114,
urls: {
apiURL: "https://coston2-explorer.flare.network/api",
browserURL: "https://coston2-explorer.flare.network/",
},
},
{
network: "fuji",
chainId: 43113,
urls: {
apiURL: "https://api.avax-test.network/ext/bc/C/rpc",
browserURL: "https://testnet.snowtrace.io/",
},
},
{
network: "avalanche",
chainId: 43114,
urls: {
apiURL: "https://api.routescan.io/v2/network/mainnet/evm/43114/etherscan",
browserURL: "https://avalanche.routescan.io",
},
},
],
},
};