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
68518d7c
Unverified
Commit
68518d7c
authored
Jun 07, 2021
by
Noah Zinsmeister
Committed by
GitHub
Jun 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix[migrate]: use proper slippage check (#1821)
parent
2c9c99b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
26 deletions
+6
-26
MigrateV2Pair.tsx
src/pages/MigrateV2/MigrateV2Pair.tsx
+6
-26
No files found.
src/pages/MigrateV2/MigrateV2Pair.tsx
View file @
68518d7c
...
@@ -209,33 +209,13 @@ function V2PairMigration({
...
@@ -209,33 +209,13 @@ function V2PairMigration({
tickUpper
,
tickUpper
,
amount0
:
token0Value
.
quotient
,
amount0
:
token0Value
.
quotient
,
amount1
:
token1Value
.
quotient
,
amount1
:
token1Value
.
quotient
,
useFullPrecision
:
false
,
// we don't want full precision as this is used to calculate slippage amounts
useFullPrecision
:
true
,
// we want full precision for the theoretical position
})
})
:
undefined
:
undefined
const
v3Amount0Min
=
useMemo
(
const
{
amount0
:
v3Amount0Min
,
amount1
:
v3Amount1Min
}
=
useMemo
(
()
=>
()
=>
(
position
?
position
.
mintAmountsWithSlippage
(
allowedSlippage
)
:
{
amount0
:
undefined
,
amount1
:
undefined
}),
position
&&
[
position
,
allowedSlippage
]
CurrencyAmount
.
fromRawAmount
(
token0
,
JSBI
.
divide
(
JSBI
.
multiply
(
position
.
amount0
.
quotient
,
JSBI
.
BigInt
(
10000
-
JSBI
.
toNumber
(
allowedSlippage
.
numerator
))),
JSBI
.
BigInt
(
10000
)
)
),
[
token0
,
position
,
allowedSlippage
]
)
const
v3Amount1Min
=
useMemo
(
()
=>
position
&&
CurrencyAmount
.
fromRawAmount
(
token1
,
JSBI
.
divide
(
JSBI
.
multiply
(
position
.
amount1
.
quotient
,
JSBI
.
BigInt
(
10000
-
JSBI
.
toNumber
(
allowedSlippage
.
numerator
))),
JSBI
.
BigInt
(
10000
)
)
),
[
token1
,
position
,
allowedSlippage
]
)
)
const
refund0
=
useMemo
(
const
refund0
=
useMemo
(
...
@@ -336,8 +316,8 @@ function V2PairMigration({
...
@@ -336,8 +316,8 @@ function V2PairMigration({
fee
:
feeAmount
,
fee
:
feeAmount
,
tickLower
,
tickLower
,
tickUpper
,
tickUpper
,
amount0Min
:
`0x
${
v3Amount0Min
.
quotient
.
toString
(
16
)}
`
,
amount0Min
:
`0x
${
v3Amount0Min
.
toString
(
16
)}
`
,
amount1Min
:
`0x
${
v3Amount1Min
.
quotient
.
toString
(
16
)}
`
,
amount1Min
:
`0x
${
v3Amount1Min
.
toString
(
16
)}
`
,
recipient
:
account
,
recipient
:
account
,
deadline
:
deadlineToUse
,
deadline
:
deadlineToUse
,
refundAsETH
:
true
,
// hard-code this for now
refundAsETH
:
true
,
// hard-code this for now
...
...
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