fix borrow max rounding
This commit is contained in:
parent
313a47e050
commit
17b2a695e8
|
@ -68,7 +68,10 @@ function BorrowModal({ isOpen, onClose, token }: ModalCombinedProps) {
|
||||||
const tokenMax = useMemo(() => {
|
const tokenMax = useMemo(() => {
|
||||||
const group = mangoStore.getState().group
|
const group = mangoStore.getState().group
|
||||||
if (!group || !bank || !mangoAccount) return new Decimal(0)
|
if (!group || !bank || !mangoAccount) return new Decimal(0)
|
||||||
return getMaxWithdrawForBank(group, bank, mangoAccount, true)
|
const amount = getMaxWithdrawForBank(group, bank, mangoAccount, true)
|
||||||
|
return amount && amount.gt(0)
|
||||||
|
? amount.toDecimalPlaces(bank.mintDecimals)
|
||||||
|
: new Decimal(0)
|
||||||
}, [mangoAccount, bank])
|
}, [mangoAccount, bank])
|
||||||
|
|
||||||
const setMax = useCallback(() => {
|
const setMax = useCallback(() => {
|
||||||
|
@ -181,7 +184,7 @@ function BorrowModal({ isOpen, onClose, token }: ModalCombinedProps) {
|
||||||
</EnterBottomExitBottom>
|
</EnterBottomExitBottom>
|
||||||
<FadeInFadeOut className="flex flex-col justify-between" show={isOpen}>
|
<FadeInFadeOut className="flex flex-col justify-between" show={isOpen}>
|
||||||
<div>
|
<div>
|
||||||
<h2 className="text-center">{t('borrow')}</h2>
|
<h2 className="mb-4 text-center">{t('borrow')}</h2>
|
||||||
{initHealth && initHealth <= 0 ? (
|
{initHealth && initHealth <= 0 ? (
|
||||||
<div className="mb-4">
|
<div className="mb-4">
|
||||||
<InlineNotification
|
<InlineNotification
|
||||||
|
|
Loading…
Reference in New Issue