From 28ea390863958afa863e0f5c3bcdb19bc55de18b Mon Sep 17 00:00:00 2001 From: cartcrom <39385577+cartcrom@users.noreply.github.com> Date: Thu, 7 Sep 2023 14:18:04 -0400 Subject: [PATCH] fix: gate FOT UI (#7272) * fix: gate FOT UI in swap component * feat: help article --- src/components/swap/AdvancedSwapDetails.tsx | 15 ++++++++++----- src/components/swap/SwapModalFooter.tsx | 15 ++++++++++----- src/lib/hooks/routing/useRoutingAPIArguments.ts | 4 ---- src/state/routing/types.ts | 1 - src/state/swap/hooks.tsx | 6 ++++-- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/components/swap/AdvancedSwapDetails.tsx b/src/components/swap/AdvancedSwapDetails.tsx index 849c2b6001..5784f76152 100644 --- a/src/components/swap/AdvancedSwapDetails.tsx +++ b/src/components/swap/AdvancedSwapDetails.tsx @@ -11,7 +11,7 @@ import { ClassicTrade, InterfaceTrade } from 'state/routing/types' import { getTransactionCount, isClassicTrade } from 'state/routing/utils' import { formatCurrencyAmount, formatNumber, formatPriceImpact, NumberType } from 'utils/formatNumbers' -import { Separator, ThemedText } from '../../theme' +import { ExternalLink, Separator, ThemedText } from '../../theme' import Column from '../Column' import RouterLabel from '../RouterLabel' import { RowBetween, RowFixed } from '../Row' @@ -192,10 +192,15 @@ function TokenTaxLineItem({ trade, type }: { trade: ClassicTrade; type: 'input' - Some tokens take a fee when they are bought or sold, which is set by the token issuer. Uniswap does not - receive any of these fees. - + <> + + Some tokens take a fee when they are bought or sold, which is set by the token issuer. Uniswap does not + receive any of these fees. + {' '} + + Learn more + + } > {`${currency.symbol} fee`} diff --git a/src/components/swap/SwapModalFooter.tsx b/src/components/swap/SwapModalFooter.tsx index 32c16ae7a2..d30419e59d 100644 --- a/src/components/swap/SwapModalFooter.tsx +++ b/src/components/swap/SwapModalFooter.tsx @@ -15,7 +15,7 @@ import { ClassicTrade, InterfaceTrade, RouterPreference } from 'state/routing/ty import { getTransactionCount, isClassicTrade } from 'state/routing/utils' import { useRouterPreference, useUserSlippageTolerance } from 'state/user/hooks' import styled, { DefaultTheme, useTheme } from 'styled-components' -import { ThemedText } from 'theme' +import { ExternalLink, ThemedText } from 'theme' import { formatNumber, formatPriceImpact, NumberType } from 'utils/formatNumbers' import { formatTransactionAmount, priceToPreciseFloat } from 'utils/formatNumbers' import getRoutingDiagramEntries from 'utils/getRoutingDiagramEntries' @@ -232,10 +232,15 @@ function TokenTaxLineItem({ trade, type }: { trade: ClassicTrade; type: 'input' - Some tokens take a fee when they are bought or sold, which is set by the token issuer. Uniswap does not - receive any of these fees. - + <> + + Some tokens take a fee when they are bought or sold, which is set by the token issuer. Uniswap does not + receive any of these fees. + {' '} + + Learn more + + } > diff --git a/src/lib/hooks/routing/useRoutingAPIArguments.ts b/src/lib/hooks/routing/useRoutingAPIArguments.ts index 2f1ff4b8bc..08d93eca09 100644 --- a/src/lib/hooks/routing/useRoutingAPIArguments.ts +++ b/src/lib/hooks/routing/useRoutingAPIArguments.ts @@ -1,6 +1,5 @@ import { SkipToken, skipToken } from '@reduxjs/toolkit/query/react' import { Currency, CurrencyAmount, Percent, TradeType } from '@uniswap/sdk-core' -import { useFotAdjustmentsEnabled } from 'featureFlags/flags/fotAdjustments' import { useUniswapXEthOutputEnabled } from 'featureFlags/flags/uniswapXEthOutput' import { useUniswapXExactOutputEnabled } from 'featureFlags/flags/uniswapXExactOutput' import { useUniswapXSyntheticQuoteEnabled } from 'featureFlags/flags/uniswapXUseSyntheticQuote' @@ -37,7 +36,6 @@ export function useRoutingAPIArguments({ const userDisabledUniswapX = useUserDisabledUniswapX() const uniswapXEthOutputEnabled = useUniswapXEthOutputEnabled() const uniswapXExactOutputEnabled = useUniswapXExactOutputEnabled() - const fotAdjustmentsEnabled = useFotAdjustmentsEnabled() return useMemo( () => @@ -61,7 +59,6 @@ export function useRoutingAPIArguments({ userDisabledUniswapX, uniswapXEthOutputEnabled, uniswapXExactOutputEnabled, - fotAdjustmentsEnabled, inputTax, outputTax, }, @@ -76,7 +73,6 @@ export function useRoutingAPIArguments({ uniswapXForceSyntheticQuotes, userDisabledUniswapX, uniswapXEthOutputEnabled, - fotAdjustmentsEnabled, inputTax, outputTax, ] diff --git a/src/state/routing/types.ts b/src/state/routing/types.ts index 3b9aeed87e..3f3644c40b 100644 --- a/src/state/routing/types.ts +++ b/src/state/routing/types.ts @@ -46,7 +46,6 @@ export interface GetQuoteArgs { uniswapXEthOutputEnabled: boolean uniswapXExactOutputEnabled: boolean userDisabledUniswapX: boolean - fotAdjustmentsEnabled: boolean inputTax: Percent outputTax: Percent } diff --git a/src/state/swap/hooks.tsx b/src/state/swap/hooks.tsx index 8541e36d40..f8dcff0ce2 100644 --- a/src/state/swap/hooks.tsx +++ b/src/state/swap/hooks.tsx @@ -1,6 +1,7 @@ import { Trans } from '@lingui/macro' import { ChainId, Currency, CurrencyAmount, Percent, TradeType } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' +import { useFotAdjustmentsEnabled } from 'featureFlags/flags/fotAdjustments' import useAutoSlippageTolerance from 'hooks/useAutoSlippageTolerance' import { useDebouncedTrade } from 'hooks/useDebouncedTrade' import { useSwapTaxes } from 'hooks/useSwapTaxes' @@ -108,9 +109,10 @@ export function useDerivedSwapInfo(state: SwapState, chainId: ChainId | undefine const inputCurrency = useCurrency(inputCurrencyId, chainId) const outputCurrency = useCurrency(outputCurrencyId, chainId) + const fotAdjustmentsEnabled = useFotAdjustmentsEnabled() const { inputTax, outputTax } = useSwapTaxes( - inputCurrency?.isToken ? inputCurrency.address : undefined, - outputCurrency?.isToken ? outputCurrency.address : undefined + inputCurrency?.isToken && fotAdjustmentsEnabled ? inputCurrency.address : undefined, + outputCurrency?.isToken && fotAdjustmentsEnabled ? outputCurrency.address : undefined ) const recipientLookup = useENS(recipient ?? undefined)