From 6bfb266c10082db235f593c9a988c6fcf486f0c8 Mon Sep 17 00:00:00 2001 From: esaminu Date: Sat, 5 Feb 2022 00:20:27 +0400 Subject: [PATCH] fix: misplaced usage of MIN_BALANCE_FOR_GAS --- packages/frontend/src/utils/account-with-lockup.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/frontend/src/utils/account-with-lockup.js b/packages/frontend/src/utils/account-with-lockup.js index 80ff42d54f..a622f68e09 100644 --- a/packages/frontend/src/utils/account-with-lockup.js +++ b/packages/frontend/src/utils/account-with-lockup.js @@ -269,9 +269,10 @@ async function getAccountBalance(limitedAccountData = false) { // if acc is deletable (nothing locked && nothing stake) you can transfer the whole amount ohterwise get_liquid_owners_balance const isAccDeletable = lockedAmount.isZero() && stakedBalanceLockup.isZero(); + const MIN_BALANCE_FOR_STORAGE = getLockupMinBalanceForStorage(lockupContractCodeHash); const liquidOwnersBalanceTransfersEnabled = isAccDeletable ? new BN(lockupBalance.total) - : BN.min(ownersBalance, new BN(lockupBalance.total).sub(new BN(MIN_BALANCE_FOR_GAS))); + : BN.min(ownersBalance, new BN(lockupBalance.total).sub(new BN(MIN_BALANCE_FOR_STORAGE))); const liquidOwnersBalance = areTransfersEnabled ? liquidOwnersBalanceTransfersEnabled : new BN(0); const available = BN.max(new BN(0), new BN(balance.available).add(new BN(liquidOwnersBalance)).sub(new BN(MIN_BALANCE_FOR_GAS))); @@ -288,7 +289,7 @@ async function getAccountBalance(limitedAccountData = false) { stakedBalanceLockup: stakedBalanceLockup, lockupAccountId, stakedBalanceMainAccount, - lockupReservedForStorage: getLockupMinBalanceForStorage(lockupContractCodeHash) + lockupReservedForStorage: MIN_BALANCE_FOR_STORAGE }; } catch (error) { if (error.message.match(/ccount ".+" doesn't exist/) || error.message.includes('does not exist while viewing') || error.message.includes('cannot find contract code for account')) {