Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
f0d10ba0
Unverified
Commit
f0d10ba0
authored
Jul 14, 2021
by
Moody Salem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: add DAI and WBTC and USDT to routing for Optimism
fixes
https://github.com/Uniswap/uniswap-interface/issues/2016
parent
88600d3a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
27 deletions
+41
-27
chains.ts
src/constants/chains.ts
+17
-23
routing.ts
src/constants/routing.ts
+4
-0
tokens.ts
src/constants/tokens.ts
+14
-0
constructSameAddressMap.ts
src/utils/constructSameAddressMap.ts
+6
-4
No files found.
src/constants/chains.ts
View file @
f0d10ba0
...
...
@@ -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
]:
{
...
...
src/constants/routing.ts
View file @
f0d10ba0
...
...
@@ -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
]:
{
...
...
src/constants/tokens.ts
View file @
f0d10ba0
...
...
@@ -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
'
,
...
...
src/utils/constructSameAddressMap.ts
View file @
f0d10ba0
...
...
@@ -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
},
{})
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment