Commit 3aa04530 authored by Moody Salem's avatar Moody Salem

remove a few unused isToken calls

parent e0a7c379
...@@ -114,7 +114,7 @@ function CurrencyRow({ ...@@ -114,7 +114,7 @@ function CurrencyRow({
const { account } = useActiveWeb3React() const { account } = useActiveWeb3React()
const key = currencyKey(currency) const key = currencyKey(currency)
const selectedTokenList = useCombinedActiveList() const selectedTokenList = useCombinedActiveList()
const isOnSelectedList = isTokenOnList(selectedTokenList, currency) const isOnSelectedList = isTokenOnList(selectedTokenList, currency.isToken ? currency : undefined)
const customAdded = useIsUserAddedToken(currency) const customAdded = useIsUserAddedToken(currency)
const balance = useCurrencyBalance(account ?? undefined, currency) const balance = useCurrencyBalance(account ?? undefined, currency)
...@@ -133,7 +133,7 @@ function CurrencyRow({ ...@@ -133,7 +133,7 @@ function CurrencyRow({
{currency.symbol} {currency.symbol}
</Text> </Text>
<TYPE.darkGray ml="0px" fontSize={'12px'} fontWeight={300}> <TYPE.darkGray ml="0px" fontSize={'12px'} fontWeight={300}>
{currency.name} {!isOnSelectedList && customAdded && '• Added by user'} {currency.name} {!currency.isEther && !isOnSelectedList && customAdded && '• Added by user'}
</TYPE.darkGray> </TYPE.darkGray>
</Column> </Column>
<TokenTags currency={currency} /> <TokenTags currency={currency} />
......
...@@ -83,9 +83,7 @@ export default function PoolCard({ stakingInfo }: { stakingInfo: StakingInfo }) ...@@ -83,9 +83,7 @@ export default function PoolCard({ stakingInfo }: { stakingInfo: StakingInfo })
const WETH = currency0.isEther ? token0 : token1 const WETH = currency0.isEther ? token0 : token1
const backgroundColor = useColor(token) const backgroundColor = useColor(token)
const totalSupplyOfStakingToken = useTotalSupply( const totalSupplyOfStakingToken = useTotalSupply(stakingInfo.stakedAmount.currency)
stakingInfo.stakedAmount.currency.isToken ? stakingInfo.stakedAmount.currency : undefined
)
const [, stakingTokenPair] = useV2Pair(...stakingInfo.tokens) const [, stakingTokenPair] = useV2Pair(...stakingInfo.tokens)
// let returnOverMonth: Percent = new Percent('0') // let returnOverMonth: Percent = new Percent('0')
......
...@@ -50,7 +50,7 @@ export default function StakingModal({ isOpen, onDismiss, stakingInfo, userLiqui ...@@ -50,7 +50,7 @@ export default function StakingModal({ isOpen, onDismiss, stakingInfo, userLiqui
const [typedValue, setTypedValue] = useState('') const [typedValue, setTypedValue] = useState('')
const { parsedAmount, error } = useDerivedStakeInfo( const { parsedAmount, error } = useDerivedStakeInfo(
typedValue, typedValue,
stakingInfo.stakedAmount.currency.isToken ? stakingInfo.stakedAmount.currency : undefined, stakingInfo.stakedAmount.currency,
userLiquidityUnstaked userLiquidityUnstaked
) )
const parsedAmountWrapped = wrappedCurrencyAmount(parsedAmount, chainId) const parsedAmountWrapped = wrappedCurrencyAmount(parsedAmount, chainId)
......
...@@ -89,9 +89,7 @@ export function useBestV3TradeExactIn( ...@@ -89,9 +89,7 @@ export function useBestV3TradeExactIn(
route: bestRoute, route: bestRoute,
tradeType: TradeType.EXACT_INPUT, tradeType: TradeType.EXACT_INPUT,
inputAmount: amountIn, inputAmount: amountIn,
outputAmount: currencyOut.isToken outputAmount: CurrencyAmount.fromRawAmount(currencyOut, amountOut.toString()),
? CurrencyAmount.fromRawAmount(currencyOut, amountOut.toString())
: CurrencyAmount.ether(amountOut.toString()),
}), }),
} }
}, [amountIn, currencyOut, quotesResults, routes, routesLoading]) }, [amountIn, currencyOut, quotesResults, routes, routesLoading])
......
...@@ -14,8 +14,8 @@ export function useIsSwapUnsupported(currencyIn?: Currency, currencyOut?: Curren ...@@ -14,8 +14,8 @@ export function useIsSwapUnsupported(currencyIn?: Currency, currencyOut?: Curren
// if unsupported list loaded & either token on list, mark as unsupported // if unsupported list loaded & either token on list, mark as unsupported
return Boolean( return Boolean(
unsupportedTokens && unsupportedTokens &&
((currencyIn && currencyIn.isToken && unsupportedTokens[currencyIn.address]) || ((currencyIn?.isToken && unsupportedTokens[currencyIn.address]) ||
(currencyOut && currencyOut.isToken && unsupportedTokens[currencyOut.address])) (currencyOut?.isToken && unsupportedTokens[currencyOut.address]))
) )
}, [currencyIn, currencyOut, unsupportedTokens]) }, [currencyIn, currencyOut, unsupportedTokens])
} }
...@@ -3,7 +3,7 @@ import { getAddress } from '@ethersproject/address' ...@@ -3,7 +3,7 @@ import { getAddress } from '@ethersproject/address'
import { AddressZero } from '@ethersproject/constants' import { AddressZero } from '@ethersproject/constants'
import { JsonRpcSigner, Web3Provider } from '@ethersproject/providers' import { JsonRpcSigner, Web3Provider } from '@ethersproject/providers'
import { BigNumber } from '@ethersproject/bignumber' import { BigNumber } from '@ethersproject/bignumber'
import { ChainId, Percent, CurrencyAmount, Currency, Fraction } from '@uniswap/sdk-core' import { ChainId, Percent, CurrencyAmount, Currency, Fraction, Token } from '@uniswap/sdk-core'
import { FeeAmount } from '@uniswap/v3-sdk/dist/' import { FeeAmount } from '@uniswap/v3-sdk/dist/'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import { TokenAddressMap } from '../state/lists/hooks' import { TokenAddressMap } from '../state/lists/hooks'
...@@ -92,9 +92,8 @@ export function escapeRegExp(string: string): string { ...@@ -92,9 +92,8 @@ export function escapeRegExp(string: string): string {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') // $& means the whole matched string return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') // $& means the whole matched string
} }
export function isTokenOnList(defaultTokens: TokenAddressMap, currency?: Currency): boolean { export function isTokenOnList(tokenAddressMap: TokenAddressMap, token?: Token): boolean {
if (currency?.isEther) return true return Boolean(token?.isToken && tokenAddressMap[token.chainId as ChainId]?.[token.address])
return Boolean(currency?.isToken && defaultTokens[currency.chainId as ChainId]?.[currency.address])
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment