From 232094506ce7de5e789b09120315337178a43444 Mon Sep 17 00:00:00 2001 From: Ayush Tiwari Date: Mon, 15 Jul 2024 18:10:34 +0530 Subject: [PATCH] feat: added network tag and enum --- packages/deploy/hardhat.config.ts | 98 +++++++++++++++++++------------ 1 file changed, 60 insertions(+), 38 deletions(-) diff --git a/packages/deploy/hardhat.config.ts b/packages/deploy/hardhat.config.ts index 11fd5b882f..0e5a435f1e 100644 --- a/packages/deploy/hardhat.config.ts +++ b/packages/deploy/hardhat.config.ts @@ -320,12 +320,34 @@ const namedAccounts = { /** * TAGS: * - mainnet -> production networks (you must pay for gas!!!) - * - L1 -> Layer 1 networks - * - L2 -> Layer 2 networks + * - L1, L1-prod, L1-test -> Layer 1 networks + * - L2, L2-prod, L2-test -> Layer 2 networks */ +enum NETWORKS { + SEPOLIA = 11155111, + MAINNET = 1, + AMOY = 80002, + POLYGON = 137, + BASESEPOLIA = 84532, + BASE = 8453, + BSCTESTNET = 97, + BSCMAINNET = 56, +} + +enum DEPLOY_NETWORKS { + SEPOLIA = 'sepolia', + MAINNET = 'mainnet', + BSCTESTNET = 'bscTestnet', + BSCMAINNET = 'bscMainnet', + AMOY = 'amoy', + POLYGON = 'polygon', + BASESEPOLIA = 'baseSepolia', + BASE = 'base', +} + const networks = { hardhat: { - tags: ['L1', 'L2'], + tags: ['L1', 'L1-prod', 'L1-test', 'L2', 'L2-prod', 'L2-test'], deploy: ['deploy_mocks/', 'deploy/'], companionNetworks: { l1: 'hardhat', @@ -344,66 +366,66 @@ const networks = { l2: 'mumbai', }, }, - sepolia: { - tags: ['L1'], + [DEPLOY_NETWORKS.SEPOLIA]: { + tags: ['L1', 'L1-test'], companionNetworks: { - l2: 'amoy', - bsc: 'bscTestnet', - base: 'baseSepolia', + [NETWORKS.AMOY]: [DEPLOY_NETWORKS.AMOY], + [NETWORKS.BASESEPOLIA]: [DEPLOY_NETWORKS.BASESEPOLIA], + [NETWORKS.BSCTESTNET]: [DEPLOY_NETWORKS.BSCTESTNET], }, }, - mainnet: { - tags: ['mainnet', 'L1'], + [DEPLOY_NETWORKS.MAINNET]: { + tags: ['mainnet', 'L1', 'L1-prod'], companionNetworks: { - l2: 'polygon', - bsc: 'bscMainnet', - base: 'base', + [NETWORKS.POLYGON]: [DEPLOY_NETWORKS.POLYGON], + [NETWORKS.BASE]: [DEPLOY_NETWORKS.BASE], + [NETWORKS.BSCMAINNET]: [DEPLOY_NETWORKS.BSCMAINNET], }, }, - baseSepolia: { - tags: ['L2'], + [DEPLOY_NETWORKS.BSCTESTNET]: { + tags: ['L1', 'L1-test'], companionNetworks: { - ethereum: 'sepolia', - bsc: 'bscTestnet', + [NETWORKS.SEPOLIA]: [DEPLOY_NETWORKS.SEPOLIA], + [NETWORKS.BASESEPOLIA]: [DEPLOY_NETWORKS.BASESEPOLIA], }, }, - base: { - tags: ['L2'], + [DEPLOY_NETWORKS.BSCMAINNET]: { + tags: ['L1', 'L1-prod'], companionNetworks: { - ethereum: 'mainnet', - bsc: 'bscMainnet', + [NETWORKS.MAINNET]: [DEPLOY_NETWORKS.MAINNET], + [NETWORKS.BASE]: [DEPLOY_NETWORKS.BASE], }, }, - bscTestnet: { - tags: ['L1'], + mumbai: { + tags: ['L2'], companionNetworks: { - ethereum: 'sepolia', - base: 'baseSepolia', + l1: 'goerli', }, }, - bscMainnet: { - tags: ['L1'], + [DEPLOY_NETWORKS.AMOY]: { + tags: ['L2', 'L2-test'], companionNetworks: { - ethereum: 'mainnet', - base: 'base', + [NETWORKS.SEPOLIA]: [DEPLOY_NETWORKS.SEPOLIA], }, }, - mumbai: { - tags: ['L2'], + [DEPLOY_NETWORKS.POLYGON]: { + tags: ['L2', 'L2-prod'], companionNetworks: { - l1: 'goerli', + [NETWORKS.MAINNET]: [DEPLOY_NETWORKS.MAINNET], }, }, - amoy: { - tags: ['L2'], + [DEPLOY_NETWORKS.BASESEPOLIA]: { + tags: ['L2', 'L2-test'], companionNetworks: { - l1: 'sepolia', + [NETWORKS.SEPOLIA]: [DEPLOY_NETWORKS.SEPOLIA], + [NETWORKS.BSCTESTNET]: [DEPLOY_NETWORKS.BSCTESTNET], }, }, - polygon: { - tags: ['mainnet', 'L2'], + [DEPLOY_NETWORKS.BASE]: { + tags: ['L2', 'L2-prod'], companionNetworks: { - l1: 'mainnet', + [NETWORKS.MAINNET]: [DEPLOY_NETWORKS.MAINNET], + [NETWORKS.BSCMAINNET]: [DEPLOY_NETWORKS.BSCMAINNET], }, }, };