diff --git a/src/views/issuance/components/zap/state/zapper.ts b/src/views/issuance/components/zap/state/zapper.ts index f4f6c4a41..b0ebbcb0a 100644 --- a/src/views/issuance/components/zap/state/zapper.ts +++ b/src/views/issuance/components/zap/state/zapper.ts @@ -2,8 +2,8 @@ import { Web3Provider } from '@ethersproject/providers' import { Universe, baseConfig, - createKyberswap, createDefillama, + createKyberswap, ethereumConfig, setupBaseZapper, setupEthereumZapper, @@ -14,6 +14,7 @@ import { loadable } from 'jotai/utils' import mixpanel from 'mixpanel-browser' import { chainIdAtom, clientAtom } from 'state/atoms' import { onlyNonNullAtom, simplifyLoadable } from 'utils/atoms/utils' +import { ChainId } from 'utils/chains' import { PublicClient } from 'viem' export function publicClientToProvider(publicClient: PublicClient) { @@ -71,12 +72,15 @@ export const zapperState = loadable( provider.on('error', () => {}) try { - const chainIdToConfig: Record) => Promise }> = { - 1: { + const chainIdToConfig: Record< + number, + { config: any; setup: (uni: Universe) => Promise } + > = { + [ChainId.Mainnet]: { config: ethereumConfig, setup: setupEthereumZapper, }, - 8453: { + [ChainId.Base]: { config: baseConfig, setup: setupBaseZapper, }, @@ -89,17 +93,17 @@ export const zapperState = loadable( ) universe.dexAggregators.push(createKyberswap('KyberSwap', universe, 50)) - - if (provider.network.chainId === 1) { + + if (provider.network.chainId === ChainId.Mainnet) { universe.dexAggregators.push( - createDefillama('DefiLlama:0x', universe, 10, "Matcha/0x") + createDefillama('DefiLlama:0x', universe, 10, 'Matcha/0x') ) universe.dexAggregators.push( - createDefillama('DefiLlama:HashFlow', universe, 10, "Hashflow") + createDefillama('DefiLlama:HashFlow', universe, 10, 'Hashflow') ) - } else if (provider.network.chainId === 8453) { + } else if (provider.network.chainId === ChainId.Base) { universe.dexAggregators.push( - createDefillama('DefiLlama:0x', universe, 10, "Matcha/0x") + createDefillama('DefiLlama:0x', universe, 10, 'Matcha/0x') ) } return universe