From 48eb3f0005c3ea784e551c77a24195fb44e48eb2 Mon Sep 17 00:00:00 2001 From: ButterflyEffect Date: Tue, 19 Dec 2023 17:21:56 +0000 Subject: [PATCH] remove prohibited & blocked lists checking --- src/constants/lists.ts | 7 +------ src/constants/tokenSafetyLookup.ts | 10 +--------- src/state/lists/updater.ts | 12 ++---------- 3 files changed, 4 insertions(+), 25 deletions(-) diff --git a/src/constants/lists.ts b/src/constants/lists.ts index 889e1234f7..5e15b0d05a 100644 --- a/src/constants/lists.ts +++ b/src/constants/lists.ts @@ -1,8 +1,6 @@ export const UNI_LIST = 'https://cloudflare-ipfs.com/ipns/tokens.uniswap.org' export const UNI_EXTENDED_LIST = 'https://cloudflare-ipfs.com/ipns/extendedtokens.uniswap.org' -const UNI_UNSUPPORTED_LIST = 'https://cloudflare-ipfs.com/ipns/unsupportedtokens.uniswap.org' const AAVE_LIST = 'tokenlist.aave.eth' -const BA_LIST = 'https://raw.githubusercontent.com/The-Blockchain-Association/sec-notice-list/master/ba-sec-list.json' // TODO(WEB-2282): Re-enable CMC list once we have a better solution for handling large lists. // const CMC_ALL_LIST = 'https://s3.coinmarketcap.com/generated/dex/tokens/eth-tokens-all.json' const COINGECKO_LIST = 'https://tokens.coingecko.com/uniswap/all.json' @@ -27,8 +25,6 @@ export const AVALANCHE_LIST = export const BASE_LIST = 'https://raw.githubusercontent.com/ethereum-optimism/ethereum-optimism.github.io/master/optimism.tokenlist.json' -export const UNSUPPORTED_LIST_URLS: string[] = [BA_LIST, UNI_UNSUPPORTED_LIST] - // default lists to be 'active' aka searched across export const DEFAULT_ACTIVE_LIST_URLS: string[] = [UNI_LIST] export const DEFAULT_INACTIVE_LIST_URLS: string[] = [ @@ -52,8 +48,7 @@ export const DEFAULT_INACTIVE_LIST_URLS: string[] = [ CELO_LIST, PLASMA_BNB_LIST, AVALANCHE_LIST, - BASE_LIST, - ...UNSUPPORTED_LIST_URLS, + BASE_LIST ] export const DEFAULT_LIST_OF_LISTS: string[] = [...DEFAULT_ACTIVE_LIST_URLS, ...DEFAULT_INACTIVE_LIST_URLS] diff --git a/src/constants/tokenSafetyLookup.ts b/src/constants/tokenSafetyLookup.ts index 18fc115dde..dfa6b1a846 100644 --- a/src/constants/tokenSafetyLookup.ts +++ b/src/constants/tokenSafetyLookup.ts @@ -2,7 +2,7 @@ import { TokenInfo } from '@uniswap/token-lists' import { ListsState } from 'state/lists/reducer' import store from '../state' -import { UNI_EXTENDED_LIST, UNI_LIST, UNSUPPORTED_LIST_URLS } from './lists' +import { UNI_EXTENDED_LIST, UNI_LIST} from './lists' import { COMMON_BASES } from './routing' import brokenTokenList from './tokenLists/broken.tokenlist.json' import { NATIVE_CHAIN_ID } from './tokens' @@ -37,14 +37,6 @@ class TokenSafetyLookupTable { brokenTokenList.tokens.forEach((token) => { this.dict[token.address.toLowerCase()] = TOKEN_LIST_TYPES.BROKEN }) - - // Initialize blocked tokens from all urls included - UNSUPPORTED_LIST_URLS.map((url) => lists.byUrl[url]?.current?.tokens) - .filter((x): x is TokenInfo[] => !!x) - .flat(1) - .forEach((token) => { - this.dict[token.address.toLowerCase()] = TOKEN_LIST_TYPES.BLOCKED - }) } checkToken(address: string, chainId?: number | null) { diff --git a/src/state/lists/updater.ts b/src/state/lists/updater.ts index fc18347fb3..62b19fffa3 100644 --- a/src/state/lists/updater.ts +++ b/src/state/lists/updater.ts @@ -1,6 +1,6 @@ import { getVersionUpgrade, VersionUpgrade } from '@uniswap/token-lists' import { useWeb3React } from '@web3-react/core' -import { DEFAULT_LIST_OF_LISTS, UNSUPPORTED_LIST_URLS } from 'constants/lists' +import { DEFAULT_LIST_OF_LISTS } from 'constants/lists' import TokenSafetyLookupTable from 'constants/tokenSafetyLookup' import { useStateRehydrated } from 'hooks/useStateRehydrated' import useInterval from 'lib/hooks/useInterval' @@ -32,7 +32,7 @@ export default function Updater(): null { if (!isWindowVisible) return DEFAULT_LIST_OF_LISTS.forEach((url) => { // Skip validation on unsupported lists - const isUnsupportedList = UNSUPPORTED_LIST_URLS.includes(url) + const isUnsupportedList = false; fetchList(url, isUnsupportedList).catch((error) => console.debug('interval list fetching error', error)) }) }, [fetchList, isWindowVisible]) @@ -50,14 +50,6 @@ export default function Updater(): null { fetchList(listUrl).catch((error) => console.debug('list added fetching error', error)) } }) - UNSUPPORTED_LIST_URLS.forEach((listUrl) => { - const list = lists[listUrl] - if (!list || (!list.current && !list.loadingRequestId && !list.error)) { - fetchList(listUrl, /* isUnsupportedList= */ true).catch((error) => - console.debug('list added fetching error', error) - ) - } - }) }, [dispatch, fetchList, lists, rehydrated]) // automatically update lists for every version update