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
0540012b
Unverified
Commit
0540012b
authored
Apr 30, 2021
by
Noah Zinsmeister
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WETH -> ETH in migrate
fix rates in migrate fix migrate link
parent
3f6bf607
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
28 deletions
+35
-28
index.tsx
src/components/RateToggle/index.tsx
+2
-4
MigrateV2Pair.tsx
src/pages/MigrateV2/MigrateV2Pair.tsx
+32
-23
index.tsx
src/pages/Pool/index.tsx
+1
-1
No files found.
src/components/RateToggle/index.tsx
View file @
0540012b
...
...
@@ -2,7 +2,6 @@ import React from 'react'
import
{
Currency
}
from
'
@uniswap/sdk-core
'
import
{
ToggleElement
,
ToggleWrapper
}
from
'
components/Toggle/MultiToggle
'
import
{
useActiveWeb3React
}
from
'
hooks
'
import
{
useTranslation
}
from
'
react-i18next
'
import
{
wrappedCurrency
}
from
'
utils/wrappedCurrency
'
// the order of displayed base currencies from left to right is always in sort order
...
...
@@ -16,7 +15,6 @@ export default function RateToggle({
currencyB
:
Currency
handleRateToggle
:
()
=>
void
})
{
const
{
t
}
=
useTranslation
()
const
{
chainId
}
=
useActiveWeb3React
()
const
tokenA
=
wrappedCurrency
(
currencyA
,
chainId
)
...
...
@@ -27,10 +25,10 @@ export default function RateToggle({
return
tokenA
&&
tokenB
?
(
<
ToggleWrapper
width=
"fit-content"
>
<
ToggleElement
isActive=
{
isSorted
}
fontSize=
"12px"
onClick=
{
handleRateToggle
}
>
{
isSorted
?
currencyA
.
symbol
:
currencyB
.
symbol
}
{
t
(
'
rate
'
)
}
{
isSorted
?
currencyA
.
symbol
:
currencyB
.
symbol
}
</
ToggleElement
>
<
ToggleElement
isActive=
{
!
isSorted
}
fontSize=
"12px"
onClick=
{
handleRateToggle
}
>
{
isSorted
?
currencyB
.
symbol
:
currencyA
.
symbol
}
{
t
(
'
rate
'
)
}
{
isSorted
?
currencyB
.
symbol
:
currencyA
.
symbol
}
</
ToggleElement
>
</
ToggleWrapper
>
)
:
null
...
...
src/pages/MigrateV2/MigrateV2Pair.tsx
View file @
0540012b
...
...
@@ -41,6 +41,7 @@ import { Contract } from '@ethersproject/contracts'
import
useCurrentBlockTimestamp
from
'
hooks/useCurrentBlockTimestamp
'
import
{
formatTokenAmount
}
from
'
utils/formatTokenAmount
'
import
useTheme
from
'
hooks/useTheme
'
import
{
unwrappedToken
}
from
'
utils/wrappedCurrency
'
const
ZERO
=
JSBI
.
BigInt
(
0
)
...
...
@@ -53,28 +54,31 @@ function EmptyState({ message }: { message: string }) {
}
function
LiquidityInfo
({
token0Amount
,
token1Amount
}:
{
token0Amount
:
TokenAmount
;
token1Amount
:
TokenAmount
})
{
const
currency0
=
unwrappedToken
(
token0Amount
.
token
)
const
currency1
=
unwrappedToken
(
token1Amount
.
token
)
return
(
<>
<
RowBetween
my=
"1rem"
>
<
Text
fontSize=
{
16
}
fontWeight=
{
500
}
>
Pooled
{
token0Amount
.
token
.
symbol
}
:
Pooled
{
currency0
.
symbol
}
:
</
Text
>
<
RowFixed
>
<
Text
fontSize=
{
16
}
fontWeight=
{
500
}
marginLeft=
{
'
6px
'
}
>
<
FormattedCurrencyAmount
currencyAmount=
{
token0Amount
}
/>
</
Text
>
<
CurrencyLogo
size=
"20px"
style=
{
{
marginLeft
:
'
8px
'
}
}
currency=
{
token0Amount
.
token
}
/>
<
CurrencyLogo
size=
"20px"
style=
{
{
marginLeft
:
'
8px
'
}
}
currency=
{
currency0
}
/>
</
RowFixed
>
</
RowBetween
>
<
RowBetween
mb=
"1rem"
>
<
Text
fontSize=
{
16
}
fontWeight=
{
500
}
>
Pooled
{
token1Amount
.
token
.
symbol
}
:
Pooled
{
currency1
.
symbol
}
:
</
Text
>
<
RowFixed
>
<
Text
fontSize=
{
16
}
fontWeight=
{
500
}
marginLeft=
{
'
6px
'
}
>
<
FormattedCurrencyAmount
currencyAmount=
{
token1Amount
}
/>
</
Text
>
<
CurrencyLogo
size=
"20px"
style=
{
{
marginLeft
:
'
8px
'
}
}
currency=
{
token1Amount
.
token
}
/>
<
CurrencyLogo
size=
"20px"
style=
{
{
marginLeft
:
'
8px
'
}
}
currency=
{
currency1
}
/>
</
RowFixed
>
</
RowBetween
>
</>
...
...
@@ -109,6 +113,9 @@ function V2PairMigration({
const
blockTimestamp
=
useCurrentBlockTimestamp
()
const
[
allowedSlippage
]
=
useUserSlippageTolerance
()
// custom from users
const
currency0
=
unwrappedToken
(
token0
)
const
currency1
=
unwrappedToken
(
token1
)
// this is just getLiquidityValue with the fee off, but for the passed pair
const
token0Value
=
useMemo
(
()
=>
new
TokenAmount
(
token0
,
JSBI
.
divide
(
JSBI
.
multiply
(
pairBalance
.
raw
,
reserve0
.
raw
),
totalSupply
.
raw
)),
...
...
@@ -295,11 +302,11 @@ function V2PairMigration({
ReactGA
.
event
({
category
:
'
Migrate
'
,
action
:
'
V2->V3
'
,
label
:
`
${
token0
.
symbol
}
/
${
token
1
.
symbol
}
`
,
label
:
`
${
currency0
.
symbol
}
/
${
currency
1
.
symbol
}
`
,
})
addTransaction
(
response
,
{
summary
:
`Migrate
${
token0
.
symbol
}
/
${
token
1
.
symbol
}
liquidity to V3`
,
summary
:
`Migrate
${
currency0
.
symbol
}
/
${
currency
1
.
symbol
}
liquidity to V3`
,
})
setPendingMigrationHash
(
response
.
hash
)
})
...
...
@@ -324,6 +331,8 @@ function V2PairMigration({
signatureData
,
addTransaction
,
pair
,
currency0
,
currency1
,
])
const
isSuccessfullyMigrated
=
!!
pendingMigrationHash
&&
JSBI
.
equal
(
pairBalance
.
raw
,
ZERO
)
...
...
@@ -357,11 +366,11 @@ function V2PairMigration({
<
AutoColumn
gap=
"8px"
>
<
RowBetween
>
<
TYPE
.
body
>
V2 Price:
</
TYPE
.
body
>
<
TYPE
.
body
>
V2
{
invertPrice
?
currency1
.
symbol
:
currency0
.
symbol
}
Price:
</
TYPE
.
body
>
<
TYPE
.
black
>
{
invertPrice
?
`${v2SpotPrice?.invert()?.toSignificant(6)} ${
token0.symbol} / ${token1
.symbol}`
:
`${v2SpotPrice?.toSignificant(6)} ${
token1.symbol} / ${token0
.symbol}`
}
?
`${v2SpotPrice?.invert()?.toSignificant(6)} ${
currency0
.symbol}`
:
`${v2SpotPrice?.toSignificant(6)} ${
currency1
.symbol}`
}
</
TYPE
.
black
>
</
RowBetween
>
</
AutoColumn
>
...
...
@@ -376,20 +385,20 @@ function V2PairMigration({
</
TYPE
.
body
>
<
AutoColumn
gap=
"8px"
>
<
RowBetween
>
<
TYPE
.
body
>
V2 Price:
</
TYPE
.
body
>
<
TYPE
.
body
>
V2
{
invertPrice
?
currency1
.
symbol
:
currency0
.
symbol
}
Price:
</
TYPE
.
body
>
<
TYPE
.
black
>
{
invertPrice
?
`${v2SpotPrice?.invert()?.toSignificant(6)} ${
token0.symbol} / ${token1
.symbol}`
:
`${v2SpotPrice?.toSignificant(6)} ${
token1.symbol} / ${token0
.symbol}`
}
?
`${v2SpotPrice?.invert()?.toSignificant(6)} ${
currency0
.symbol}`
:
`${v2SpotPrice?.toSignificant(6)} ${
currency1
.symbol}`
}
</
TYPE
.
black
>
</
RowBetween
>
<
RowBetween
>
<
TYPE
.
body
>
V3 Price:
</
TYPE
.
body
>
<
TYPE
.
body
>
V3
{
invertPrice
?
currency1
.
symbol
:
currency0
.
symbol
}
Price:
</
TYPE
.
body
>
<
TYPE
.
black
>
{
invertPrice
?
`${v3SpotPrice?.invert()?.toSignificant(6)} ${
token0.symbol} / ${token1
.symbol}`
:
`${v3SpotPrice?.toSignificant(6)} ${
token1.symbol} / ${token0
.symbol}`
}
?
`${v3SpotPrice?.invert()?.toSignificant(6)} ${
currency0
.symbol}`
:
`${v3SpotPrice?.toSignificant(6)} ${
currency1
.symbol}`
}
</
TYPE
.
black
>
</
RowBetween
>
...
...
@@ -406,8 +415,8 @@ function V2PairMigration({
<
RowBetween
>
<
TYPE
.
label
>
{
t
(
'
selectLiquidityRange
'
)
}
</
TYPE
.
label
>
<
RateToggle
currencyA=
{
invertPrice
?
token1
:
token
0
}
currencyB=
{
invertPrice
?
token0
:
token
1
}
currencyA=
{
invertPrice
?
currency1
:
currency
0
}
currencyB=
{
invertPrice
?
currency0
:
currency
1
}
handleRateToggle=
{
()
=>
{
onLeftRangeInput
(
''
)
onRightRangeInput
(
''
)
...
...
@@ -425,8 +434,8 @@ function V2PairMigration({
getIncrementUpper=
{
getIncrementUpper
}
onLeftRangeInput=
{
onLeftRangeInput
}
onRightRangeInput=
{
onRightRangeInput
}
currencyA=
{
invertPrice
?
token1
:
token
0
}
currencyB=
{
invertPrice
?
token0
:
token
1
}
currencyA=
{
invertPrice
?
currency1
:
currency
0
}
currencyB=
{
invertPrice
?
currency0
:
currency
1
}
feeAmount=
{
feeAmount
}
/>
...
...
@@ -512,10 +521,10 @@ function V2PairMigration({
)
:
null
}
</
LightCard
>
<
TYPE
.
darkGray
style=
{
{
textAlign
:
'
center
'
}
}
>
{
`Your Uniswap V2 ${invertPrice ?
token0?.symbol : token
1?.symbol} / ${
invertPrice ?
token1?.symbol : token
0?.symbol
} liquidity tokens will become a Uniswap V3 ${invertPrice ?
token0?.symbol : token
1?.symbol} / ${
invertPrice ?
token1?.symbol : token
0?.symbol
{
`Your Uniswap V2 ${invertPrice ?
currency0?.symbol : currency
1?.symbol} / ${
invertPrice ?
currency1?.symbol : currency
0?.symbol
} liquidity tokens will become a Uniswap V3 ${invertPrice ?
currency0?.symbol : currency
1?.symbol} / ${
invertPrice ?
currency1?.symbol : currency
0?.symbol
} NFT.`
}
</
TYPE
.
darkGray
>
</
AutoColumn
>
...
...
src/pages/Pool/index.tsx
View file @
0540012b
...
...
@@ -113,7 +113,7 @@ export default function Pool() {
{
t
(
'
Migrate Liquidity
'
)
}
</
MenuItem
>
),
link
:
'
/
#/
migrate/v2
'
,
link
:
'
/migrate/v2
'
,
external
:
false
,
},
{
...
...
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