Skip to content

Commit 2af0846

Browse files
author
Andres Adjimann
committed
feat: use a specific tag to geneate random secrets during landsale
1 parent 79433cb commit 2af0846

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

packages/deploy/hardhat.config.ts

+32-6
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ export enum DEPLOY_TAGS {
365365
L2 = 'L2', // Layer two networks like Polygon, mumbai
366366
L2_PROD = 'L2-prod', // Layer two production networks like Polygon
367367
L2_TEST = 'L2-test', // Layer two test networks like Mumbai
368+
GENERATE_RANDOM_SECRET = 'generate_random_secret', // during landsales generate a random secret
368369
}
369370

370371
const networks = {
@@ -376,6 +377,7 @@ const networks = {
376377
DEPLOY_TAGS.L2,
377378
DEPLOY_TAGS.L2_PROD,
378379
DEPLOY_TAGS.L2_TEST,
380+
DEPLOY_TAGS.GENERATE_RANDOM_SECRET,
379381
],
380382
deploy: ['deploy_mocks/', 'deploy/'],
381383
companionNetworks: {
@@ -387,14 +389,22 @@ const networks = {
387389
parseInt(process.env.HARDHAT_BLOCK_GAS_LIMIT || '0') || 30000000,
388390
},
389391
[DEPLOY_NETWORKS.ETH_GOERLI]: {
390-
tags: [DEPLOY_TAGS.L1, DEPLOY_TAGS.L1_TEST],
392+
tags: [
393+
DEPLOY_TAGS.L1,
394+
DEPLOY_TAGS.L1_TEST,
395+
DEPLOY_TAGS.GENERATE_RANDOM_SECRET,
396+
],
391397
// gasPrice: 600000000000, // Uncomment in case of pending txs, and adjust gas
392398
companionNetworks: {
393399
[DEPLOY_NETWORKS.MUMBAI]: DEPLOY_NETWORKS.MUMBAI,
394400
},
395401
},
396402
[DEPLOY_NETWORKS.ETH_SEPOLIA]: {
397-
tags: [DEPLOY_TAGS.L1, DEPLOY_TAGS.L1_PROD],
403+
tags: [
404+
DEPLOY_TAGS.L1,
405+
DEPLOY_TAGS.L1_PROD,
406+
DEPLOY_TAGS.GENERATE_RANDOM_SECRET,
407+
],
398408
companionNetworks: {
399409
[DEPLOY_NETWORKS.AMOY]: DEPLOY_NETWORKS.AMOY,
400410
[DEPLOY_NETWORKS.BASE_MAINNET]: DEPLOY_NETWORKS.BASE_SEPOLIA,
@@ -410,7 +420,11 @@ const networks = {
410420
},
411421
},
412422
[DEPLOY_NETWORKS.BSC_TESTNET]: {
413-
tags: [DEPLOY_TAGS.L1, DEPLOY_TAGS.L1_TEST],
423+
tags: [
424+
DEPLOY_TAGS.L1,
425+
DEPLOY_TAGS.L1_TEST,
426+
DEPLOY_TAGS.GENERATE_RANDOM_SECRET,
427+
],
414428
companionNetworks: {
415429
[DEPLOY_NETWORKS.ETH_MAINNET]: DEPLOY_NETWORKS.ETH_SEPOLIA,
416430
[DEPLOY_NETWORKS.BASE_MAINNET]: DEPLOY_NETWORKS.BASE_SEPOLIA,
@@ -424,13 +438,21 @@ const networks = {
424438
},
425439
},
426440
[DEPLOY_NETWORKS.MUMBAI]: {
427-
tags: [DEPLOY_TAGS.L2, DEPLOY_TAGS.L2_TEST],
441+
tags: [
442+
DEPLOY_TAGS.L2,
443+
DEPLOY_TAGS.L2_TEST,
444+
DEPLOY_TAGS.GENERATE_RANDOM_SECRET,
445+
],
428446
companionNetworks: {
429447
[DEPLOY_NETWORKS.ETH_GOERLI]: DEPLOY_NETWORKS.ETH_GOERLI,
430448
},
431449
},
432450
[DEPLOY_NETWORKS.AMOY]: {
433-
tags: [DEPLOY_TAGS.L2, DEPLOY_TAGS.L2_TEST],
451+
tags: [
452+
DEPLOY_TAGS.L2,
453+
DEPLOY_TAGS.L2_TEST,
454+
DEPLOY_TAGS.GENERATE_RANDOM_SECRET,
455+
],
434456
companionNetworks: {
435457
[DEPLOY_NETWORKS.ETH_SEPOLIA]: DEPLOY_NETWORKS.ETH_SEPOLIA,
436458
},
@@ -442,7 +464,11 @@ const networks = {
442464
},
443465
},
444466
[DEPLOY_NETWORKS.BASE_SEPOLIA]: {
445-
tags: [DEPLOY_TAGS.L2, DEPLOY_TAGS.L2_TEST],
467+
tags: [
468+
DEPLOY_TAGS.L2,
469+
DEPLOY_TAGS.L2_TEST,
470+
DEPLOY_TAGS.GENERATE_RANDOM_SECRET,
471+
],
446472
companionNetworks: {
447473
[DEPLOY_NETWORKS.ETH_MAINNET]: DEPLOY_NETWORKS.ETH_SEPOLIA,
448474
[DEPLOY_NETWORKS.BSC_MAINNET]: DEPLOY_NETWORKS.BSC_TESTNET,

packages/deploy/land-sale-artifacts/getLandSales.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export type SectorData = {
5454
const sandboxWallet = addresses['sandbox'];
5555

5656
let errors = false;
57+
5758
// eslint-disable-next-line @typescript-eslint/no-explicit-any
5859
function reportError(e: any) {
5960
errors = true;
@@ -315,7 +316,7 @@ export async function getLandSaleFiles(
315316
'0x4467363716526536535425451427798982881775318563547751090997863683';
316317
} else {
317318
secret = loadSecret(secretPath);
318-
if (!secret && hre.network.tags.mainnet)
319+
if (!secret && !hre.network.tags.generate_random_secret)
319320
throw new Error(`LandPreSale secret not found.`);
320321
else secret = generateSecret(secretPath);
321322
}
@@ -336,6 +337,7 @@ function loadSecret(path: string) {
336337

337338
function generateSecret(path: string) {
338339
const secret = ethers.Wallet.createRandom().privateKey.toString();
340+
console.warn(`WARN: writing secret file ${path} !!!`);
339341
fs.writeFileSync(path, secret);
340342
return secret;
341343
}

0 commit comments

Comments
 (0)