Skip to content

Commit

Permalink
refactoring: config.IS_TESTNET -> config.IS_MAINNET
Browse files Browse the repository at this point in the history
  • Loading branch information
Yehor Podporinov authored and Yehor Podporinov committed Jan 22, 2024
1 parent 802054f commit cb0ab8b
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/common/WalletBalances.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions src/common/modals/compositions/ClaimModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const claim = async (): Promise<void> => {
props.poolId,
web3ProvidersStore.provider.selectedAddress,
{
// TODO: estimate by LayerZero
value: parseUnits('0.02', 'ether'),
},
)
Expand Down
4 changes: 2 additions & 2 deletions src/common/modals/compositions/InvalidNetworkModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
>
<div class="invalid-network-modal__board">
<div
v-for="network in config.IS_TESTNET ? testNetworks : mainNetworks"
v-for="network in config.IS_MAINNET ? mainNetworks : testNetworks"
:key="network.title"
class="invalid-network-modal__network-wrp"
>
Expand Down Expand Up @@ -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,
)
Expand Down
3 changes: 1 addition & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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): {
Expand Down
2 changes: 1 addition & 1 deletion src/enums/chains.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/forms/DepositForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/pages/HomePage/views/CodersView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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<Erc1967ProxyType.PoolData | null>(null)
Expand Down
2 changes: 1 addition & 1 deletion src/pages/HomePage/views/CommunityView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/web3-providers.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},

Expand Down

0 comments on commit cb0ab8b

Please sign in to comment.