From 2d2c352e82b8af1d6a97bcf770ea69c6bf270ed8 Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Tue, 19 Nov 2024 14:45:30 +0100 Subject: [PATCH] enforce address format --- src/pages/liquidity-matrix/index.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/pages/liquidity-matrix/index.tsx b/src/pages/liquidity-matrix/index.tsx index c140359d1..10930668e 100644 --- a/src/pages/liquidity-matrix/index.tsx +++ b/src/pages/liquidity-matrix/index.tsx @@ -42,6 +42,7 @@ import { useWagmi } from 'libs/wagmi'; import { lsService } from 'services/localeStorage'; import { isZero } from 'components/strategies/common/utils'; import './index.css'; +import { getAddress } from 'ethers/lib/utils'; const animateLeaving = (address: string, options: { isLast: boolean }) => { const elements = document.querySelectorAll(`[data-on-leave="${address}"]`); @@ -168,13 +169,7 @@ const usdPrice = (value?: string | number) => { if (!value) return ''; return prettifyNumber(value, { abbreviate: true, currentCurrency: 'USD' }); }; - -const getMin = (...data: string[]) => SafeDecimal.min(...data).toString(); -const getMax = (...data: string[]) => SafeDecimal.max(...data).toString(); const round = (value: number) => Math.round(value * 100) / 100; -const clamp = (min: string, value: string, max: string) => { - return getMin(max, getMax(value, min)); -}; const url = '/liquidity-matrix'; export const LiquidityMatrixPage = () => { @@ -196,8 +191,8 @@ export const LiquidityMatrixPage = () => { useEffect(() => { const { base, quote } = getLastVisitedPair(); - if (!getTokenById(search.base)) set({ base }); - if (!search.pairs) set({ pairs: [createPair(quote)] }); + if (!getTokenById(search.base)) set({ base: getAddress(base) }); + if (!search.pairs) set({ pairs: [createPair(getAddress(quote))] }); // eslint-disable-next-line react-hooks/exhaustive-deps }, [set]);