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
a6d8613b
Commit
a6d8613b
authored
Mar 06, 2020
by
ianlapham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated position cards
parent
2ca3bf8d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
8 deletions
+14
-8
index.js
src/components/PositionCard/index.js
+10
-2
RemoveLiquidity.tsx
src/pages/Supply/RemoveLiquidity.tsx
+4
-6
No files found.
src/components/PositionCard/index.js
View file @
a6d8613b
...
...
@@ -35,8 +35,16 @@ function PositionCard({ exchangeAddress, token0, token1, history, minimal = fals
const
poolTokenPercentage
=
!!
userPoolBalance
&&
!!
totalPoolTokens
?
new
Percent
(
userPoolBalance
.
raw
,
totalPoolTokens
.
raw
)
:
undefined
const
token0Deposited
=
poolTokenPercentage
?.
multiply
(
allBalances
[
exchangeAddress
][
token0
.
address
])
const
token1Deposited
=
poolTokenPercentage
?.
multiply
(
allBalances
[
exchangeAddress
][
token1
.
address
])
const
token0Deposited
=
token0
&&
totalPoolTokens
&&
userPoolBalance
&&
exchange
.
getLiquidityValue
(
token0
,
totalPoolTokens
,
userPoolBalance
,
false
)
const
token1Deposited
=
token1
&&
totalPoolTokens
&&
userPoolBalance
&&
exchange
.
getLiquidityValue
(
token1
,
totalPoolTokens
,
userPoolBalance
,
false
)
function
DynamicCard
({
children
,
...
rest
})
{
if
(
!
minimal
)
{
...
...
src/pages/Supply/RemoveLiquidity.tsx
View file @
a6d8613b
...
...
@@ -2,7 +2,7 @@ import React, { useReducer, useState, useCallback, useEffect } from 'react'
import
styled
from
'
styled-components
'
import
{
ethers
}
from
'
ethers
'
import
{
parseUnits
}
from
'
@ethersproject/units
'
import
{
TokenAmount
,
JSBI
,
Route
,
WETH
}
from
'
@uniswap/sdk
'
import
{
TokenAmount
,
JSBI
,
Route
,
WETH
,
Percent
}
from
'
@uniswap/sdk
'
import
Slider
from
'
../../components/Slider
'
import
DoubleLogo
from
'
../../components/DoubleLogo
'
...
...
@@ -14,7 +14,7 @@ import { Text } from 'rebass'
import
{
LightCard
}
from
'
../../components/Card
'
import
{
ChevronDown
}
from
'
react-feather
'
import
{
ArrowDown
,
Plus
}
from
'
react-feather
'
import
Row
,
{
RowBetween
,
RowFixed
,
RowFlat
}
from
'
../../components/Row
'
import
{
RowBetween
,
RowFixed
}
from
'
../../components/Row
'
import
{
AutoColumn
,
ColumnCenter
}
from
'
../../components/Column
'
import
{
ButtonPrimary
,
ButtonEmpty
}
from
'
../../components/Button
'
...
...
@@ -227,7 +227,6 @@ export default function RemoveLiquidity({ token0, token1 }) {
// parse the amounts based on input
const
parsedAmounts
:
{
[
field
:
number
]:
TokenAmount
}
=
{}
// try to parse typed value
if
(
independentField
===
Field
.
PERCENTAGE
&&
userLiquidity
&&
...
...
@@ -258,9 +257,8 @@ export default function RemoveLiquidity({ token0, token1 }) {
if
(
typedValueParsed
!==
'
0
'
)
{
// first get the exact percentage of tokens deposited
const
inputTokenAmount
=
new
TokenAmount
(
tokens
[
Field
.
INPUT
],
typedValueParsed
)
const
ratio
=
JSBI
.
divide
(
inputTokenAmount
.
raw
,
TokensDeposited
[
Field
.
INPUT
].
raw
)
const
partialLiquidity
=
JSBI
.
multiply
(
userLiquidity
.
raw
,
ratio
)
const
ratio
=
new
Percent
(
inputTokenAmount
.
raw
,
TokensDeposited
[
Field
.
INPUT
].
raw
)
const
partialLiquidity
=
ratio
.
multiply
(
userLiquidity
)
const
liquidityTokenAmount
=
new
TokenAmount
(
exchange
.
liquidityToken
,
partialLiquidity
)
parsedAmounts
[
Field
.
POOL
]
=
liquidityTokenAmount
parsedAmounts
[
Field
.
OUTPUT
]
=
exchange
.
getLiquidityValue
(
...
...
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