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
04584cc4
Unverified
Commit
04584cc4
authored
May 20, 2020
by
Moody Salem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the add liquidity link from uniswap.info
parent
7d20dd97
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
12 deletions
+4
-12
Tokens.ts
src/hooks/Tokens.ts
+1
-1
index.tsx
src/pages/AddLiquidity/index.tsx
+3
-11
No files found.
src/hooks/Tokens.ts
View file @
04584cc4
...
...
@@ -29,7 +29,7 @@ export function useAllTokens(): { [address: string]: Token } {
// we have to replace it as a workaround because if it is automatically
// fetched by address it will cause an invariant when used in constructing
// pairs since we replace the name and symbol with 'ETH' and 'Ether'
tokens
[
weth
.
address
]
=
WETH
[
chainId
as
ChainId
]
tokens
[
weth
.
address
]
=
weth
}
return
tokens
},
[
userAddedTokens
,
chainId
])
...
...
src/pages/AddLiquidity/index.tsx
View file @
04584cc4
...
...
@@ -27,7 +27,7 @@ import { usePair } from '../../data/Reserves'
import
{
useTotalSupply
}
from
'
../../data/TotalSupply
'
import
{
useTokenContract
,
useActiveWeb3React
}
from
'
../../hooks
'
import
{
useToken
ByAddressAndAutomaticallyAdd
}
from
'
../../hooks/Tokens
'
import
{
useToken
}
from
'
../../hooks/Tokens
'
import
{
useHasPendingApproval
,
useTransactionAdder
}
from
'
../../state/transactions/hooks
'
import
{
useTokenBalanceTreatingWETHasETH
}
from
'
../../state/wallet/hooks
'
import
{
TYPE
}
from
'
../../theme
'
...
...
@@ -135,14 +135,6 @@ function reducer(
}
}
function
useTokenByAddressOrETHAndAutomaticallyAdd
(
tokenId
?:
string
,
chainId
?:
number
):
Token
|
undefined
{
const
isWETH
=
tokenId
?.
toUpperCase
()
===
'
ETH
'
||
tokenId
?.
toUpperCase
()
===
'
WETH
'
const
tokenByAddress
=
useTokenByAddressAndAutomaticallyAdd
(
isWETH
?
null
:
tokenId
)
return
isWETH
?
WETH
[
chainId
]
:
tokenByAddress
}
export
default
function
AddLiquidity
({
match
:
{
params
}
}:
RouteComponentProps
<
{
tokens
:
string
}
>
)
{
const
[
token0
,
token1
]
=
params
.
tokens
.
split
(
'
-
'
)
...
...
@@ -162,8 +154,8 @@ export default function AddLiquidity({ match: { params } }: RouteComponentProps<
// get basic SDK entities
const
tokens
:
{
[
field
in
Field
]:
Token
}
=
{
[
Field
.
INPUT
]:
useToken
ByAddressOrETHAndAutomaticallyAdd
(
fieldData
[
Field
.
INPUT
].
address
,
chainId
),
[
Field
.
OUTPUT
]:
useToken
ByAddressOrETHAndAutomaticallyAdd
(
fieldData
[
Field
.
OUTPUT
].
address
,
chainId
)
[
Field
.
INPUT
]:
useToken
(
fieldData
[
Field
.
INPUT
].
address
),
[
Field
.
OUTPUT
]:
useToken
(
fieldData
[
Field
.
OUTPUT
].
address
)
}
// token contracts for approvals and direct sends
...
...
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