-
Notifications
You must be signed in to change notification settings - Fork 15
/
hardhat.config.cts
303 lines (293 loc) · 8.57 KB
/
hardhat.config.cts
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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
// This file has a .cts extension, because Hardhat that's currently the only way to get
// hardhat to support ESM in TypeScript projects.
// See: https://hardhat.org/hardhat-runner/docs/advanced/using-esm
// And: https://github.com/NomicFoundation/hardhat/issues/3385
import { type HardhatUserConfig } from "hardhat/config";
import "hardhat-contract-sizer";
import "hardhat-deploy";
import "@nomicfoundation/hardhat-verify";
import "@okxweb3/hardhat-explorer-verify";
// Retrieve deployer private key from secrets.json (if available)
let deployerPrivateKey: string | undefined;
try {
const secrets = require("./secrets.json");
deployerPrivateKey = secrets.CONTRACT_DEPLOYER_PRIVATE_KEY;
} catch (e) {}
// Retrieve Lineascan API key from secrets.json (if available)
let lineascanApiKey: string | undefined;
try {
const secrets = require("./secrets.json");
lineascanApiKey = secrets.LINEASCAN_API_KEY;
} catch (e) {}
// Retrive Arbiscan API key from secrets.json (if available)
let arbiscanApiKey: string | undefined;
try {
const secrets = require("./secrets.json");
arbiscanApiKey = secrets.ARBISCAN_API_KEY;
} catch (e) {}
// Retrive Mainnet API key from secrets.json (if available)
let mainnetApiKey: string | undefined;
try {
const secrets = require("./secrets.json");
mainnetApiKey = secrets.ETHERSCAN_API_KEY;
} catch (e) {}
// Retrive BaseScan API key from secrets.json (if available)
let basescanApiKey: string | undefined;
try {
const secrets = require("./secrets.json");
basescanApiKey = secrets.BASESCAN_API_KEY;
} catch (e) {}
// Retrive BaseScan API key from secrets.json (if available)
let okxscanApiKey: string | undefined;
try {
const secrets = require("./secrets.json");
okxscanApiKey = secrets.OKXSCAN_API_KEY;
} catch (e) {}
// Retrive Mainnet RPC URL from secrets.json (if available)
let MAINNET_RPC_URL: string | undefined;
try {
const secrets = require("./secrets.json");
MAINNET_RPC_URL = secrets.MAINNET_RPC_URL;
} catch (e) {}
const config: HardhatUserConfig = {
solidity: {
compilers: [
// {
// version: "0.8.10",
// settings: {
// optimizer: {
// enabled: true,
// runs: 200,
// },
// },
// },
{
version: "0.8.18",
settings: {
evmVersion: "london",
optimizer: {
enabled: true,
runs: 100,
},
},
},
],
},
paths: {
sources: "./contracts/src",
cache: "./contracts/hardhat/cache",
artifacts: "./contracts/hardhat/artifacts",
deploy: "./contracts/hardhat/deploy",
deployments: "./contracts/hardhat/deployments",
},
namedAccounts: {
deployer: {
default: 0,
},
},
networks: {
hardhat: {
// Is used to fix gas estimation error
// See: https://github.com/NomicFoundation/hardhat/issues/3089#issuecomment-1366428941
chainId: 31337,
initialBaseFeePerGas: 0,
deploy: ["./contracts/hardhat/mainnet-deploy"],
saveDeployments: true,
},
mainnet: {
chainId: 1,
url: MAINNET_RPC_URL,
accounts: deployerPrivateKey ? [deployerPrivateKey] : [],
saveDeployments: true,
deploy: ["./contracts/hardhat/mainnet-deploy"],
verify: {
etherscan: {
apiKey: mainnetApiKey,
apiUrl: "https://api.etherscan.io",
},
},
},
linea: {
chainId: 59144,
url: "https://linea-mainnet.infura.io/v3/05368c74554249babb6f126ccf325401",
accounts: deployerPrivateKey ? [deployerPrivateKey] : [],
deploy: ["./contracts/hardhat/linea-mainnet-deploy"],
saveDeployments: true,
verify: {
etherscan: {
apiKey: lineascanApiKey,
apiUrl: "https://api.lineascan.build",
},
},
},
sepolia: {
chainId: 11155111,
url: "https://eth-sepolia.g.alchemy.com/v2/-papiHFcZc0tr4XSPsnwE0bhdTKLetjg",
accounts: deployerPrivateKey ? [deployerPrivateKey] : [],
saveDeployments: true,
verify: {
etherscan: {
apiKey: mainnetApiKey,
apiUrl: "https://api-sepolia.etherscan.io",
},
},
},
lineaGoerli: {
chainId: 59140,
url: "https://linea-goerli.infura.io/v3/05368c74554249babb6f126ccf325401",
accounts: deployerPrivateKey ? [deployerPrivateKey] : [],
saveDeployments: true,
},
arbitrum: {
chainId: 42161,
url: "https://arbitrum-mainnet.infura.io/v3/05368c74554249babb6f126ccf325401",
accounts: deployerPrivateKey ? [deployerPrivateKey] : [],
deploy: ["./contracts/hardhat/arbi-mainnet-deploy"],
saveDeployments: true,
verify: {
etherscan: {
apiKey: arbiscanApiKey,
apiUrl: "https://api.arbiscan.io/",
},
},
},
arbitrumSepolia: {
chainId: 421614,
url: "https://arb-sepolia.g.alchemy.com/v2/_976nGRu_17y8mA3ywVTwBsmNAbE2NL1",
accounts: deployerPrivateKey ? [deployerPrivateKey] : [],
saveDeployments: true,
verify: {
etherscan: {
apiKey: arbiscanApiKey,
apiUrl: "https://api-sepolia.arbiscan.io",
},
},
},
arbitrumGoerli: {
chainId: 421613,
url: "https://arbitrum-goerli.infura.io/v3/05368c74554249babb6f126ccf325401",
accounts: deployerPrivateKey ? [deployerPrivateKey] : [],
saveDeployments: true,
},
base: {
chainId: 8453,
url: "https://base-mainnet.g.alchemy.com/v2/Ui4vv-Z6n-6lAyB9spGYJL1pV3MDNnTh",
accounts: deployerPrivateKey ? [deployerPrivateKey] : [],
saveDeployments: true,
verify: {
etherscan: {
apiKey: basescanApiKey,
apiUrl: "https://api.basescan.org",
},
},
},
baseSepolia: {
chainId: 84532,
url: "https://base-sepolia.g.alchemy.com/v2/spQc9SK_L-lIL2tJpYXuhLk2YJNwbuEr",
accounts: deployerPrivateKey ? [deployerPrivateKey] : [],
saveDeployments: true,
verify: {
etherscan: {
apiKey: basescanApiKey,
apiUrl: "https://api-sepolia.basescan.org",
},
},
},
xlayer: {
chainId: 196,
url: "https://rpc.xlayer.tech",
accounts: deployerPrivateKey ? [deployerPrivateKey] : [],
saveDeployments: true,
verify: {
etherscan: {
apiKey: okxscanApiKey,
apiUrl:
"https://www.oklink.com/api/v5/explorer/contract/verify-source-code-plugin/XLAYER",
},
},
},
xlayer_testnet: {
chainId: 195,
url: "https://testrpc.xlayer.tech",
accounts: deployerPrivateKey ? [deployerPrivateKey] : [],
saveDeployments: true,
verify: {
etherscan: {
apiKey: okxscanApiKey,
apiUrl:
"https://www.oklink.com/api/v5/explorer/contract/verify-source-code-plugin/XLAYER_TESTNET",
},
},
},
},
etherscan: {
apiKey: {
mainnet: mainnetApiKey!,
sepolia: mainnetApiKey!,
linea: lineascanApiKey!,
arbitrumOne: arbiscanApiKey!,
arbitrumSepolia: arbiscanApiKey!,
base: basescanApiKey!,
baseSepolia: basescanApiKey!,
xlayer: okxscanApiKey!,
xlayer_testnet: okxscanApiKey!,
},
customChains: [
{
network: "xlayer_testnet",
chainId: 195,
urls: {
apiURL:
"https://www.oklink.com/api/v5/explorer/contract/verify-source-code-plugin/XLAYER_TESTNET",
browserURL: "https://www.oklink.com/xlayer-test",
},
},
{
network: "xlayer",
chainId: 196,
urls: {
apiURL:
"https://www.oklink.com/api/v5/explorer/contract/verify-source-code-plugin/XLAYER",
browserURL: "https://www.oklink.com/xlayer",
},
},
{
network: "linea",
chainId: 59144,
urls: {
apiURL: "https://api.lineascan.build/api",
browserURL: "https://lineascan.build",
},
},
{
network: "base",
chainId: 8453,
urls: {
apiURL: "https://api.basescan.org/api",
browserURL: "https://basescan.org",
},
},
{
network: "baseSepolia",
chainId: 84532,
urls: {
apiURL: "https://api-sepolia.basescan.org/api",
browserURL: "https://sepolia.basescan.org",
},
},
{
network: "arbitrumSepolia",
chainId: 421614,
urls: {
apiURL: "https://api-sepolia.arbiscan.io/api",
browserURL: "https://sepolia.arbiscan.io/",
},
},
],
},
okxweb3explorer: {
apiKey: okxscanApiKey,
},
defaultNetwork: "hardhat",
};
export default config;