From 0540012bb9aa63aef4e3a232ede0396f12e3d646 Mon Sep 17 00:00:00 2001 From: Noah Zinsmeister Date: Fri, 30 Apr 2021 15:12:00 -0400 Subject: [PATCH] WETH -> ETH in migrate fix rates in migrate fix migrate link --- src/components/RateToggle/index.tsx | 6 +-- src/pages/MigrateV2/MigrateV2Pair.tsx | 55 ++++++++++++++++----------- src/pages/Pool/index.tsx | 2 +- 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/src/components/RateToggle/index.tsx b/src/components/RateToggle/index.tsx index 816d9ec777..00fe698da0 100644 --- a/src/components/RateToggle/index.tsx +++ b/src/components/RateToggle/index.tsx @@ -2,7 +2,6 @@ import React from 'react' import { Currency } from '@uniswap/sdk-core' import { ToggleElement, ToggleWrapper } from 'components/Toggle/MultiToggle' import { useActiveWeb3React } from 'hooks' -import { useTranslation } from 'react-i18next' import { wrappedCurrency } from 'utils/wrappedCurrency' // the order of displayed base currencies from left to right is always in sort order @@ -16,7 +15,6 @@ export default function RateToggle({ currencyB: Currency handleRateToggle: () => void }) { - const { t } = useTranslation() const { chainId } = useActiveWeb3React() const tokenA = wrappedCurrency(currencyA, chainId) @@ -27,10 +25,10 @@ export default function RateToggle({ return tokenA && tokenB ? ( - {isSorted ? currencyA.symbol : currencyB.symbol} {t('rate')} + {isSorted ? currencyA.symbol : currencyB.symbol} - {isSorted ? currencyB.symbol : currencyA.symbol} {t('rate')} + {isSorted ? currencyB.symbol : currencyA.symbol} ) : null diff --git a/src/pages/MigrateV2/MigrateV2Pair.tsx b/src/pages/MigrateV2/MigrateV2Pair.tsx index 7ae655af09..4b0921b144 100644 --- a/src/pages/MigrateV2/MigrateV2Pair.tsx +++ b/src/pages/MigrateV2/MigrateV2Pair.tsx @@ -41,6 +41,7 @@ import { Contract } from '@ethersproject/contracts' import useCurrentBlockTimestamp from 'hooks/useCurrentBlockTimestamp' import { formatTokenAmount } from 'utils/formatTokenAmount' import useTheme from 'hooks/useTheme' +import { unwrappedToken } from 'utils/wrappedCurrency' const ZERO = JSBI.BigInt(0) @@ -53,28 +54,31 @@ function EmptyState({ message }: { message: string }) { } function LiquidityInfo({ token0Amount, token1Amount }: { token0Amount: TokenAmount; token1Amount: TokenAmount }) { + const currency0 = unwrappedToken(token0Amount.token) + const currency1 = unwrappedToken(token1Amount.token) + return ( <> - Pooled {token0Amount.token.symbol}: + Pooled {currency0.symbol}: - + - Pooled {token1Amount.token.symbol}: + Pooled {currency1.symbol}: - + @@ -109,6 +113,9 @@ function V2PairMigration({ const blockTimestamp = useCurrentBlockTimestamp() const [allowedSlippage] = useUserSlippageTolerance() // custom from users + const currency0 = unwrappedToken(token0) + const currency1 = unwrappedToken(token1) + // this is just getLiquidityValue with the fee off, but for the passed pair const token0Value = useMemo( () => new TokenAmount(token0, JSBI.divide(JSBI.multiply(pairBalance.raw, reserve0.raw), totalSupply.raw)), @@ -295,11 +302,11 @@ function V2PairMigration({ ReactGA.event({ category: 'Migrate', action: 'V2->V3', - label: `${token0.symbol}/${token1.symbol}`, + label: `${currency0.symbol}/${currency1.symbol}`, }) addTransaction(response, { - summary: `Migrate ${token0.symbol}/${token1.symbol} liquidity to V3`, + summary: `Migrate ${currency0.symbol}/${currency1.symbol} liquidity to V3`, }) setPendingMigrationHash(response.hash) }) @@ -324,6 +331,8 @@ function V2PairMigration({ signatureData, addTransaction, pair, + currency0, + currency1, ]) const isSuccessfullyMigrated = !!pendingMigrationHash && JSBI.equal(pairBalance.raw, ZERO) @@ -357,11 +366,11 @@ function V2PairMigration({ - V2 Price: + V2 {invertPrice ? currency1.symbol : currency0.symbol} Price: {invertPrice - ? `${v2SpotPrice?.invert()?.toSignificant(6)} ${token0.symbol} / ${token1.symbol}` - : `${v2SpotPrice?.toSignificant(6)} ${token1.symbol} / ${token0.symbol}`} + ? `${v2SpotPrice?.invert()?.toSignificant(6)} ${currency0.symbol}` + : `${v2SpotPrice?.toSignificant(6)} ${currency1.symbol}`} @@ -376,20 +385,20 @@ function V2PairMigration({ - V2 Price: + V2 {invertPrice ? currency1.symbol : currency0.symbol} Price: {invertPrice - ? `${v2SpotPrice?.invert()?.toSignificant(6)} ${token0.symbol} / ${token1.symbol}` - : `${v2SpotPrice?.toSignificant(6)} ${token1.symbol} / ${token0.symbol}`} + ? `${v2SpotPrice?.invert()?.toSignificant(6)} ${currency0.symbol}` + : `${v2SpotPrice?.toSignificant(6)} ${currency1.symbol}`} - V3 Price: + V3 {invertPrice ? currency1.symbol : currency0.symbol} Price: {invertPrice - ? `${v3SpotPrice?.invert()?.toSignificant(6)} ${token0.symbol} / ${token1.symbol}` - : `${v3SpotPrice?.toSignificant(6)} ${token1.symbol} / ${token0.symbol}`} + ? `${v3SpotPrice?.invert()?.toSignificant(6)} ${currency0.symbol}` + : `${v3SpotPrice?.toSignificant(6)} ${currency1.symbol}`} @@ -406,8 +415,8 @@ function V2PairMigration({ {t('selectLiquidityRange')} { onLeftRangeInput('') onRightRangeInput('') @@ -425,8 +434,8 @@ function V2PairMigration({ getIncrementUpper={getIncrementUpper} onLeftRangeInput={onLeftRangeInput} onRightRangeInput={onRightRangeInput} - currencyA={invertPrice ? token1 : token0} - currencyB={invertPrice ? token0 : token1} + currencyA={invertPrice ? currency1 : currency0} + currencyB={invertPrice ? currency0 : currency1} feeAmount={feeAmount} /> @@ -512,10 +521,10 @@ function V2PairMigration({ ) : null} - {`Your Uniswap V2 ${invertPrice ? token0?.symbol : token1?.symbol} / ${ - invertPrice ? token1?.symbol : token0?.symbol - } liquidity tokens will become a Uniswap V3 ${invertPrice ? token0?.symbol : token1?.symbol} / ${ - invertPrice ? token1?.symbol : token0?.symbol + {`Your Uniswap V2 ${invertPrice ? currency0?.symbol : currency1?.symbol} / ${ + invertPrice ? currency1?.symbol : currency0?.symbol + } liquidity tokens will become a Uniswap V3 ${invertPrice ? currency0?.symbol : currency1?.symbol} / ${ + invertPrice ? currency1?.symbol : currency0?.symbol } NFT.`} diff --git a/src/pages/Pool/index.tsx b/src/pages/Pool/index.tsx index 133cf9ea2b..dd06ae3577 100644 --- a/src/pages/Pool/index.tsx +++ b/src/pages/Pool/index.tsx @@ -113,7 +113,7 @@ export default function Pool() { {t('Migrate Liquidity')} ), - link: '/#/migrate/v2', + link: '/migrate/v2', external: false, }, {