Skip to content

Commit e127a2e

Browse files
authored
chore: Drop @uma/common dependency from hardhat.config.ts (#1088)
1 parent 087f220 commit e127a2e

File tree

1 file changed

+56
-62
lines changed

1 file changed

+56
-62
lines changed

hardhat.config.ts

Lines changed: 56 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import * as dotenv from "dotenv";
2-
32
import { HardhatUserConfig } from "hardhat/config";
4-
import { getNodeUrl, getMnemonic } from "@uma/common";
5-
import { CHAIN_IDs } from "./utils/constants";
3+
import { CHAIN_IDs, PUBLIC_NETWORKS } from "./utils/constants";
64

75
import "@nomicfoundation/hardhat-verify"; // Must be above hardhat-upgrades
86
import "@nomiclabs/hardhat-waffle";
@@ -15,6 +13,25 @@ import "solidity-coverage";
1513
import "hardhat-deploy";
1614
import "@openzeppelin/hardhat-upgrades";
1715

16+
const getNodeUrl = (chainId: number): string => {
17+
let url = process.env[`NODE_URL_${chainId}`] ?? process.env.CUSTOM_NODE_URL;
18+
if (url === undefined) {
19+
// eslint-disable-next-line no-console
20+
console.log(`No configured RPC provider for chain ${chainId}, reverting to public RPC.`);
21+
url = PUBLIC_NETWORKS[chainId].publicRPC;
22+
}
23+
24+
return url;
25+
};
26+
27+
const getMnemonic = () => {
28+
// Publicly-disclosed mnemonic. This is required for hre deployments in test.
29+
const PUBLIC_MNEMONIC = "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat";
30+
const { MNEMONIC = PUBLIC_MNEMONIC } = process.env;
31+
return MNEMONIC;
32+
};
33+
const mnemonic = getMnemonic();
34+
1835
// Custom tasks to add to HRE.
1936
const tasks = [
2037
"enableL1TokenAcrossEcosystem",
@@ -41,7 +58,6 @@ const isTest = process.env.IS_TEST === "true" || process.env.CI === "true";
4158
const compileZk = process.env.COMPILE_ZK === "true";
4259

4360
const solcVersion = "0.8.23";
44-
const mnemonic = getMnemonic();
4561

4662
// Compilation settings are overridden for large contracts to allow them to compile without going over the bytecode
4763
// limit.
@@ -124,15 +140,15 @@ const config: HardhatUserConfig = {
124140
allowUnlimitedContractSize: true,
125141
},
126142
mainnet: {
127-
url: getNodeUrl("mainnet", true, 1),
143+
url: getNodeUrl(CHAIN_IDs.MAINNET),
128144
accounts: { mnemonic },
129145
saveDeployments: true,
130146
chainId: CHAIN_IDs.MAINNET,
131147
companionNetworks: { l1: "mainnet" },
132148
},
133149
zksync: {
134150
chainId: CHAIN_IDs.ZK_SYNC,
135-
url: "https://mainnet.era.zksync.io",
151+
url: getNodeUrl(CHAIN_IDs.ZK_SYNC),
136152
saveDeployments: true,
137153
accounts: { mnemonic },
138154
ethNetwork: "mainnet",
@@ -141,105 +157,99 @@ const config: HardhatUserConfig = {
141157
verifyURL: "https://zksync2-mainnet-explorer.zksync.io/contract_verification",
142158
},
143159
optimism: {
144-
url: getNodeUrl("optimism-mainnet", true, CHAIN_IDs.OPTIMISM),
160+
chainId: CHAIN_IDs.OPTIMISM,
161+
url: getNodeUrl(CHAIN_IDs.OPTIMISM),
145162
accounts: { mnemonic },
146163
saveDeployments: true,
147-
chainId: CHAIN_IDs.OPTIMISM,
148164
companionNetworks: { l1: "mainnet" },
149165
},
150166
"optimism-sepolia": {
151-
url: getNodeUrl("optimism-sepolia", true, CHAIN_IDs.OPTIMISM_SEPOLIA),
167+
chainId: CHAIN_IDs.OPTIMISM_SEPOLIA,
168+
url: getNodeUrl(CHAIN_IDs.OPTIMISM_SEPOLIA),
152169
accounts: { mnemonic },
153170
saveDeployments: true,
154-
chainId: CHAIN_IDs.OPTIMISM_SEPOLIA,
155171
companionNetworks: { l1: "sepolia" },
156172
},
157173
arbitrum: {
158174
chainId: CHAIN_IDs.ARBITRUM,
159-
url: getNodeUrl("arbitrum-mainnet", true, CHAIN_IDs.ARBITRUM),
175+
url: getNodeUrl(CHAIN_IDs.ARBITRUM),
160176
saveDeployments: true,
161177
accounts: { mnemonic },
162178
companionNetworks: { l1: "mainnet" },
163179
},
164180
"arbitrum-sepolia": {
165181
chainId: CHAIN_IDs.ARBITRUM_SEPOLIA,
166-
url: getNodeUrl("arbitrum-sepolia", true, CHAIN_IDs.ARBITRUM_SEPOLIA),
182+
url: getNodeUrl(CHAIN_IDs.ARBITRUM_SEPOLIA),
167183
saveDeployments: true,
168184
accounts: { mnemonic },
169185
companionNetworks: { l1: "sepolia" },
170186
},
171187
sepolia: {
172-
url: `https://sepolia.infura.io/v3/${process.env.INFURA_API_KEY}`,
188+
chainId: CHAIN_IDs.SEPOLIA,
189+
url: getNodeUrl(CHAIN_IDs.SEPOLIA),
173190
accounts: { mnemonic },
174191
saveDeployments: true,
175-
chainId: CHAIN_IDs.SEPOLIA,
176192
companionNetworks: { l1: "sepolia" },
177193
},
178194
polygon: {
179195
chainId: CHAIN_IDs.POLYGON,
180-
url: "https://polygon-rpc.com",
196+
url: getNodeUrl(CHAIN_IDs.POLYGON),
181197
saveDeployments: true,
182198
accounts: { mnemonic },
183199
companionNetworks: { l1: "mainnet" },
184200
},
185201
bsc: {
186-
chainId: 56,
187-
url: "https://bsc-dataseed1.binance.org",
202+
chainId: CHAIN_IDs.BSC,
203+
url: getNodeUrl(CHAIN_IDs.BSC),
188204
saveDeployments: true,
189205
accounts: { mnemonic },
190206
companionNetworks: { l1: "mainnet" },
191207
},
192-
boba: {
193-
chainId: CHAIN_IDs.BOBA,
194-
url: getNodeUrl("boba", true, CHAIN_IDs.BOBA),
195-
accounts: { mnemonic },
196-
companionNetworks: { l1: "mainnet" },
197-
},
198208
"polygon-amoy": {
199209
chainId: CHAIN_IDs.POLYGON_AMOY,
200-
url: "https://rpc-amoy.polygon.technology",
210+
url: getNodeUrl(CHAIN_IDs.POLYGON_AMOY),
201211
saveDeployments: true,
202212
accounts: { mnemonic },
203213
companionNetworks: { l1: "sepolia" },
204214
},
205215
base: {
206216
chainId: CHAIN_IDs.BASE,
207-
url: "https://mainnet.base.org",
217+
url: getNodeUrl(CHAIN_IDs.BASE),
208218
saveDeployments: true,
209219
accounts: { mnemonic },
210220
companionNetworks: { l1: "mainnet" },
211221
},
212222
"base-sepolia": {
213223
chainId: CHAIN_IDs.BASE_SEPOLIA,
214-
url: `https://base-sepolia.infura.io/v3/${process.env.INFURA_API_KEY}`,
224+
url: getNodeUrl(CHAIN_IDs.BASE_SEPOLIA),
215225
saveDeployments: true,
216226
accounts: { mnemonic },
217227
companionNetworks: { l1: "sepolia" },
218228
},
219229
ink: {
220230
chainId: CHAIN_IDs.INK,
221-
url: "https://rpc-gel.inkonchain.com",
231+
url: getNodeUrl(CHAIN_IDs.INK),
222232
saveDeployments: true,
223233
accounts: { mnemonic },
224234
companionNetworks: { l1: "mainnet" },
225235
},
226236
linea: {
227237
chainId: CHAIN_IDs.LINEA,
228-
url: `https://rpc.linea.build`,
238+
url: getNodeUrl(CHAIN_IDs.LINEA),
229239
saveDeployments: true,
230240
accounts: { mnemonic },
231241
companionNetworks: { l1: "mainnet" },
232242
},
233243
scroll: {
234244
chainId: CHAIN_IDs.SCROLL,
235-
url: "https://rpc.scroll.io",
245+
url: getNodeUrl(CHAIN_IDs.SCROLL),
236246
saveDeployments: true,
237247
accounts: { mnemonic },
238248
companionNetworks: { l1: "mainnet" },
239249
},
240250
"scroll-sepolia": {
241251
chainId: CHAIN_IDs.SCROLL_SEPOLIA,
242-
url: "https://sepolia-rpc.scroll.io",
252+
url: getNodeUrl(CHAIN_IDs.SCROLL_SEPOLIA),
243253
saveDeployments: true,
244254
accounts: { mnemonic },
245255
companionNetworks: { l1: "sepolia" },
@@ -260,29 +270,29 @@ const config: HardhatUserConfig = {
260270
},
261271
mode: {
262272
chainId: CHAIN_IDs.MODE,
263-
url: "https://mainnet.mode.network",
273+
url: getNodeUrl(CHAIN_IDs.MODE),
264274
saveDeployments: true,
265275
accounts: { mnemonic },
266276
companionNetworks: { l1: "mainnet" },
267277
},
268278
"mode-sepolia": {
269279
chainId: CHAIN_IDs.MODE_SEPOLIA,
270-
url: "https://sepolia.mode.network",
280+
url: getNodeUrl(CHAIN_IDs.MODE_SEPOLIA),
271281
saveDeployments: true,
272282
accounts: { mnemonic },
273283
companionNetworks: { l1: "sepolia" },
274284
},
275285
tatara: {
276286
chainId: CHAIN_IDs.TATARA,
277-
url: "https://rpc.tatara.katanarpc.com/<apikey>",
287+
url: getNodeUrl(CHAIN_IDs.TATARA),
278288
saveDeployments: true,
279289
accounts: { mnemonic },
280290
companionNetworks: { l1: "sepolia" },
281291
ethNetwork: "sepolia",
282292
},
283293
lens: {
284294
chainId: CHAIN_IDs.LENS,
285-
url: "https://api.lens.matterhosted.dev",
295+
url: getNodeUrl(CHAIN_IDs.LENS),
286296
saveDeployments: true,
287297
accounts: { mnemonic },
288298
companionNetworks: { l1: "mainnet" },
@@ -292,7 +302,7 @@ const config: HardhatUserConfig = {
292302
},
293303
"lens-sepolia": {
294304
chainId: CHAIN_IDs.LENS_SEPOLIA,
295-
url: "https://rpc.testnet.lens.dev",
305+
url: getNodeUrl(CHAIN_IDs.LENS_SEPOLIA),
296306
saveDeployments: true,
297307
accounts: { mnemonic },
298308
companionNetworks: { l1: "sepolia" },
@@ -302,84 +312,77 @@ const config: HardhatUserConfig = {
302312
},
303313
lisk: {
304314
chainId: CHAIN_IDs.LISK,
305-
url: "https://rpc.api.lisk.com",
315+
url: getNodeUrl(CHAIN_IDs.LISK),
306316
saveDeployments: true,
307317
accounts: { mnemonic },
308318
companionNetworks: { l1: "mainnet" },
309319
},
310320
"lisk-sepolia": {
311321
chainId: CHAIN_IDs.LISK_SEPOLIA,
312-
url: "https://rpc.sepolia-api.lisk.com",
322+
url: getNodeUrl(CHAIN_IDs.LISK_SEPOLIA),
313323
saveDeployments: true,
314324
accounts: { mnemonic },
315325
companionNetworks: { l1: "sepolia" },
316326
},
317327
redstone: {
318328
chainId: CHAIN_IDs.REDSTONE,
319-
url: "https://rpc.redstonechain.com",
329+
url: getNodeUrl(CHAIN_IDs.REDSTONE),
320330
saveDeployments: true,
321331
accounts: { mnemonic },
322332
companionNetworks: { l1: "mainnet" },
323333
},
324334
blast: {
325335
chainId: CHAIN_IDs.BLAST,
326-
url: "https://rpc.blast.io",
336+
url: getNodeUrl(CHAIN_IDs.BLAST),
327337
saveDeployments: true,
328338
accounts: { mnemonic },
329339
companionNetworks: { l1: "mainnet" },
330340
},
331341
"blast-sepolia": {
332342
chainId: CHAIN_IDs.BLAST_SEPOLIA,
333-
url: "https://sepolia.blast.io",
343+
url: getNodeUrl(CHAIN_IDs.BLAST_SEPOLIA),
334344
saveDeployments: true,
335345
accounts: { mnemonic },
336346
companionNetworks: { l1: "sepolia" },
337347
},
338348
worldchain: {
339349
chainId: CHAIN_IDs.WORLD_CHAIN,
340-
url: "https://worldchain-mainnet.g.alchemy.com/public",
350+
url: getNodeUrl(CHAIN_IDs.WORLD_CHAIN),
341351
saveDeployments: true,
342352
accounts: { mnemonic },
343353
companionNetworks: { l1: "mainnet" },
344354
},
345355
zora: {
346356
chainId: CHAIN_IDs.ZORA,
347-
url: "https://rpc.zora.energy",
348-
saveDeployments: true,
349-
accounts: { mnemonic },
350-
companionNetworks: { l1: "mainnet" },
351-
},
352-
alephzero: {
353-
chainId: CHAIN_IDs.ALEPH_ZERO,
354-
url: "https://rpc.alephzero.raas.gelato.cloud",
357+
url: getNodeUrl(CHAIN_IDs.ZORA),
355358
saveDeployments: true,
356359
accounts: { mnemonic },
357360
companionNetworks: { l1: "mainnet" },
358361
},
359362
soneium: {
360363
chainId: CHAIN_IDs.SONEIUM,
361-
url: "https://soneium.drpc.org",
364+
url: getNodeUrl(CHAIN_IDs.SONEIUM),
362365
saveDeployments: true,
363366
accounts: { mnemonic },
364367
companionNetworks: { l1: "mainnet" },
365368
},
366369
unichain: {
367370
chainId: CHAIN_IDs.UNICHAIN,
368-
url: "https://mainnet.unichain.org",
371+
url: getNodeUrl(CHAIN_IDs.UNICHAIN),
369372
saveDeployments: true,
370373
accounts: { mnemonic },
371374
companionNetworks: { l1: "mainnet" },
372375
},
373376
"unichain-sepolia": {
374377
chainId: CHAIN_IDs.UNICHAIN_SEPOLIA,
375-
url: "https://sepolia.unichain.org",
378+
url: getNodeUrl(CHAIN_IDs.UNICHAIN_SEPOLIA),
376379
saveDeployments: true,
377380
accounts: { mnemonic },
378381
companionNetworks: { l1: "sepolia" },
379382
},
380383
"bob-sepolia": {
381384
chainId: CHAIN_IDs.BOB_SEPOLIA,
382-
url: "https://bob-sepolia.rpc.gobob.xyz",
385+
url: getNodeUrl(CHAIN_IDs.BOB_SEPOLIA),
383386
saveDeployments: true,
384387
accounts: { mnemonic },
385388
companionNetworks: { l1: "sepolia" },
@@ -414,22 +417,13 @@ const config: HardhatUserConfig = {
414417
"blast-sepolia": process.env.BLAST_ETHERSCAN_API_KEY!,
415418
zora: "routescan",
416419
worldchain: "blockscout",
417-
alephzero: "blockscout",
418420
ink: "blockscout",
419421
soneium: "blockscout",
420422
unichain: process.env.UNICHAIN_ETHERSCAN_API_KEY!,
421423
"unichain-sepolia": process.env.UNICHAIN_ETHERSCAN_API_KEY!,
422424
"bob-sepolia": "blockscout",
423425
},
424426
customChains: [
425-
{
426-
network: "alephzero",
427-
chainId: CHAIN_IDs.ALEPH_ZERO,
428-
urls: {
429-
apiURL: "https://evm-explorer.alephzero.org/api",
430-
browserURL: "https://evm-explorer.alephzero.org",
431-
},
432-
},
433427
{
434428
network: "base",
435429
chainId: CHAIN_IDs.BASE,

0 commit comments

Comments
 (0)