Commit f0d10ba0 authored by Moody Salem's avatar Moody Salem

fix: add DAI and WBTC and USDT to routing for Optimism

fixes https://github.com/Uniswap/uniswap-interface/issues/2016
parent 88600d3a
......@@ -16,46 +16,40 @@ export enum SupportedChainId {
export const ALL_SUPPORTED_CHAIN_IDS: SupportedChainId[] = Object.values(SupportedChainId) as SupportedChainId[]
export type SupportedL2ChainId =
| SupportedChainId.ARBITRUM_ONE
| SupportedChainId.ARBITRUM_RINKEBY
| SupportedChainId.OPTIMISM
| SupportedChainId.OPTIMISTIC_KOVAN
export type SupportedL1ChainId =
| SupportedChainId.MAINNET
| SupportedChainId.ROPSTEN
| SupportedChainId.RINKEBY
| SupportedChainId.GOERLI
| SupportedChainId.KOVAN
export const L1_CHAIN_IDS = [
SupportedChainId.MAINNET,
SupportedChainId.ROPSTEN,
SupportedChainId.RINKEBY,
SupportedChainId.GOERLI,
SupportedChainId.KOVAN,
]
] as const
export type SupportedL1ChainId = typeof L1_CHAIN_IDS[number]
export const L2_CHAIN_IDS = [
SupportedChainId.ARBITRUM_ONE,
SupportedChainId.ARBITRUM_RINKEBY,
SupportedChainId.OPTIMISM,
SupportedChainId.OPTIMISTIC_KOVAN,
]
] as const
export type SupportedL2ChainId = typeof L2_CHAIN_IDS[number]
interface L1ChainInfo {
docs: string
explorer: string
infoLink: string
label: string
readonly docs: string
readonly explorer: string
readonly infoLink: string
readonly label: string
}
interface L2ChainInfo extends L1ChainInfo {
bridge: string
logoUrl: string
readonly bridge: string
readonly logoUrl: string
}
type ChainInfo = { [chainId in SupportedL2ChainId]: L2ChainInfo } &
{ [chainId in SupportedL1ChainId]: L1ChainInfo } & { [chainId: number]: L1ChainInfo | L2ChainInfo }
type ChainInfo = { readonly [chainId: number]: L1ChainInfo | L2ChainInfo } & {
readonly [chainId in SupportedL2ChainId]: L2ChainInfo
} &
{ readonly [chainId in SupportedL1ChainId]: L1ChainInfo }
export const CHAIN_INFO: ChainInfo = {
[SupportedChainId.ARBITRUM_ONE]: {
......
......@@ -19,6 +19,9 @@ import {
WBTC,
ETH2X_FLI,
WETH9_EXTENDED,
DAI_OPTIMISM,
USDT_OPTIMISM,
WBTC_OPTIMISM,
} from './tokens'
type ChainTokenList = {
......@@ -58,6 +61,7 @@ const WETH_ONLY: ChainTokenList = Object.fromEntries(
export const BASES_TO_CHECK_TRADES_AGAINST: ChainTokenList = {
...WETH_ONLY,
[SupportedChainId.MAINNET]: [...WETH_ONLY[SupportedChainId.MAINNET], DAI, USDC, USDT, WBTC],
[SupportedChainId.OPTIMISM]: [...WETH_ONLY[SupportedChainId.OPTIMISM], DAI_OPTIMISM, USDT_OPTIMISM, WBTC_OPTIMISM],
}
export const ADDITIONAL_BASES: { [chainId: number]: { [tokenAddress: string]: Token[] } } = {
[SupportedChainId.MAINNET]: {
......
......@@ -44,6 +44,13 @@ export const USDT = new Token(
'USDT',
'Tether USD'
)
export const USDT_OPTIMISM = new Token(
SupportedChainId.OPTIMISM,
'0x94b008aA00579c1307B0EF2c499aD98a8ce58e58',
6,
'USDT',
'Tether USD'
)
export const WBTC = new Token(
SupportedChainId.MAINNET,
'0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
......@@ -51,6 +58,13 @@ export const WBTC = new Token(
'WBTC',
'Wrapped BTC'
)
export const WBTC_OPTIMISM = new Token(
SupportedChainId.OPTIMISM,
'0x68f180fcCe6836688e9084f035309E29Bf0A2095',
8,
'WBTC',
'Wrapped BTC'
)
export const FEI = new Token(
SupportedChainId.MAINNET,
'0x956F47F50A910163D8BF957Cf5846D573E7f87CA',
......
......@@ -4,8 +4,10 @@ export function constructSameAddressMap<T extends string>(
address: T,
additionalNetworks: SupportedChainId[] = []
): { [chainId: number]: T } {
return L1_CHAIN_IDS.concat(additionalNetworks).reduce<{ [chainId: number]: T }>((memo, chainId) => {
memo[chainId] = address
return memo
}, {})
return (L1_CHAIN_IDS as readonly SupportedChainId[])
.concat(additionalNetworks)
.reduce<{ [chainId: number]: T }>((memo, chainId) => {
memo[chainId] = address
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