mirror of
https://github.com/oceanprotocol/market.git
synced 2024-11-15 09:44:53 +01:00
prepare max checks
This commit is contained in:
parent
0a248b36a1
commit
5b7843d3d4
@ -35,6 +35,7 @@ export default function Remove({
|
|||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const { ocean, accountId } = useOcean()
|
const { ocean, accountId } = useOcean()
|
||||||
const [amountPercent, setAmountPercent] = useState('0')
|
const [amountPercent, setAmountPercent] = useState('0')
|
||||||
|
const [amountMaxPercent, setAmountMaxPercent] = useState('100')
|
||||||
const [amountPoolShares, setAmountPoolShares] = useState('0')
|
const [amountPoolShares, setAmountPoolShares] = useState('0')
|
||||||
const [amountOcean, setAmountOcean] = useState<string>()
|
const [amountOcean, setAmountOcean] = useState<string>()
|
||||||
const [amountDatatoken, setAmountDatatoken] = useState<string>()
|
const [amountDatatoken, setAmountDatatoken] = useState<string>()
|
||||||
@ -95,11 +96,15 @@ export default function Remove({
|
|||||||
setAmountOcean(tokens?.oceanAmount)
|
setAmountOcean(tokens?.oceanAmount)
|
||||||
setAmountDatatoken(tokens?.dtAmount)
|
setAmountDatatoken(tokens?.dtAmount)
|
||||||
} else {
|
} else {
|
||||||
// TODO: check max amount to be able to remove
|
const amountMaxOcean = await ocean.pool.getOceanMaxRemoveLiquidity(
|
||||||
const maxOcean = await ocean.pool.getOceanMaxRemoveLiquidity(
|
|
||||||
poolAddress
|
poolAddress
|
||||||
)
|
)
|
||||||
console.log(maxOcean)
|
console.log(amountMaxOcean)
|
||||||
|
|
||||||
|
// TODO: Calculate maximum percentage a user can remove based on maximum OCEAN
|
||||||
|
// to limit the range slider
|
||||||
|
// const maxPercent = ??
|
||||||
|
// setAmountMaxPercent(maxPercent)
|
||||||
|
|
||||||
const amountOcean = await ocean.pool.getOceanRemovedforPoolShares(
|
const amountOcean = await ocean.pool.getOceanRemovedforPoolShares(
|
||||||
poolAddress,
|
poolAddress,
|
||||||
@ -124,7 +129,7 @@ export default function Remove({
|
|||||||
<input
|
<input
|
||||||
type="range"
|
type="range"
|
||||||
min="0"
|
min="0"
|
||||||
max="100"
|
max={amountMaxPercent}
|
||||||
step="10"
|
step="10"
|
||||||
value={amountPercent}
|
value={amountPercent}
|
||||||
onChange={handleAmountPercentChange}
|
onChange={handleAmountPercentChange}
|
||||||
|
Loading…
Reference in New Issue
Block a user