max token withdraw shouldnt use maxborrow if its a trustless token

This commit is contained in:
tjs 2023-01-05 15:35:45 -05:00
parent 4aa669552c
commit 564c4bdee8
1 changed files with 2 additions and 0 deletions

View File

@ -21,6 +21,8 @@ export const getMaxWithdrawForBank = (
)
const maxWithdraw = allowBorrow
? Decimal.min(vaultBalance, maxBorrow)
: bank.initAssetWeight.toNumber() === 0
? Decimal.min(accountBalance, vaultBalance)
: Decimal.min(accountBalance, vaultBalance, maxBorrow)
return Decimal.max(0, maxWithdraw)
}