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
dbc9e85b
Unverified
Commit
dbc9e85b
authored
Apr 26, 2021
by
Noah Zinsmeister
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixes
parent
7dafb0cf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
37 deletions
+50
-37
PositionPage.tsx
src/pages/Pool/PositionPage.tsx
+4
-2
V3.tsx
src/pages/RemoveLiquidity/V3.tsx
+28
-24
hooks.ts
src/state/burn/v3/hooks.ts
+6
-1
hooks.ts
src/state/mint/hooks.ts
+12
-10
No files found.
src/pages/Pool/PositionPage.tsx
View file @
dbc9e85b
...
...
@@ -116,7 +116,7 @@ export function PositionPage({
// construct Position from details returned
const
[
poolState
,
pool
]
=
usePool
(
currency0
??
undefined
,
currency1
??
undefined
,
feeAmount
)
const
position
=
useMemo
(()
=>
{
if
(
pool
&&
liquidity
&&
t
ickLower
&&
tickUpper
)
{
if
(
pool
&&
liquidity
&&
t
ypeof
tickLower
===
'
number
'
&&
typeof
tickUpper
===
'
number
'
)
{
return
new
Position
({
pool
,
liquidity
:
liquidity
.
toString
(),
tickLower
,
tickUpper
})
}
return
undefined
...
...
@@ -129,7 +129,9 @@ export function PositionPage({
// check if price is within range
const
outOfRange
:
boolean
=
pool
&&
tickLower
&&
tickUpper
?
pool
.
tickCurrent
<
tickLower
||
pool
.
tickCurrent
>
tickUpper
:
false
pool
&&
typeof
tickLower
===
'
number
'
&&
typeof
tickUpper
===
'
number
'
?
pool
.
tickCurrent
<
tickLower
||
pool
.
tickCurrent
>
tickUpper
:
false
// fees
const
[
feeValue0
,
feeValue1
]
=
useV3PositionFees
(
pool
??
undefined
,
positionDetails
)
...
...
src/pages/RemoveLiquidity/V3.tsx
View file @
dbc9e85b
...
...
@@ -251,7 +251,7 @@ function Remove({ tokenId }: { tokenId: BigNumber }) {
</
RowBetween
>
<
LightCard
>
<
AutoColumn
gap=
"md"
>
<
TYPE
.
main
fontWeight=
{
400
}
>
Withdrawl
Amount
</
TYPE
.
main
>
<
TYPE
.
main
fontWeight=
{
400
}
>
Amount
</
TYPE
.
main
>
<
RowBetween
>
<
TYPE
.
label
fontSize=
"40px"
>
{
percentForSlider
}
%
</
TYPE
.
label
>
<
AutoRow
gap=
"4px"
justify=
"flex-end"
>
...
...
@@ -296,29 +296,33 @@ function Remove({ tokenId }: { tokenId: BigNumber }) {
<
CurrencyLogo
size=
"20px"
style=
{
{
marginLeft
:
'
8px
'
}
}
currency=
{
liquidityValue1
?.
token
}
/>
</
RowFixed
>
</
RowBetween
>
<
Break
/>
<
RowBetween
>
<
Text
fontSize=
{
16
}
fontWeight=
{
500
}
>
{
currency0
?.
symbol
}
Fees:
</
Text
>
<
RowFixed
>
<
Text
fontSize=
{
16
}
fontWeight=
{
500
}
marginLeft=
{
'
6px
'
}
>
{
feeValue0
&&
<
FormattedCurrencyAmount
currencyAmount=
{
feeValue0
}
/>
}
</
Text
>
<
CurrencyLogo
size=
"20px"
style=
{
{
marginLeft
:
'
8px
'
}
}
currency=
{
feeValue0
?.
token
}
/>
</
RowFixed
>
</
RowBetween
>
<
RowBetween
>
<
Text
fontSize=
{
16
}
fontWeight=
{
500
}
>
{
currency1
?.
symbol
}
Fees:
</
Text
>
<
RowFixed
>
<
Text
fontSize=
{
16
}
fontWeight=
{
500
}
marginLeft=
{
'
6px
'
}
>
{
feeValue1
&&
<
FormattedCurrencyAmount
currencyAmount=
{
feeValue1
}
/>
}
</
Text
>
<
CurrencyLogo
size=
"20px"
style=
{
{
marginLeft
:
'
8px
'
}
}
currency=
{
feeValue1
?.
token
}
/>
</
RowFixed
>
</
RowBetween
>
{
feeValue0
?.
greaterThan
(
0
)
||
feeValue1
?.
greaterThan
(
0
)
?
(
<>
<
Break
/>
<
RowBetween
>
<
Text
fontSize=
{
16
}
fontWeight=
{
500
}
>
{
currency0
?.
symbol
}
Fees Earned:
</
Text
>
<
RowFixed
>
<
Text
fontSize=
{
16
}
fontWeight=
{
500
}
marginLeft=
{
'
6px
'
}
>
{
feeValue0
&&
<
FormattedCurrencyAmount
currencyAmount=
{
feeValue0
}
/>
}
</
Text
>
<
CurrencyLogo
size=
"20px"
style=
{
{
marginLeft
:
'
8px
'
}
}
currency=
{
feeValue0
?.
token
}
/>
</
RowFixed
>
</
RowBetween
>
<
RowBetween
>
<
Text
fontSize=
{
16
}
fontWeight=
{
500
}
>
{
currency1
?.
symbol
}
Fees Earned:
</
Text
>
<
RowFixed
>
<
Text
fontSize=
{
16
}
fontWeight=
{
500
}
marginLeft=
{
'
6px
'
}
>
{
feeValue1
&&
<
FormattedCurrencyAmount
currencyAmount=
{
feeValue1
}
/>
}
</
Text
>
<
CurrencyLogo
size=
"20px"
style=
{
{
marginLeft
:
'
8px
'
}
}
currency=
{
feeValue1
?.
token
}
/>
</
RowFixed
>
</
RowBetween
>
</>
)
:
null
}
</
AutoColumn
>
</
LightCard
>
<
div
style=
{
{
display
:
'
flex
'
}
}
>
...
...
src/state/burn/v3/hooks.ts
View file @
dbc9e85b
...
...
@@ -37,7 +37,12 @@ export function useDerivedV3BurnInfo(
const
partialPosition
=
useMemo
(
()
=>
pool
&&
position
?.
liquidity
&&
position
?.
tickLower
&&
position
?.
tickLower
pool
&&
position
?.
liquidity
&&
position
?.
tickLower
&&
position
?.
tickUpper
&&
typeof
position
.
tickLower
===
'
number
'
&&
typeof
position
.
tickUpper
===
'
number
'
?
new
Position
({
pool
,
liquidity
:
position
.
liquidity
.
mul
(
percent
).
div
(
100
).
toString
(),
...
...
src/state/mint/hooks.ts
View file @
dbc9e85b
...
...
@@ -205,16 +205,18 @@ export function useDerivedMintInfo(
[
key
:
string
]:
number
|
undefined
}
=
useMemo
(()
=>
{
return
{
[
Bound
.
LOWER
]:
existingPosition
?.
tickLower
?
existingPosition
?.
tickLower
:
invertPrice
?
tryParseTick
(
token1
,
token0
,
feeAmount
,
rightRangeTypedValue
)
:
tryParseTick
(
token0
,
token1
,
feeAmount
,
leftRangeTypedValue
),
[
Bound
.
UPPER
]:
existingPosition
?.
tickUpper
?
existingPosition
?.
tickUpper
:
invertPrice
?
tryParseTick
(
token1
,
token0
,
feeAmount
,
leftRangeTypedValue
)
:
tryParseTick
(
token0
,
token1
,
feeAmount
,
rightRangeTypedValue
),
[
Bound
.
LOWER
]:
existingPosition
?.
tickLower
&&
typeof
existingPosition
.
tickLower
===
'
number
'
?
existingPosition
.
tickLower
:
invertPrice
?
tryParseTick
(
token1
,
token0
,
feeAmount
,
rightRangeTypedValue
)
:
tryParseTick
(
token0
,
token1
,
feeAmount
,
leftRangeTypedValue
),
[
Bound
.
UPPER
]:
existingPosition
?.
tickUpper
&&
typeof
existingPosition
.
tickUpper
===
'
number
'
?
existingPosition
?.
tickUpper
:
invertPrice
?
tryParseTick
(
token1
,
token0
,
feeAmount
,
leftRangeTypedValue
)
:
tryParseTick
(
token0
,
token1
,
feeAmount
,
rightRangeTypedValue
),
}
},
[
existingPosition
,
feeAmount
,
invertPrice
,
leftRangeTypedValue
,
rightRangeTypedValue
,
token0
,
token1
])
...
...
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