Skip to content

Commit 293c60c

Browse files
authored
Merge pull request #4 from nation3/3-remove-censorship
Remove censorship
2 parents 4fb4a45 + 1e5a3d1 commit 293c60c

File tree

7 files changed

+13
-47
lines changed

7 files changed

+13
-47
lines changed

scripts/fetch-schema.js

+7-13
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,13 @@ const thegraphConfig = require('../graphql.thegraph.config')
99

1010
const exec = promisify(child_process.exec)
1111

12-
function fetchSchema(url, outputFile) {
13-
exec(`yarn --silent get-graphql-schema --h Origin=https://app.uniswap.org ${url}`)
14-
.then(({ stderr, stdout }) => {
15-
if (stderr) {
16-
throw new Error(stderr)
17-
} else {
18-
fs.writeFile(outputFile, stdout)
19-
}
20-
})
21-
.catch((err) => {
22-
console.error(err)
23-
console.error(`Failed to fetch schema from ${url}`)
24-
})
12+
async function fetchSchema(url, outputFile) {
13+
try {
14+
const { stdout } = await exec(`yarn --silent get-graphql-schema --h Origin=https://app.uniswap.org ${url}`);
15+
await fs.writeFile(outputFile, stdout);
16+
} catch(err){
17+
console.error(`Failed to fetch schema from ${url}`)
18+
}
2519
}
2620

2721
fetchSchema(process.env.THE_GRAPH_SCHEMA_ENDPOINT, thegraphConfig.schema)

src/constants/lists.ts

-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
export const UNI_LIST = 'https://cloudflare-ipfs.com/ipns/tokens.uniswap.org'
22
export const UNI_EXTENDED_LIST = 'https://cloudflare-ipfs.com/ipns/extendedtokens.uniswap.org'
3-
const UNI_UNSUPPORTED_LIST = 'https://cloudflare-ipfs.com/ipns/unsupportedtokens.uniswap.org'
43
const AAVE_LIST = 'tokenlist.aave.eth'
5-
const BA_LIST = 'https://raw.githubusercontent.com/The-Blockchain-Association/sec-notice-list/master/ba-sec-list.json'
64
// TODO(WEB-2282): Re-enable CMC list once we have a better solution for handling large lists.
75
// const CMC_ALL_LIST = 'https://s3.coinmarketcap.com/generated/dex/tokens/eth-tokens-all.json'
86
const COINGECKO_LIST = 'https://tokens.coingecko.com/uniswap/all.json'
@@ -27,8 +25,6 @@ export const AVALANCHE_LIST =
2725
export const BASE_LIST =
2826
'https://raw.githubusercontent.com/ethereum-optimism/ethereum-optimism.github.io/master/optimism.tokenlist.json'
2927

30-
export const UNSUPPORTED_LIST_URLS: string[] = [BA_LIST, UNI_UNSUPPORTED_LIST]
31-
3228
// default lists to be 'active' aka searched across
3329
export const DEFAULT_ACTIVE_LIST_URLS: string[] = [UNI_LIST]
3430
export const DEFAULT_INACTIVE_LIST_URLS: string[] = [
@@ -53,7 +49,6 @@ export const DEFAULT_INACTIVE_LIST_URLS: string[] = [
5349
PLASMA_BNB_LIST,
5450
AVALANCHE_LIST,
5551
BASE_LIST,
56-
...UNSUPPORTED_LIST_URLS,
5752
]
5853

5954
export const DEFAULT_LIST_OF_LISTS: string[] = [...DEFAULT_ACTIVE_LIST_URLS, ...DEFAULT_INACTIVE_LIST_URLS]

src/constants/networks.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export const FALLBACK_URLS = {
127127
*/
128128
export const RPC_URLS = {
129129
[ChainId.MAINNET]: [
130-
`https://mainnet.infura.io/v3/${INFURA_KEY}`,
130+
`https://rpc.mevblocker.io/fast`,
131131
QUICKNODE_MAINNET_RPC_URL,
132132
...FALLBACK_URLS[ChainId.MAINNET],
133133
],

src/constants/tokenSafety.tsx

-4
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,6 @@ export function checkWarning(tokenAddress: string, chainId?: number | null) {
9393
return null
9494
case TOKEN_LIST_TYPES.UNI_EXTENDED:
9595
return MediumWarning
96-
case TOKEN_LIST_TYPES.UNKNOWN:
97-
return StrongWarning
98-
case TOKEN_LIST_TYPES.BLOCKED:
99-
return BlockedWarning
10096
case TOKEN_LIST_TYPES.BROKEN:
10197
return BlockedWarning
10298
}

src/constants/tokenSafetyLookup.ts

+1-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { TokenInfo } from '@uniswap/token-lists'
22
import { ListsState } from 'state/lists/reducer'
33

44
import store from '../state'
5-
import { UNI_EXTENDED_LIST, UNI_LIST, UNSUPPORTED_LIST_URLS } from './lists'
5+
import { UNI_EXTENDED_LIST, UNI_LIST } from './lists'
66
import { COMMON_BASES } from './routing'
77
import brokenTokenList from './tokenLists/broken.tokenlist.json'
88
import { NATIVE_CHAIN_ID } from './tokens'
@@ -37,14 +37,6 @@ class TokenSafetyLookupTable {
3737
brokenTokenList.tokens.forEach((token) => {
3838
this.dict[token.address.toLowerCase()] = TOKEN_LIST_TYPES.BROKEN
3939
})
40-
41-
// Initialize blocked tokens from all urls included
42-
UNSUPPORTED_LIST_URLS.map((url) => lists.byUrl[url]?.current?.tokens)
43-
.filter((x): x is TokenInfo[] => !!x)
44-
.flat(1)
45-
.forEach((token) => {
46-
this.dict[token.address.toLowerCase()] = TOKEN_LIST_TYPES.BLOCKED
47-
})
4840
}
4941

5042
checkToken(address: string, chainId?: number | null) {

src/state/lists/hooks.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { AppState } from 'state/reducer'
55
import sortByListPriority from 'utils/listSort'
66

77
import BROKEN_LIST from '../../constants/tokenLists/broken.tokenlist.json'
8-
import { DEFAULT_ACTIVE_LIST_URLS, UNSUPPORTED_LIST_URLS } from './../../constants/lists'
8+
import { DEFAULT_ACTIVE_LIST_URLS } from './../../constants/lists'
99

1010
type Mutable<T> = {
1111
-readonly [P in keyof T]: Mutable<T[P]>
@@ -75,9 +75,6 @@ export function useUnsupportedTokenList(): TokenAddressMap {
7575
// get hard-coded broken tokens
7676
const brokenListMap = useMemo(() => tokensToChainTokenMap(BROKEN_LIST), [])
7777

78-
// get dynamic list of unsupported tokens
79-
const loadedUnsupportedListMap = useCombinedTokenMapFromUrls(UNSUPPORTED_LIST_URLS)
80-
8178
// format into one token address map
82-
return useMemo(() => combineMaps(brokenListMap, loadedUnsupportedListMap), [brokenListMap, loadedUnsupportedListMap])
79+
return brokenListMap;
8380
}

src/state/lists/updater.ts

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getVersionUpgrade, VersionUpgrade } from '@uniswap/token-lists'
22
import { useWeb3React } from '@web3-react/core'
3-
import { DEFAULT_LIST_OF_LISTS, UNSUPPORTED_LIST_URLS } from 'constants/lists'
3+
import { DEFAULT_LIST_OF_LISTS } from 'constants/lists'
44
import TokenSafetyLookupTable from 'constants/tokenSafetyLookup'
55
import { useStateRehydrated } from 'hooks/useStateRehydrated'
66
import useInterval from 'lib/hooks/useInterval'
@@ -32,7 +32,7 @@ export default function Updater(): null {
3232
if (!isWindowVisible) return
3333
DEFAULT_LIST_OF_LISTS.forEach((url) => {
3434
// Skip validation on unsupported lists
35-
const isUnsupportedList = UNSUPPORTED_LIST_URLS.includes(url)
35+
const isUnsupportedList = false
3636
fetchList(url, isUnsupportedList).catch((error) => console.debug('interval list fetching error', error))
3737
})
3838
}, [fetchList, isWindowVisible])
@@ -50,14 +50,6 @@ export default function Updater(): null {
5050
fetchList(listUrl).catch((error) => console.debug('list added fetching error', error))
5151
}
5252
})
53-
UNSUPPORTED_LIST_URLS.forEach((listUrl) => {
54-
const list = lists[listUrl]
55-
if (!list || (!list.current && !list.loadingRequestId && !list.error)) {
56-
fetchList(listUrl, /* isUnsupportedList= */ true).catch((error) =>
57-
console.debug('list added fetching error', error)
58-
)
59-
}
60-
})
6153
}, [dispatch, fetchList, lists, rehydrated])
6254

6355
// automatically update lists for every version update

0 commit comments

Comments
 (0)