1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 01:34:57 +01:00

remove liquidity in OCEAN only

This commit is contained in:
Matthias Kretschmann 2020-10-14 10:26:00 +02:00
parent 36d1289a8e
commit 1a71f0f66f
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 4 additions and 12 deletions

View File

@ -10,19 +10,16 @@ import Token from './Token'
export default function Remove({
setShowRemove,
poolAddress,
poolTokens,
dtSymbol
poolTokens
}: {
setShowRemove: (show: boolean) => void
poolAddress: string
poolTokens: string
dtSymbol: string
}): ReactElement {
const { ocean, accountId } = useOcean()
const [amountPercent, setAmountPercent] = useState('0')
const [amountPoolShares, setAmountPoolShares] = useState('0')
const [amountOcean, setAmountOcean] = useState<string>()
const [amountDatatoken, setAmountDatatoken] = useState<string>()
const [isLoading, setIsLoading] = useState<boolean>()
const [txId, setTxId] = useState<string>()
@ -52,6 +49,9 @@ export default function Remove({
useEffect(() => {
if (!ocean || !poolTokens) return
// TODO: check max amount to be able to remove
// getOceanMaxRemoveLiquidity()
async function getValues() {
const amountPoolShares =
(Number(amountPercent) / 100) * Number(poolTokens)
@ -62,12 +62,6 @@ export default function Remove({
`${amountPoolShares}`
)
setAmountOcean(amountOcean)
const amountDatatoken = await ocean.pool.getDTRemovedforPoolShares(
poolAddress,
`${amountPoolShares}`
)
setAmountDatatoken(amountDatatoken)
}
getValues()
}, [amountPercent, ocean, poolTokens, poolAddress])
@ -100,7 +94,6 @@ export default function Remove({
<p>You will receive</p>
<Token symbol="OCEAN" balance={amountOcean} />
<Token symbol={dtSymbol} balance={amountDatatoken} />
<Actions
isLoading={isLoading}

View File

@ -129,7 +129,6 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {
setShowRemove={setShowRemove}
poolAddress={price.address}
poolTokens={poolTokens}
dtSymbol={dtSymbol}
/>
) : (
<>