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
2962cd0e
Unverified
Commit
2962cd0e
authored
Jul 27, 2020
by
Moody Salem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(migrate v1): migrate v1 pages and formatting
parent
6a311aa6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
18 deletions
+18
-18
App.tsx
src/pages/App.tsx
+1
-1
MigrateV1Exchange.tsx
src/pages/MigrateV1/MigrateV1Exchange.tsx
+13
-13
RemoveV1Exchange.tsx
src/pages/MigrateV1/RemoveV1Exchange.tsx
+4
-4
No files found.
src/pages/App.tsx
View file @
2962cd0e
...
...
@@ -80,11 +80,11 @@ export default function App() {
<
Route
exact
path=
"/add"
component=
{
AddLiquidity
}
/>
<
Route
exact
path=
"/add/:currencyIdA"
component=
{
RedirectOldAddLiquidityPathStructure
}
/>
<
Route
exact
path=
"/add/:currencyIdA/:currencyIdB"
component=
{
RedirectDuplicateTokenIds
}
/>
<
Route
exact
strict
path=
"/remove/v1/:address"
component=
{
RemoveV1Exchange
}
/>
<
Route
exact
strict
path=
"/remove/:tokens"
component=
{
RedirectOldRemoveLiquidityPathStructure
}
/>
<
Route
exact
strict
path=
"/remove/:currencyIdA/:currencyIdB"
component=
{
RemoveLiquidity
}
/>
<
Route
exact
strict
path=
"/migrate/v1"
component=
{
MigrateV1
}
/>
<
Route
exact
strict
path=
"/migrate/v1/:address"
component=
{
MigrateV1Exchange
}
/>
<
Route
exact
strict
path=
"/remove/v1/:address"
component=
{
RemoveV1Exchange
}
/>
<
Route
component=
{
RedirectPathToSwapOnly
}
/>
</
Switch
>
</
Web3ReactManager
>
...
...
src/pages/MigrateV1/MigrateV1Exchange.tsx
View file @
2962cd0e
import
{
TransactionResponse
}
from
'
@ethersproject/abstract-provider
'
import
{
AddressZero
}
from
'
@ethersproject/constants
'
import
{
Currency
,
Fraction
,
JSBI
,
Percent
,
Token
,
TokenAmount
,
WETH
}
from
'
@uniswap/sdk
'
import
{
Currency
,
CurrencyAmount
,
Fraction
,
JSBI
,
Percent
,
Token
,
TokenAmount
,
WETH
}
from
'
@uniswap/sdk
'
import
React
,
{
useCallback
,
useMemo
,
useState
}
from
'
react
'
import
ReactGA
from
'
react-ga
'
import
{
Redirect
,
RouteComponentProps
}
from
'
react-router
'
...
...
@@ -28,21 +28,21 @@ import { getEtherscanLink, isAddress } from '../../utils'
import
{
BodyWrapper
}
from
'
../AppBody
'
import
{
EmptyState
}
from
'
./EmptyState
'
const
POOL_
TOKEN
_AMOUNT_MIN
=
new
Fraction
(
JSBI
.
BigInt
(
1
),
JSBI
.
BigInt
(
1000000
))
const
POOL_
CURRENCY
_AMOUNT_MIN
=
new
Fraction
(
JSBI
.
BigInt
(
1
),
JSBI
.
BigInt
(
1000000
))
const
WEI_DENOM
=
JSBI
.
exponentiate
(
JSBI
.
BigInt
(
10
),
JSBI
.
BigInt
(
18
))
const
ZERO
=
JSBI
.
BigInt
(
0
)
const
ONE
=
JSBI
.
BigInt
(
1
)
const
ZERO_FRACTION
=
new
Fraction
(
ZERO
,
ONE
)
const
ALLOWED_OUTPUT_MIN_PERCENT
=
new
Percent
(
JSBI
.
BigInt
(
10000
-
INITIAL_ALLOWED_SLIPPAGE
),
JSBI
.
BigInt
(
10000
))
function
FormattedPool
TokenAmount
({
tokenAmount
}:
{
tokenAmount
:
Token
Amount
})
{
function
FormattedPool
CurrencyAmount
({
currencyAmount
}:
{
currencyAmount
:
Currency
Amount
})
{
return
(
<>
{
token
Amount
.
equalTo
(
JSBI
.
BigInt
(
0
))
{
currency
Amount
.
equalTo
(
JSBI
.
BigInt
(
0
))
?
'
0
'
:
tokenAmount
.
greaterThan
(
POOL_TOKEN
_AMOUNT_MIN
)
?
token
Amount
.
toSignificant
(
4
)
:
`<${POOL_
TOKEN
_AMOUNT_MIN.toSignificant(1)}`
}
:
currencyAmount
.
greaterThan
(
POOL_CURRENCY
_AMOUNT_MIN
)
?
currency
Amount
.
toSignificant
(
4
)
:
`<${POOL_
CURRENCY
_AMOUNT_MIN.toSignificant(1)}`
}
</>
)
}
...
...
@@ -56,7 +56,7 @@ export function V1LiquidityInfo({
token
:
Token
liquidityTokenAmount
:
TokenAmount
tokenWorth
:
TokenAmount
ethWorth
:
Fraction
ethWorth
:
CurrencyAmount
})
{
const
{
chainId
}
=
useActiveWeb3React
()
...
...
@@ -66,7 +66,7 @@ export function V1LiquidityInfo({
<
CurrencyLogo
size=
"24px"
currency=
{
token
}
/>
<
div
style=
{
{
marginLeft
:
'
.75rem
'
}
}
>
<
TYPE
.
mediumHeader
>
{
<
FormattedPool
TokenAmount
token
Amount=
{
liquidityTokenAmount
}
/>
}{
'
'
}
{
<
FormattedPool
CurrencyAmount
currency
Amount=
{
liquidityTokenAmount
}
/>
}{
'
'
}
{
token
.
equals
(
WETH
[
chainId
])
?
'
WETH
'
:
token
.
symbol
}
/ETH
</
TYPE
.
mediumHeader
>
</
div
>
...
...
@@ -89,7 +89,7 @@ export function V1LiquidityInfo({
</
Text
>
<
RowFixed
>
<
Text
fontSize=
{
16
}
fontWeight=
{
500
}
marginLeft=
{
'
6px
'
}
>
{
ethWorth
.
toSignificant
(
4
)
}
<
FormattedPoolCurrencyAmount
currencyAmount=
{
ethWorth
}
/>
</
Text
>
<
CurrencyLogo
size=
"20px"
style=
{
{
marginLeft
:
'
8px
'
}
}
currency=
{
Currency
.
ETHER
}
/>
</
RowFixed
>
...
...
@@ -114,9 +114,9 @@ function V1PairMigration({ liquidityTokenAmount, token }: { liquidityTokenAmount
const
shareFraction
:
Fraction
=
totalSupply
?
new
Percent
(
liquidityTokenAmount
.
raw
,
totalSupply
.
raw
)
:
ZERO_FRACTION
const
ethWorth
:
Fraction
=
exchangeETHBalance
?
new
Fraction
(
shareFraction
.
multiply
(
exchangeETHBalance
).
quotient
,
WEI_DENOM
)
:
ZERO_FRACTION
const
ethWorth
:
CurrencyAmount
=
exchangeETHBalance
?
CurrencyAmount
.
ether
(
exchangeETHBalance
.
multiply
(
shareFraction
).
multiply
(
WEI_DENOM
).
quotient
)
:
CurrencyAmount
.
ether
(
ZERO
)
const
tokenWorth
:
TokenAmount
=
exchangeTokenBalance
?
new
TokenAmount
(
token
,
shareFraction
.
multiply
(
exchangeTokenBalance
.
raw
).
quotient
)
...
...
src/pages/MigrateV1/RemoveV1Exchange.tsx
View file @
2962cd0e
import
{
TransactionResponse
}
from
'
@ethersproject/abstract-provider
'
import
{
JSBI
,
Token
,
TokenAmount
,
WETH
,
Fraction
,
Percent
}
from
'
@uniswap/sdk
'
import
{
JSBI
,
Token
,
TokenAmount
,
WETH
,
Fraction
,
Percent
,
CurrencyAmount
}
from
'
@uniswap/sdk
'
import
React
,
{
useCallback
,
useMemo
,
useState
}
from
'
react
'
import
ReactGA
from
'
react-ga
'
import
{
Redirect
,
RouteComponentProps
}
from
'
react-router
'
...
...
@@ -49,9 +49,9 @@ function V1PairRemoval({
const
shareFraction
:
Fraction
=
totalSupply
?
new
Percent
(
liquidityTokenAmount
.
raw
,
totalSupply
.
raw
)
:
ZERO_FRACTION
const
ethWorth
:
Fraction
=
exchangeETHBalance
?
new
Fraction
(
shareFraction
.
multiply
(
exchangeETHBalance
).
quotient
,
WEI_DENOM
)
:
ZERO_FRACTION
const
ethWorth
:
CurrencyAmount
=
exchangeETHBalance
?
CurrencyAmount
.
ether
(
exchangeETHBalance
.
multiply
(
shareFraction
).
multiply
(
WEI_DENOM
).
quotient
)
:
CurrencyAmount
.
ether
(
ZERO
)
const
tokenWorth
:
TokenAmount
=
exchangeTokenBalance
?
new
TokenAmount
(
token
,
shareFraction
.
multiply
(
exchangeTokenBalance
.
raw
).
quotient
)
...
...
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