From cb0ab8b526c2795599156d0e49adbe1c37160565 Mon Sep 17 00:00:00 2001 From: Yehor Podporinov Date: Mon, 22 Jan 2024 11:17:50 +0200 Subject: [PATCH] refactoring: config.IS_TESTNET -> config.IS_MAINNET --- src/common/WalletBalances.vue | 4 ++-- src/common/modals/compositions/ClaimModal.vue | 1 + src/common/modals/compositions/InvalidNetworkModal.vue | 4 ++-- src/config.ts | 3 +-- src/enums/chains.enum.ts | 2 +- src/env.d.ts | 2 +- src/forms/DepositForm.vue | 2 +- src/pages/HomePage/views/CodersView.vue | 2 +- src/pages/HomePage/views/CommunityView.vue | 2 +- src/store/modules/web3-providers.module.ts | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/common/WalletBalances.vue b/src/common/WalletBalances.vue index 56f91fc..33f78a1 100644 --- a/src/common/WalletBalances.vue +++ b/src/common/WalletBalances.vue @@ -65,13 +65,13 @@ type Balance = { const { contractWithProvider: stEth } = useContract( 'ERC20__factory', config.STETH_CONTRACT_ADDRESS, - !config.IS_TESTNET ? ETHEREUM_RPC_URLS.ethereum : ETHEREUM_RPC_URLS.sepolia, + config.IS_MAINNET ? ETHEREUM_RPC_URLS.ethereum : ETHEREUM_RPC_URLS.sepolia, ) const { contractWithProvider: mor } = useContract( 'ERC20__factory', config.MOR_CONTRACT_ADDRESS, - !config.IS_TESTNET + config.IS_MAINNET ? ETHEREUM_RPC_URLS.arbitrum : ETHEREUM_RPC_URLS.arbitrumSepolia, ) diff --git a/src/common/modals/compositions/ClaimModal.vue b/src/common/modals/compositions/ClaimModal.vue index a307dd3..d98dad6 100644 --- a/src/common/modals/compositions/ClaimModal.vue +++ b/src/common/modals/compositions/ClaimModal.vue @@ -80,6 +80,7 @@ const claim = async (): Promise => { props.poolId, web3ProvidersStore.provider.selectedAddress, { + // TODO: estimate by LayerZero value: parseUnits('0.02', 'ether'), }, ) diff --git a/src/common/modals/compositions/InvalidNetworkModal.vue b/src/common/modals/compositions/InvalidNetworkModal.vue index 823e6a6..785cd3a 100644 --- a/src/common/modals/compositions/InvalidNetworkModal.vue +++ b/src/common/modals/compositions/InvalidNetworkModal.vue @@ -8,7 +8,7 @@ >
@@ -89,7 +89,7 @@ const testNetworks: Network[] = [ const switchNetwork = async () => { try { await web3ProvidersStore.provider.selectChain( - !config.IS_TESTNET + config.IS_MAINNET ? ETHEREUM_CHAINS.arbitrum : ETHEREUM_CHAINS.arbitrumSepolia, ) diff --git a/src/config.ts b/src/config.ts index ebd8780..c104152 100644 --- a/src/config.ts +++ b/src/config.ts @@ -10,12 +10,11 @@ export const config = { .VITE_APP_ERC1967_PROXY_CONTRACT_ADDRESS, STETH_CONTRACT_ADDRESS: import.meta.env.VITE_APP_STETH_CONTRACT_ADDRESS, MOR_CONTRACT_ADDRESS: import.meta.env.VITE_APP_MOR_CONTRACT_ADDRESS, - IS_TESTNET: import.meta.env.VITE_APP_IS_TESTNET === 'true', + IS_MAINNET: import.meta.env.VITE_APP_IS_MAINNET === 'true', LOG_LEVEL: 'trace' as LogLevelDesc, BUILD_VERSION: packageJson.version || import.meta.env.VITE_BUILD_VERSION, } as const -Object.assign(config, _mapEnvCfg(import.meta.env)) Object.assign(config, _mapEnvCfg(document.ENV)) function _mapEnvCfg(env: ImportMetaEnv | typeof document.ENV): { diff --git a/src/enums/chains.enum.ts b/src/enums/chains.enum.ts index dccc49a..1f0263e 100644 --- a/src/enums/chains.enum.ts +++ b/src/enums/chains.enum.ts @@ -6,7 +6,7 @@ export enum ETHEREUM_CHAINS { } export enum ETHEREUM_RPC_URLS { - ethereum = 'https://mainnet.infura.io/v3/', + ethereum = 'https://ethereum.publicnode.com', sepolia = 'https://rpc.sepolia.org/', arbitrum = 'https://arb1.arbitrum.io/rpc', arbitrumSepolia = 'https://sepolia-rollup.arbitrum.io/rpc', diff --git a/src/env.d.ts b/src/env.d.ts index 4e96035..7f6bce3 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -20,7 +20,7 @@ interface ImportMetaEnv { VITE_APP_ERC1967_PROXY_CONTRACT_ADDRESS: string VITE_APP_STETH_CONTRACT_ADDRESS: string VITE_APP_MOR_CONTRACT_ADDRESS: string - VITE_APP_IS_TESTNET: string + VITE_APP_IS_MAINNET: string } declare global { diff --git a/src/forms/DepositForm.vue b/src/forms/DepositForm.vue index 7805197..e0f8cfa 100644 --- a/src/forms/DepositForm.vue +++ b/src/forms/DepositForm.vue @@ -98,7 +98,7 @@ const { contractWithSigner: erc1967Proxy } = useContract( const { contractWithProvider: stEthWithProvider } = useContract( 'ERC20__factory', config.STETH_CONTRACT_ADDRESS, - !config.IS_TESTNET ? ETHEREUM_RPC_URLS.ethereum : ETHEREUM_RPC_URLS.sepolia, + config.IS_MAINNET ? ETHEREUM_RPC_URLS.ethereum : ETHEREUM_RPC_URLS.sepolia, ) const { contractWithSigner: stEthWithSigner } = useContract( diff --git a/src/pages/HomePage/views/CodersView.vue b/src/pages/HomePage/views/CodersView.vue index ee468c0..7207692 100644 --- a/src/pages/HomePage/views/CodersView.vue +++ b/src/pages/HomePage/views/CodersView.vue @@ -55,7 +55,7 @@ const web3ProvidersStore = useWeb3ProvidersStore() const { contractWithProvider: erc1967Proxy } = useContract( 'ERC1967Proxy__factory', config.ERC1967_PROXY_CONTRACT_ADDRESS, - !config.IS_TESTNET ? ETHEREUM_RPC_URLS.ethereum : ETHEREUM_RPC_URLS.sepolia, + config.IS_MAINNET ? ETHEREUM_RPC_URLS.ethereum : ETHEREUM_RPC_URLS.sepolia, ) const poolData = ref(null) diff --git a/src/pages/HomePage/views/CommunityView.vue b/src/pages/HomePage/views/CommunityView.vue index 39d26ff..16a5207 100644 --- a/src/pages/HomePage/views/CommunityView.vue +++ b/src/pages/HomePage/views/CommunityView.vue @@ -108,7 +108,7 @@ const { $t } = useContext() const { contractWithProvider: erc1967Proxy } = useContract( 'ERC1967Proxy__factory', config.ERC1967_PROXY_CONTRACT_ADDRESS, - !config.IS_TESTNET ? ETHEREUM_RPC_URLS.ethereum : ETHEREUM_RPC_URLS.sepolia, + config.IS_MAINNET ? ETHEREUM_RPC_URLS.ethereum : ETHEREUM_RPC_URLS.sepolia, ) const web3ProvidersStore = useWeb3ProvidersStore() diff --git a/src/store/modules/web3-providers.module.ts b/src/store/modules/web3-providers.module.ts index a42d1a7..72a9a27 100644 --- a/src/store/modules/web3-providers.module.ts +++ b/src/store/modules/web3-providers.module.ts @@ -23,7 +23,7 @@ export const useWeb3ProvidersStore = defineStore(STORE_NAME, { getters: { isValidChain: state => String(state.provider.chainId) === - (!config.IS_TESTNET ? ETHEREUM_CHAINS.ethereum : ETHEREUM_CHAINS.sepolia), + (config.IS_MAINNET ? ETHEREUM_CHAINS.ethereum : ETHEREUM_CHAINS.sepolia), address: state => state.provider.selectedAddress, },