mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
remove liquidity in OCEAN only
This commit is contained in:
parent
36d1289a8e
commit
1a71f0f66f
@ -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}
|
||||
|
@ -129,7 +129,6 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {
|
||||
setShowRemove={setShowRemove}
|
||||
poolAddress={price.address}
|
||||
poolTokens={poolTokens}
|
||||
dtSymbol={dtSymbol}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
|
Loading…
Reference in New Issue
Block a user