fix: fixed deposit cap being negative
This commit is contained in:
parent
2aebfda18f
commit
c23f53207d
@ -12,6 +12,7 @@ import useLocalStorage from 'hooks/useLocalStorage'
|
|||||||
import { BNCoin } from 'types/classes/BNCoin'
|
import { BNCoin } from 'types/classes/BNCoin'
|
||||||
import { byDenom } from 'utils/array'
|
import { byDenom } from 'utils/array'
|
||||||
import { demagnify, formatAmountToPrecision } from 'utils/formatters'
|
import { demagnify, formatAmountToPrecision } from 'utils/formatters'
|
||||||
|
import { BN } from 'utils/helpers'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
asset: Asset
|
asset: Asset
|
||||||
@ -106,9 +107,9 @@ export default function AssetSelectorItem(props: Props) {
|
|||||||
className='text-xs text-left text-info/60'
|
className='text-xs text-left text-info/60'
|
||||||
coin={BNCoin.fromDenomAndBigNumber(
|
coin={BNCoin.fromDenomAndBigNumber(
|
||||||
depositCap.denom,
|
depositCap.denom,
|
||||||
depositCap.max.minus(depositCap.used),
|
BN(Math.max(depositCap.max.minus(depositCap.used).toNumber(), 0)),
|
||||||
)}
|
)}
|
||||||
options={{ suffix: ` (${capLeft.toFixed(2)}%)` }}
|
options={{ suffix: ` (${Math.max(capLeft, 0).toFixed(2)}%)` }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
Loading…
Reference in New Issue
Block a user