remove prohibited & blocked lists checking
Some checks failed
Semgrep / semgrep/ci (push) Has been cancelled
Crowdin Upload / upload-sources (push) Has been cancelled
Test / lint (push) Has been cancelled
Test / typecheck (push) Has been cancelled
Test / deps-tests (push) Has been cancelled
Test / unit-tests (push) Has been cancelled
Test / build (push) Has been cancelled
Test / cypress-typecheck (push) Has been cancelled
Test / cypress-rerun (push) Has been cancelled
Test / cypress-test-matrix (1) (push) Has been cancelled
Test / cypress-test-matrix (2) (push) Has been cancelled
Test / cypress-test-matrix (3) (push) Has been cancelled
Test / cypress-test-matrix (4) (push) Has been cancelled
Test / hardhat-cache (push) Has been cancelled
Test / cloud-typecheck (push) Has been cancelled
Test / cloud-tests (push) Has been cancelled
Test / pre (push) Has been cancelled
Test / post (push) Has been cancelled

This commit is contained in:
ButterflyEffect 2023-12-19 17:21:56 +00:00
parent a95c8fab5a
commit 48eb3f0005
3 changed files with 4 additions and 25 deletions

@ -1,8 +1,6 @@
export const UNI_LIST = 'https://cloudflare-ipfs.com/ipns/tokens.uniswap.org' 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' 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 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. // 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 CMC_ALL_LIST = 'https://s3.coinmarketcap.com/generated/dex/tokens/eth-tokens-all.json'
const COINGECKO_LIST = 'https://tokens.coingecko.com/uniswap/all.json' const COINGECKO_LIST = 'https://tokens.coingecko.com/uniswap/all.json'
@ -27,8 +25,6 @@ export const AVALANCHE_LIST =
export const BASE_LIST = export const BASE_LIST =
'https://raw.githubusercontent.com/ethereum-optimism/ethereum-optimism.github.io/master/optimism.tokenlist.json' '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 // default lists to be 'active' aka searched across
export const DEFAULT_ACTIVE_LIST_URLS: string[] = [UNI_LIST] export const DEFAULT_ACTIVE_LIST_URLS: string[] = [UNI_LIST]
export const DEFAULT_INACTIVE_LIST_URLS: string[] = [ export const DEFAULT_INACTIVE_LIST_URLS: string[] = [
@ -52,8 +48,7 @@ export const DEFAULT_INACTIVE_LIST_URLS: string[] = [
CELO_LIST, CELO_LIST,
PLASMA_BNB_LIST, PLASMA_BNB_LIST,
AVALANCHE_LIST, AVALANCHE_LIST,
BASE_LIST, BASE_LIST
...UNSUPPORTED_LIST_URLS,
] ]
export const DEFAULT_LIST_OF_LISTS: string[] = [...DEFAULT_ACTIVE_LIST_URLS, ...DEFAULT_INACTIVE_LIST_URLS] export const DEFAULT_LIST_OF_LISTS: string[] = [...DEFAULT_ACTIVE_LIST_URLS, ...DEFAULT_INACTIVE_LIST_URLS]

@ -2,7 +2,7 @@ import { TokenInfo } from '@uniswap/token-lists'
import { ListsState } from 'state/lists/reducer' import { ListsState } from 'state/lists/reducer'
import store from '../state' 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 { COMMON_BASES } from './routing'
import brokenTokenList from './tokenLists/broken.tokenlist.json' import brokenTokenList from './tokenLists/broken.tokenlist.json'
import { NATIVE_CHAIN_ID } from './tokens' import { NATIVE_CHAIN_ID } from './tokens'
@ -37,14 +37,6 @@ class TokenSafetyLookupTable {
brokenTokenList.tokens.forEach((token) => { brokenTokenList.tokens.forEach((token) => {
this.dict[token.address.toLowerCase()] = TOKEN_LIST_TYPES.BROKEN 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) { checkToken(address: string, chainId?: number | null) {

@ -1,6 +1,6 @@
import { getVersionUpgrade, VersionUpgrade } from '@uniswap/token-lists' import { getVersionUpgrade, VersionUpgrade } from '@uniswap/token-lists'
import { useWeb3React } from '@web3-react/core' 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 TokenSafetyLookupTable from 'constants/tokenSafetyLookup'
import { useStateRehydrated } from 'hooks/useStateRehydrated' import { useStateRehydrated } from 'hooks/useStateRehydrated'
import useInterval from 'lib/hooks/useInterval' import useInterval from 'lib/hooks/useInterval'
@ -32,7 +32,7 @@ export default function Updater(): null {
if (!isWindowVisible) return if (!isWindowVisible) return
DEFAULT_LIST_OF_LISTS.forEach((url) => { DEFAULT_LIST_OF_LISTS.forEach((url) => {
// Skip validation on unsupported lists // 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(url, isUnsupportedList).catch((error) => console.debug('interval list fetching error', error))
}) })
}, [fetchList, isWindowVisible]) }, [fetchList, isWindowVisible])
@ -50,14 +50,6 @@ export default function Updater(): null {
fetchList(listUrl).catch((error) => console.debug('list added fetching error', error)) 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]) }, [dispatch, fetchList, lists, rehydrated])
// automatically update lists for every version update // automatically update lists for every version update