Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit a02db28

Browse files
committed
show wallet balance while condition is true
1 parent 01cfca4 commit a02db28

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/modules/pool/actions/remove-liquidity/RemoveLiquidityProvider.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,13 @@ export function _useRemoveLiquidity(urlTxHash?: Hash) {
216216
})
217217
)
218218

219-
const totalUSDValue: string = safeSum(Object.values(usdAmountOutMap))
219+
// while the single token balance is more than 25% of the pool, we use the wallet balance usd for the view
220+
const totalUSDValue = isSingleTokenBalanceMoreThat25Percent
221+
? bn(pool.userBalance?.walletBalanceUsd || '0')
222+
.times(bn(humanBptInPercent).div(100))
223+
.toString()
224+
: safeSum(Object.values(usdAmountOutMap))
225+
220226
const totalAmountsOut: string = safeSum(quoteAmountsOut.map(a => a.amount))
221227

222228
const { isDisabled, disabledReason } = isDisabledWithReason(

0 commit comments

Comments
 (0)