Commit 627a5d3a authored by Noah Zinsmeister's avatar Noah Zinsmeister

Squashed commit of the following:

commit 5f1d1af62bcd47286aafacc18788f4e7e22dd7c0
Author: Aseem Sood <asood123@yahoo.com>
Date:   Fri Sep 3 12:12:39 2021 -0400

    update readme

    tweak

commit 80a5b95c0e0ae8934b5591c982077eaa813db747
Author: Noah Zinsmeister <noahwz@gmail.com>
Date:   Fri Sep 3 11:52:56 2021 -0400

    consolidate and standardize unsupported tokens
parent 353c4751
......@@ -26,14 +26,19 @@ To access the Uniswap Interface, use an IPFS gateway link from the
[latest release](https://github.com/Uniswap/uniswap-interface/releases/latest),
or visit [app.uniswap.org](https://app.uniswap.org).
## Unsupported tokens
Check out `useUnsupportedTokenList()` in [src/state/lists/hooks.ts](./src/state/lists/hooks.ts) for blocking tokens in your instance of the interface.
You can block an entire list of tokens by passing in a tokenlist like [here](./src/constants/lists.ts) or you can block specific tokens by adding them to [unsupported.tokenlist.json](./src/constants/tokenLists/unsupported.tokenlist.json).
## Contributions
For steps on local deployment, development, and code contribution, please see [CONTRIBUTING](./CONTRIBUTING.md).
## Accessing Uniswap V2
The Uniswap Interface supports swapping, adding liquidity, removing liquidity and migrating liquidity for
Uniswap protocol V2.
The Uniswap Interface supports swapping, adding liquidity, removing liquidity and migrating liquidity for Uniswap protocol V2.
- Swap on Uniswap V2: https://app.uniswap.org/#/swap?use=v2
- View V2 liquidity: https://app.uniswap.org/#/pool/v2
......@@ -41,6 +46,6 @@ Uniswap protocol V2.
- Migrate V2 liquidity to V3: https://app.uniswap.org/#/migrate/v2
## Accessing Uniswap V1
The Uniswap V1 interface for mainnet and testnets is accessible via IPFS gateways
The Uniswap V1 interface for mainnet and testnets is accessible via IPFS gateways
linked from the [v1.0.0 release](https://github.com/Uniswap/uniswap-interface/releases/tag/v1.0.0).
import { IS_ON_APP_URL } from './misc'
const AAVE_LIST = 'tokenlist.aave.eth'
const BA_LIST = 'https://raw.githubusercontent.com/The-Blockchain-Association/sec-notice-list/master/ba-sec-list.json'
const CMC_ALL_LIST = 'defi.cmc.eth'
......@@ -14,11 +12,11 @@ const ROLL_LIST = 'https://app.tryroll.com/tokens.json'
const SET_LIST = 'https://raw.githubusercontent.com/SetProtocol/uniswap-tokenlist/main/set.tokenlist.json'
const WRAPPED_LIST = 'wrapped.tokensoft.eth'
// only load blocked list if on app url
export const UNSUPPORTED_LIST_URLS: string[] = IS_ON_APP_URL ? [BA_LIST] : []
export const UNSUPPORTED_LIST_URLS: string[] = [BA_LIST]
// this is the default list of lists that are exposed to users
// lower index == higher priority for token import
export const DEFAULT_LIST_OF_LISTS: string[] = [
const DEFAULT_LIST_OF_LISTS_TO_DISPLAY: string[] = [
COMPOUND_LIST,
AAVE_LIST,
CMC_ALL_LIST,
......@@ -31,7 +29,11 @@ export const DEFAULT_LIST_OF_LISTS: string[] = [
ARBITRUM_LIST,
OPTIMISM_LIST,
GEMINI_LIST,
...UNSUPPORTED_LIST_URLS, // need to load unsupported tokens as well
]
export const DEFAULT_LIST_OF_LISTS: string[] = [
...DEFAULT_LIST_OF_LISTS_TO_DISPLAY,
...UNSUPPORTED_LIST_URLS, // need to load dynamic unsupported tokens as well
]
// default lists to be 'active' aka searched across
......
......@@ -31,5 +31,3 @@ export const BETTER_TRADE_LESS_HOPS_THRESHOLD = new Percent(JSBI.BigInt(50), BIP
export const ZERO_PERCENT = new Percent('0')
export const ONE_HUNDRED_PERCENT = new Percent('1')
export const IS_ON_APP_URL = window && window.location.hostname === 'app.uniswap.org'
import DEFAULT_TOKEN_LIST from '@uniswap/default-token-list'
import { TokenList } from '@uniswap/token-lists'
import { IS_ON_APP_URL } from 'constants/misc'
import { useMemo } from 'react'
import { useAppSelector } from 'state/hooks'
import sortByListPriority from 'utils/listSort'
......@@ -115,24 +114,23 @@ export function useCombinedActiveList(): TokenAddressMap {
return combineMaps(activeTokens, TRANSFORMED_DEFAULT_TOKEN_LIST)
}
// list of tokens not supported on interface, used to show warnings and prevent swaps and adds
// list of tokens not supported on interface for various reasons, used to show warnings and prevent swaps and adds
export function useUnsupportedTokenList(): TokenAddressMap {
// get hard coded unsupported tokens, only block on app url
const localUnsupportedListMap = useMemo(() => (IS_ON_APP_URL ? listToTokenMap(UNSUPPORTED_TOKEN_LIST) : {}), [])
// broken tokens, blocked on all URLS
// get hard-coded broken tokens
const brokenListMap = useMemo(() => listToTokenMap(BROKEN_LIST), [])
// get any loaded unsupported tokens, this will be empty if not on app URL
// get hard-coded list of unsupported tokens
const localUnsupportedListMap = useMemo(() => listToTokenMap(UNSUPPORTED_TOKEN_LIST), [])
// get dynamic list of unsupported tokens
const loadedUnsupportedListMap = useCombinedTokenMapFromUrls(UNSUPPORTED_LIST_URLS)
// format into one token address map
return useMemo(
() => combineMaps(brokenListMap, combineMaps(localUnsupportedListMap, loadedUnsupportedListMap)),
[localUnsupportedListMap, loadedUnsupportedListMap, brokenListMap]
[brokenListMap, localUnsupportedListMap, loadedUnsupportedListMap]
)
}
export function useIsListActive(url: string): boolean {
const activeListUrls = useActiveListUrls()
return Boolean(activeListUrls?.includes(url))
......
import { DEFAULT_ACTIVE_LIST_URLS, UNSUPPORTED_LIST_URLS } from './../../constants/lists'
import { DEFAULT_ACTIVE_LIST_URLS } from '../../constants/lists'
import { createReducer } from '@reduxjs/toolkit'
import { getVersionUpgrade, VersionUpgrade } from '@uniswap/token-lists'
import { TokenList } from '@uniswap/token-lists/dist/types'
......@@ -36,7 +36,7 @@ type Mutable<T> = { -readonly [P in keyof T]: T[P] extends ReadonlyArray<infer U
const initialState: ListsState = {
lastInitializedDefaultListOfLists: DEFAULT_LIST_OF_LISTS,
byUrl: {
...DEFAULT_LIST_OF_LISTS.concat(UNSUPPORTED_LIST_URLS).reduce<Mutable<ListsState['byUrl']>>((memo, listUrl) => {
...DEFAULT_LIST_OF_LISTS.reduce<Mutable<ListsState['byUrl']>>((memo, listUrl) => {
memo[listUrl] = NEW_LIST_STATE
return memo
}, {}),
......
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