Skip to content

Commit

Permalink
Update deployment files
Browse files Browse the repository at this point in the history
  • Loading branch information
ScreamingHawk committed Jul 7, 2023
1 parent 3b0ea33 commit 7716ab1
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 39 deletions.
5 changes: 2 additions & 3 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
22 changes: 22 additions & 0 deletions networks/arbitrumGoerli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
{
"contractName": "WalletFactory",
"address": "0xFaA5c0b14d1bED5C888Ca655B9a8A5911F78eF4A"
},
{
"contractName": "MainModule",
"address": "0xfBf8f1A5E00034762D928f46d438B947f5d4065d"
},
{
"contractName": "MainModuleUpgradable",
"address": "0x4222dcA3974E39A8b41c411FeDDE9b09Ae14b911"
},
{
"contractName": "GuestModule",
"address": "0xfea230Ee243f88BC698dD8f1aE93F8301B6cdfaE"
},
{
"contractName": "SequenceUtils",
"address": "0xdbbFa3cB3B087B64F4ef5E3D20Dda2488AA244e6"
}
]
84 changes: 48 additions & 36 deletions utils/config-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down Expand Up @@ -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'

Expand All @@ -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'

Expand All @@ -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
Expand All @@ -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`,
Expand All @@ -143,6 +155,6 @@ export const networkConfig = (network: EthereumNetworksTypes): HttpNetworkConfig
gasMultiplier: networkGasMultiplier(network),
timeout: 20000,
httpHeaders: {},
etherscan: config['ETHERSCAN']
etherscan: networkConfig['ETHERSCAN'] ?? prodConfig['ETHERSCAN']
}
}

0 comments on commit 7716ab1

Please sign in to comment.