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
384f674e
Unverified
Commit
384f674e
authored
Sep 23, 2021
by
Jordan Frankfurt
Committed by
GitHub
Sep 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(L2): add common bases to L2s (#2428)
* add common bases to L2s * pr feedback
parent
8de6bb6d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
19 deletions
+88
-19
index.tsx
src/components/CurrencyLogo/index.tsx
+31
-3
CommonBases.tsx
src/components/SearchModal/CommonBases.tsx
+6
-7
routing.ts
src/constants/routing.ts
+23
-2
tokens.ts
src/constants/tokens.ts
+28
-7
No files found.
src/components/CurrencyLogo/index.tsx
View file @
384f674e
import
{
Currency
}
from
'
@uniswap/sdk-core
'
import
{
Currency
}
from
'
@uniswap/sdk-core
'
import
{
SupportedChainId
}
from
'
constants/chains
'
import
React
,
{
useMemo
}
from
'
react
'
import
React
,
{
useMemo
}
from
'
react
'
import
styled
from
'
styled-components/macro
'
import
styled
from
'
styled-components/macro
'
...
@@ -7,8 +8,31 @@ import useHttpLocations from '../../hooks/useHttpLocations'
...
@@ -7,8 +8,31 @@ import useHttpLocations from '../../hooks/useHttpLocations'
import
{
WrappedTokenInfo
}
from
'
../../state/lists/wrappedTokenInfo
'
import
{
WrappedTokenInfo
}
from
'
../../state/lists/wrappedTokenInfo
'
import
Logo
from
'
../Logo
'
import
Logo
from
'
../Logo
'
export
const
getTokenLogoURL
=
(
address
:
string
)
=>
type
Network
=
'
ethereum
'
|
'
arbitrum
'
|
'
optimism
'
`https://raw.githubusercontent.com/uniswap/assets/master/blockchains/ethereum/assets/
${
address
}
/logo.png`
function
chainIdToNetworkName
(
networkId
:
SupportedChainId
):
Network
{
switch
(
networkId
)
{
case
SupportedChainId
.
MAINNET
:
return
'
ethereum
'
case
SupportedChainId
.
ARBITRUM_ONE
:
return
'
arbitrum
'
case
SupportedChainId
.
OPTIMISM
:
return
'
optimism
'
default
:
return
'
ethereum
'
}
}
export
const
getTokenLogoURL
=
(
address
:
string
,
chainId
:
SupportedChainId
=
SupportedChainId
.
MAINNET
):
string
|
void
=>
{
const
networkName
=
chainIdToNetworkName
(
chainId
)
const
networksWithUrls
=
[
SupportedChainId
.
ARBITRUM_ONE
,
SupportedChainId
.
MAINNET
,
SupportedChainId
.
OPTIMISM
]
if
(
networksWithUrls
.
includes
(
chainId
))
{
return
`https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/
${
networkName
}
/assets/
${
address
}
/logo.png`
}
}
const
StyledEthereumLogo
=
styled
.
img
<
{
size
:
string
}
>
`
const
StyledEthereumLogo
=
styled
.
img
<
{
size
:
string
}
>
`
width:
${({
size
})
=>
size
}
;
width:
${({
size
})
=>
size
}
;
...
@@ -41,7 +65,11 @@ export default function CurrencyLogo({
...
@@ -41,7 +65,11 @@ export default function CurrencyLogo({
if
(
!
currency
||
currency
.
isNative
)
return
[]
if
(
!
currency
||
currency
.
isNative
)
return
[]
if
(
currency
.
isToken
)
{
if
(
currency
.
isToken
)
{
const
defaultUrls
=
currency
.
chainId
===
1
?
[
getTokenLogoURL
(
currency
.
address
)]
:
[]
const
defaultUrls
=
[]
const
url
=
getTokenLogoURL
(
currency
.
address
,
currency
.
chainId
)
if
(
url
)
{
defaultUrls
.
push
(
url
)
}
if
(
currency
instanceof
WrappedTokenInfo
)
{
if
(
currency
instanceof
WrappedTokenInfo
)
{
return
[...
uriLocations
,
...
defaultUrls
]
return
[...
uriLocations
,
...
defaultUrls
]
}
}
...
...
src/components/SearchModal/CommonBases.tsx
View file @
384f674e
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Currency
}
from
'
@uniswap/sdk-core
'
import
{
Currency
}
from
'
@uniswap/sdk-core
'
import
{
AutoColumn
}
from
'
components/Column
'
import
CurrencyLogo
from
'
components/CurrencyLogo
'
import
QuestionHelper
from
'
components/QuestionHelper
'
import
{
AutoRow
}
from
'
components/Row
'
import
{
COMMON_BASES
}
from
'
constants/routing
'
import
{
Text
}
from
'
rebass
'
import
{
Text
}
from
'
rebass
'
import
styled
from
'
styled-components/macro
'
import
styled
from
'
styled-components/macro
'
import
{
currencyId
}
from
'
utils/currencyId
'
import
{
COMMON_BASES
}
from
'
../../constants/routing
'
import
{
currencyId
}
from
'
../../utils/currencyId
'
import
{
AutoColumn
}
from
'
../Column
'
import
CurrencyLogo
from
'
../CurrencyLogo
'
import
QuestionHelper
from
'
../QuestionHelper
'
import
{
AutoRow
}
from
'
../Row
'
const
MobileWrapper
=
styled
(
AutoColumn
)
`
const
MobileWrapper
=
styled
(
AutoColumn
)
`
${({
theme
})
=>
theme
.
mediaWidth
.
upToSmall
`
${({
theme
})
=>
theme
.
mediaWidth
.
upToSmall
`
...
...
src/constants/routing.ts
View file @
384f674e
...
@@ -5,6 +5,7 @@ import { SupportedChainId } from './chains'
...
@@ -5,6 +5,7 @@ import { SupportedChainId } from './chains'
import
{
import
{
AMPL
,
AMPL
,
DAI
,
DAI
,
DAI_ARBITRUM_ONE
,
DAI_OPTIMISM
,
DAI_OPTIMISM
,
ETH2X_FLI
,
ETH2X_FLI
,
ExtendedEther
,
ExtendedEther
,
...
@@ -15,8 +16,10 @@ import {
...
@@ -15,8 +16,10 @@ import {
TRIBE
,
TRIBE
,
USDC
,
USDC
,
USDT
,
USDT
,
USDT_ARBITRUM_ONE
,
USDT_OPTIMISM
,
USDT_OPTIMISM
,
WBTC
,
WBTC
,
WBTC_ARBITRUM_ONE
,
WBTC_OPTIMISM
,
WBTC_OPTIMISM
,
WETH9_EXTENDED
,
WETH9_EXTENDED
,
}
from
'
./tokens
'
}
from
'
./tokens
'
...
@@ -38,6 +41,12 @@ export const BASES_TO_CHECK_TRADES_AGAINST: ChainTokenList = {
...
@@ -38,6 +41,12 @@ export const BASES_TO_CHECK_TRADES_AGAINST: ChainTokenList = {
...
WETH_ONLY
,
...
WETH_ONLY
,
[
SupportedChainId
.
MAINNET
]:
[...
WETH_ONLY
[
SupportedChainId
.
MAINNET
],
DAI
,
USDC
,
USDT
,
WBTC
],
[
SupportedChainId
.
MAINNET
]:
[...
WETH_ONLY
[
SupportedChainId
.
MAINNET
],
DAI
,
USDC
,
USDT
,
WBTC
],
[
SupportedChainId
.
OPTIMISM
]:
[...
WETH_ONLY
[
SupportedChainId
.
OPTIMISM
],
DAI_OPTIMISM
,
USDT_OPTIMISM
,
WBTC_OPTIMISM
],
[
SupportedChainId
.
OPTIMISM
]:
[...
WETH_ONLY
[
SupportedChainId
.
OPTIMISM
],
DAI_OPTIMISM
,
USDT_OPTIMISM
,
WBTC_OPTIMISM
],
[
SupportedChainId
.
ARBITRUM_ONE
]:
[
...
WETH_ONLY
[
SupportedChainId
.
ARBITRUM_ONE
],
DAI_ARBITRUM_ONE
,
USDT_ARBITRUM_ONE
,
WBTC_ARBITRUM_ONE
,
],
}
}
export
const
ADDITIONAL_BASES
:
{
[
chainId
:
number
]:
{
[
tokenAddress
:
string
]:
Token
[]
}
}
=
{
export
const
ADDITIONAL_BASES
:
{
[
chainId
:
number
]:
{
[
tokenAddress
:
string
]:
Token
[]
}
}
=
{
[
SupportedChainId
.
MAINNET
]:
{
[
SupportedChainId
.
MAINNET
]:
{
...
@@ -84,14 +93,26 @@ export const COMMON_BASES: ChainCurrencyList = {
...
@@ -84,14 +93,26 @@ export const COMMON_BASES: ChainCurrencyList = {
[
SupportedChainId
.
KOVAN
]:
[
ExtendedEther
.
onChain
(
SupportedChainId
.
KOVAN
),
WETH9_EXTENDED
[
SupportedChainId
.
KOVAN
]],
[
SupportedChainId
.
KOVAN
]:
[
ExtendedEther
.
onChain
(
SupportedChainId
.
KOVAN
),
WETH9_EXTENDED
[
SupportedChainId
.
KOVAN
]],
[
SupportedChainId
.
ARBITRUM_ONE
]:
[
[
SupportedChainId
.
ARBITRUM_ONE
]:
[
ExtendedEther
.
onChain
(
SupportedChainId
.
ARBITRUM_ONE
),
ExtendedEther
.
onChain
(
SupportedChainId
.
ARBITRUM_ONE
),
DAI_ARBITRUM_ONE
,
USDT_ARBITRUM_ONE
,
WBTC_ARBITRUM_ONE
,
WETH9_EXTENDED
[
SupportedChainId
.
ARBITRUM_ONE
],
WETH9_EXTENDED
[
SupportedChainId
.
ARBITRUM_ONE
],
],
],
[
SupportedChainId
.
ARBITRUM_RINKEBY
]:
[
[
SupportedChainId
.
ARBITRUM_RINKEBY
]:
[
ExtendedEther
.
onChain
(
SupportedChainId
.
ARBITRUM_RINKEBY
),
ExtendedEther
.
onChain
(
SupportedChainId
.
ARBITRUM_RINKEBY
),
WETH9_EXTENDED
[
SupportedChainId
.
ARBITRUM_RINKEBY
],
WETH9_EXTENDED
[
SupportedChainId
.
ARBITRUM_RINKEBY
],
],
],
[
SupportedChainId
.
OPTIMISM
]:
[
ExtendedEther
.
onChain
(
SupportedChainId
.
OPTIMISM
)],
[
SupportedChainId
.
OPTIMISM
]:
[
[
SupportedChainId
.
OPTIMISTIC_KOVAN
]:
[
ExtendedEther
.
onChain
(
SupportedChainId
.
OPTIMISTIC_KOVAN
)],
ExtendedEther
.
onChain
(
SupportedChainId
.
OPTIMISM
),
DAI_OPTIMISM
,
USDT_OPTIMISM
,
WBTC_OPTIMISM
,
WETH9_EXTENDED
[
SupportedChainId
.
OPTIMISM
],
],
[
SupportedChainId
.
OPTIMISTIC_KOVAN
]:
[
ExtendedEther
.
onChain
(
SupportedChainId
.
OPTIMISTIC_KOVAN
),
WETH9_EXTENDED
[
SupportedChainId
.
OPTIMISTIC_KOVAN
],
],
}
}
// used to construct the list of all pairs we consider by default in the frontend
// used to construct the list of all pairs we consider by default in the frontend
...
...
src/constants/tokens.ts
View file @
384f674e
...
@@ -17,6 +17,20 @@ export const DAI = new Token(
...
@@ -17,6 +17,20 @@ export const DAI = new Token(
'
DAI
'
,
'
DAI
'
,
'
Dai Stablecoin
'
'
Dai Stablecoin
'
)
)
export
const
DAI_ARBITRUM_ONE
=
new
Token
(
SupportedChainId
.
ARBITRUM_ONE
,
'
0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1
'
,
18
,
'
DAI
'
,
'
Dai stable coin
'
)
export
const
DAI_OPTIMISM
=
new
Token
(
SupportedChainId
.
OPTIMISM
,
'
0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1
'
,
18
,
'
DAI
'
,
'
Dai stable coin
'
)
export
const
USDC
=
new
Token
(
export
const
USDC
=
new
Token
(
SupportedChainId
.
MAINNET
,
SupportedChainId
.
MAINNET
,
'
0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
'
,
'
0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
'
,
...
@@ -31,13 +45,6 @@ export const USDC_ARBITRUM = new Token(
...
@@ -31,13 +45,6 @@ export const USDC_ARBITRUM = new Token(
'
USDC
'
,
'
USDC
'
,
'
USD//C
'
'
USD//C
'
)
)
export
const
DAI_OPTIMISM
=
new
Token
(
SupportedChainId
.
OPTIMISM
,
'
0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1
'
,
18
,
'
DAI
'
,
'
Dai stable coin
'
)
export
const
USDT
=
new
Token
(
export
const
USDT
=
new
Token
(
SupportedChainId
.
MAINNET
,
SupportedChainId
.
MAINNET
,
'
0xdAC17F958D2ee523a2206206994597C13D831ec7
'
,
'
0xdAC17F958D2ee523a2206206994597C13D831ec7
'
,
...
@@ -45,6 +52,13 @@ export const USDT = new Token(
...
@@ -45,6 +52,13 @@ export const USDT = new Token(
'
USDT
'
,
'
USDT
'
,
'
Tether USD
'
'
Tether USD
'
)
)
export
const
USDT_ARBITRUM_ONE
=
new
Token
(
SupportedChainId
.
ARBITRUM_ONE
,
'
0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9
'
,
6
,
'
USDT
'
,
'
Tether USD
'
)
export
const
USDT_OPTIMISM
=
new
Token
(
export
const
USDT_OPTIMISM
=
new
Token
(
SupportedChainId
.
OPTIMISM
,
SupportedChainId
.
OPTIMISM
,
'
0x94b008aA00579c1307B0EF2c499aD98a8ce58e58
'
,
'
0x94b008aA00579c1307B0EF2c499aD98a8ce58e58
'
,
...
@@ -59,6 +73,13 @@ export const WBTC = new Token(
...
@@ -59,6 +73,13 @@ export const WBTC = new Token(
'
WBTC
'
,
'
WBTC
'
,
'
Wrapped BTC
'
'
Wrapped BTC
'
)
)
export
const
WBTC_ARBITRUM_ONE
=
new
Token
(
SupportedChainId
.
ARBITRUM_ONE
,
'
0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f
'
,
8
,
'
WBTC
'
,
'
Wrapped BTC
'
)
export
const
WBTC_OPTIMISM
=
new
Token
(
export
const
WBTC_OPTIMISM
=
new
Token
(
SupportedChainId
.
OPTIMISM
,
SupportedChainId
.
OPTIMISM
,
'
0x68f180fcCe6836688e9084f035309E29Bf0A2095
'
,
'
0x68f180fcCe6836688e9084f035309E29Bf0A2095
'
,
...
...
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