From 7716ab122365da4bce838c82b7cd8c3ed6d01b06 Mon Sep 17 00:00:00 2001 From: Michael Standen Date: Fri, 7 Jul 2023 12:11:56 +1200 Subject: [PATCH] Update deployment files --- hardhat.config.ts | 5 +-- networks/arbitrumGoerli.json | 22 ++++++++++ utils/config-loader.ts | 84 ++++++++++++++++++++---------------- 3 files changed, 72 insertions(+), 39 deletions(-) create mode 100644 networks/arbitrumGoerli.json diff --git a/hardhat.config.ts b/hardhat.config.ts index 13cf12de..80ed4a30 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -23,21 +23,20 @@ const config: HardhatUserConfig = { settings: { optimizer: { enabled: true, - runs: 500000 + runs: 500000, } } }, networks: { mainnet: networkConfig('mainnet'), ropsten: networkConfig('ropsten'), - rinkeby: networkConfig('rinkeby'), kovan: networkConfig('kovan'), goerli: networkConfig('goerli'), polygon: networkConfig('polygon'), polygonZkevm: networkConfig('polygon-zkevm'), mumbai: networkConfig('mumbai'), arbitrum: networkConfig('arbitrum'), - arbitrumTestnet: networkConfig('arbitrum-testnet'), + arbitrumGoerli: networkConfig('arbitrum-goerli'), arbitrumNova: networkConfig('arbitrum-nova'), optimism: networkConfig('optimism'), bnb: networkConfig('bnb'), diff --git a/networks/arbitrumGoerli.json b/networks/arbitrumGoerli.json new file mode 100644 index 00000000..d9273250 --- /dev/null +++ b/networks/arbitrumGoerli.json @@ -0,0 +1,22 @@ +[ + { + "contractName": "WalletFactory", + "address": "0xFaA5c0b14d1bED5C888Ca655B9a8A5911F78eF4A" + }, + { + "contractName": "MainModule", + "address": "0xfBf8f1A5E00034762D928f46d438B947f5d4065d" + }, + { + "contractName": "MainModuleUpgradable", + "address": "0x4222dcA3974E39A8b41c411FeDDE9b09Ae14b911" + }, + { + "contractName": "GuestModule", + "address": "0xfea230Ee243f88BC698dD8f1aE93F8301B6cdfaE" + }, + { + "contractName": "SequenceUtils", + "address": "0xdbbFa3cB3B087B64F4ef5E3D20Dda2488AA244e6" + } +] \ No newline at end of file diff --git a/utils/config-loader.ts b/utils/config-loader.ts index dc03d07c..319707ef 100644 --- a/utils/config-loader.ts +++ b/utils/config-loader.ts @@ -3,7 +3,23 @@ import * as path from 'path' import { HttpNetworkConfig } from 'hardhat/types' import { ethers } from 'ethers' -type EthereumNetworksTypes = 'rinkeby' | 'ropsten' | 'kovan' | 'goerli' | 'mainnet' | 'mumbai' | 'polygon' | 'arbitrum' | 'arbitrum-testnet' | 'arbitrum-nova' | 'optimism' | 'bnb' | 'gnosis' | 'polygon-zkevm' | 'avalanche' | 'bnb-testnet' | 'avalanche-fuji' +type EthereumNetworksTypes = + | 'mainnet' + | 'ropsten' + | 'kovan' + | 'goerli' + | 'polygon' + | 'polygon-zkevm' + | 'mumbai' + | 'arbitrum' + | 'arbitrum-goerli' + | 'arbitrum-nova' + | 'optimism' + | 'bnb' + | 'bnb-testnet' + | 'gnosis' + | 'avalanche' + | 'avalanche-fuji' export const getEnvConfig = (env: string) => { const envFile = path.resolve(__dirname, `../config/${env}.env`) @@ -34,12 +50,15 @@ export const networkRpcUrl = (network: EthereumNetworksTypes): string => { case 'polygon': return 'https://nodes.sequence.app/polygon' - case 'arbitrum-testnet': - return 'https://rinkeby.arbitrum.io/rpc' + case 'polygon-zkevm': + return 'https://zkevm-rpc.com' case 'arbitrum': return 'https://endpoints.omniatech.io/v1/arbitrum/one/public' - + + case 'arbitrum-goerli': + return 'https://goerli-rollup.arbitrum.io/rpc' + case 'arbitrum-nova': return 'https://nova.arbitrum.io/rpc' @@ -49,18 +68,15 @@ export const networkRpcUrl = (network: EthereumNetworksTypes): string => { case 'bnb': return 'https://bsc-dataseed3.binance.org' + case 'bnb-testnet': + return 'https://endpoints.omniatech.io/v1/bsc/testnet/public' + case 'gnosis': return 'https://gnosis-mainnet.public.blastapi.io' - case 'polygon-zkevm': - return 'https://zkevm-rpc.com' - case 'avalanche': return 'https://endpoints.omniatech.io/v1/avax/mainnet/public' - case 'bnb-testnet': - return 'https://endpoints.omniatech.io/v1/bsc/testnet/public' - case 'avalanche-fuji': return 'https://endpoints.omniatech.io/v1/avax/fuji/public' @@ -70,35 +86,33 @@ export const networkRpcUrl = (network: EthereumNetworksTypes): string => { } export const networkChainId = (network: EthereumNetworksTypes): number => { - const config = getEnvConfig('PROD') - switch (network) { - case 'mumbai': - return 80001 + case 'mainnet': + return 1 case 'ropsten': return 3 + case 'goerli': + return 5 + + case 'kovan': + return 42 + + case 'mumbai': + return 80001 + case 'polygon': return 137 - case 'arbitrum-testnet': - return 421611 + case 'polygon-zkevm': + return 1101 case 'arbitrum': return 42161 - case 'rinkeby': - return 4 - - case 'goerli': - return 5 - - case 'mainnet': - return 1 - - case 'kovan': - return 42 + case 'arbitrum-goerli': + return 421613 case 'arbitrum-nova': return 42170 @@ -109,30 +123,28 @@ export const networkChainId = (network: EthereumNetworksTypes): number => { case 'bnb': return 56 + case 'bnb-testnet': + return 97 + case 'gnosis': return 100 - case 'polygon-zkevm': - return 1101 - case 'avalanche': return 43114 - case 'bnb-testnet': - return 97 - case 'avalanche-fuji': return 43113 } } export const networkConfig = (network: EthereumNetworksTypes): HttpNetworkConfig & { etherscan?: string } => { - const config = getEnvConfig('PROD') + const prodConfig = getEnvConfig('PROD') + const networkConfig = getEnvConfig(network) return { url: networkRpcUrl(network), chainId: networkChainId(network), accounts: { - mnemonic: config['ETH_MNEMONIC'], + mnemonic: networkConfig['ETH_MNEMONIC'] ?? prodConfig['ETH_MNEMONIC'], initialIndex: 0, count: 10, path: `m/44'/60'/0'/0`, @@ -143,6 +155,6 @@ export const networkConfig = (network: EthereumNetworksTypes): HttpNetworkConfig gasMultiplier: networkGasMultiplier(network), timeout: 20000, httpHeaders: {}, - etherscan: config['ETHERSCAN'] + etherscan: networkConfig['ETHERSCAN'] ?? prodConfig['ETHERSCAN'] } }