fix: gate FOT UI (#7272)

* fix: gate FOT UI in swap component

* feat: help article
This commit is contained in:
cartcrom 2023-09-07 14:18:04 -04:00 committed by GitHub
parent 4ba0d8ffc0
commit 28ea390863
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 17 deletions

@ -11,7 +11,7 @@ import { ClassicTrade, InterfaceTrade } from 'state/routing/types'
import { getTransactionCount, isClassicTrade } from 'state/routing/utils' import { getTransactionCount, isClassicTrade } from 'state/routing/utils'
import { formatCurrencyAmount, formatNumber, formatPriceImpact, NumberType } from 'utils/formatNumbers' import { formatCurrencyAmount, formatNumber, formatPriceImpact, NumberType } from 'utils/formatNumbers'
import { Separator, ThemedText } from '../../theme' import { ExternalLink, Separator, ThemedText } from '../../theme'
import Column from '../Column' import Column from '../Column'
import RouterLabel from '../RouterLabel' import RouterLabel from '../RouterLabel'
import { RowBetween, RowFixed } from '../Row' import { RowBetween, RowFixed } from '../Row'
@ -192,10 +192,15 @@ function TokenTaxLineItem({ trade, type }: { trade: ClassicTrade; type: 'input'
<RowBetween> <RowBetween>
<MouseoverTooltip <MouseoverTooltip
text={ text={
<Trans> <>
Some tokens take a fee when they are bought or sold, which is set by the token issuer. Uniswap does not <Trans>
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
</Trans> receive any of these fees.
</Trans>{' '}
<ExternalLink href="https://support.uniswap.org/hc/en-us/articles/18673568523789-What-is-a-token-fee-">
Learn more
</ExternalLink>
</>
} }
> >
<ThemedText.BodySmall color="textSecondary">{`${currency.symbol} fee`}</ThemedText.BodySmall> <ThemedText.BodySmall color="textSecondary">{`${currency.symbol} fee`}</ThemedText.BodySmall>

@ -15,7 +15,7 @@ import { ClassicTrade, InterfaceTrade, RouterPreference } from 'state/routing/ty
import { getTransactionCount, isClassicTrade } from 'state/routing/utils' import { getTransactionCount, isClassicTrade } from 'state/routing/utils'
import { useRouterPreference, useUserSlippageTolerance } from 'state/user/hooks' import { useRouterPreference, useUserSlippageTolerance } from 'state/user/hooks'
import styled, { DefaultTheme, useTheme } from 'styled-components' import styled, { DefaultTheme, useTheme } from 'styled-components'
import { ThemedText } from 'theme' import { ExternalLink, ThemedText } from 'theme'
import { formatNumber, formatPriceImpact, NumberType } from 'utils/formatNumbers' import { formatNumber, formatPriceImpact, NumberType } from 'utils/formatNumbers'
import { formatTransactionAmount, priceToPreciseFloat } from 'utils/formatNumbers' import { formatTransactionAmount, priceToPreciseFloat } from 'utils/formatNumbers'
import getRoutingDiagramEntries from 'utils/getRoutingDiagramEntries' import getRoutingDiagramEntries from 'utils/getRoutingDiagramEntries'
@ -232,10 +232,15 @@ function TokenTaxLineItem({ trade, type }: { trade: ClassicTrade; type: 'input'
<Row align="flex-start" justify="space-between" gap="sm"> <Row align="flex-start" justify="space-between" gap="sm">
<MouseoverTooltip <MouseoverTooltip
text={ text={
<Trans> <>
Some tokens take a fee when they are bought or sold, which is set by the token issuer. Uniswap does not <Trans>
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
</Trans> receive any of these fees.
</Trans>{' '}
<ExternalLink href="https://support.uniswap.org/hc/en-us/articles/18673568523789-What-is-a-token-fee-">
Learn more
</ExternalLink>
</>
} }
> >
<Label cursor="help">{t`${currency.symbol} fee`}</Label> <Label cursor="help">{t`${currency.symbol} fee`}</Label>

@ -1,6 +1,5 @@
import { SkipToken, skipToken } from '@reduxjs/toolkit/query/react' import { SkipToken, skipToken } from '@reduxjs/toolkit/query/react'
import { Currency, CurrencyAmount, Percent, TradeType } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Percent, TradeType } from '@uniswap/sdk-core'
import { useFotAdjustmentsEnabled } from 'featureFlags/flags/fotAdjustments'
import { useUniswapXEthOutputEnabled } from 'featureFlags/flags/uniswapXEthOutput' import { useUniswapXEthOutputEnabled } from 'featureFlags/flags/uniswapXEthOutput'
import { useUniswapXExactOutputEnabled } from 'featureFlags/flags/uniswapXExactOutput' import { useUniswapXExactOutputEnabled } from 'featureFlags/flags/uniswapXExactOutput'
import { useUniswapXSyntheticQuoteEnabled } from 'featureFlags/flags/uniswapXUseSyntheticQuote' import { useUniswapXSyntheticQuoteEnabled } from 'featureFlags/flags/uniswapXUseSyntheticQuote'
@ -37,7 +36,6 @@ export function useRoutingAPIArguments({
const userDisabledUniswapX = useUserDisabledUniswapX() const userDisabledUniswapX = useUserDisabledUniswapX()
const uniswapXEthOutputEnabled = useUniswapXEthOutputEnabled() const uniswapXEthOutputEnabled = useUniswapXEthOutputEnabled()
const uniswapXExactOutputEnabled = useUniswapXExactOutputEnabled() const uniswapXExactOutputEnabled = useUniswapXExactOutputEnabled()
const fotAdjustmentsEnabled = useFotAdjustmentsEnabled()
return useMemo( return useMemo(
() => () =>
@ -61,7 +59,6 @@ export function useRoutingAPIArguments({
userDisabledUniswapX, userDisabledUniswapX,
uniswapXEthOutputEnabled, uniswapXEthOutputEnabled,
uniswapXExactOutputEnabled, uniswapXExactOutputEnabled,
fotAdjustmentsEnabled,
inputTax, inputTax,
outputTax, outputTax,
}, },
@ -76,7 +73,6 @@ export function useRoutingAPIArguments({
uniswapXForceSyntheticQuotes, uniswapXForceSyntheticQuotes,
userDisabledUniswapX, userDisabledUniswapX,
uniswapXEthOutputEnabled, uniswapXEthOutputEnabled,
fotAdjustmentsEnabled,
inputTax, inputTax,
outputTax, outputTax,
] ]

@ -46,7 +46,6 @@ export interface GetQuoteArgs {
uniswapXEthOutputEnabled: boolean uniswapXEthOutputEnabled: boolean
uniswapXExactOutputEnabled: boolean uniswapXExactOutputEnabled: boolean
userDisabledUniswapX: boolean userDisabledUniswapX: boolean
fotAdjustmentsEnabled: boolean
inputTax: Percent inputTax: Percent
outputTax: Percent outputTax: Percent
} }

@ -1,6 +1,7 @@
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { ChainId, Currency, CurrencyAmount, Percent, TradeType } from '@uniswap/sdk-core' import { ChainId, Currency, CurrencyAmount, Percent, TradeType } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core' import { useWeb3React } from '@web3-react/core'
import { useFotAdjustmentsEnabled } from 'featureFlags/flags/fotAdjustments'
import useAutoSlippageTolerance from 'hooks/useAutoSlippageTolerance' import useAutoSlippageTolerance from 'hooks/useAutoSlippageTolerance'
import { useDebouncedTrade } from 'hooks/useDebouncedTrade' import { useDebouncedTrade } from 'hooks/useDebouncedTrade'
import { useSwapTaxes } from 'hooks/useSwapTaxes' import { useSwapTaxes } from 'hooks/useSwapTaxes'
@ -108,9 +109,10 @@ export function useDerivedSwapInfo(state: SwapState, chainId: ChainId | undefine
const inputCurrency = useCurrency(inputCurrencyId, chainId) const inputCurrency = useCurrency(inputCurrencyId, chainId)
const outputCurrency = useCurrency(outputCurrencyId, chainId) const outputCurrency = useCurrency(outputCurrencyId, chainId)
const fotAdjustmentsEnabled = useFotAdjustmentsEnabled()
const { inputTax, outputTax } = useSwapTaxes( const { inputTax, outputTax } = useSwapTaxes(
inputCurrency?.isToken ? inputCurrency.address : undefined, inputCurrency?.isToken && fotAdjustmentsEnabled ? inputCurrency.address : undefined,
outputCurrency?.isToken ? outputCurrency.address : undefined outputCurrency?.isToken && fotAdjustmentsEnabled ? outputCurrency.address : undefined
) )
const recipientLookup = useENS(recipient ?? undefined) const recipientLookup = useENS(recipient ?? undefined)