Skip to content

Commit

Permalink
Fix logic for calculating stake amount
Browse files Browse the repository at this point in the history
  • Loading branch information
olehmell committed Dec 8, 2023
1 parent 87aa65f commit 2e47c60
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/utils/balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ export const calculateBalanceForStaking = (
lockId?: string
) => {
if (!data) return BN_ZERO
const { totalBalance, lockedBalance, locks } = data
const { totalBalance, locks } = data

const stakingLockedBalance = locks?.find(({ id }) => id === lockId)

if (!stakingLockedBalance ||
lockedBalance === stakingLockedBalance?.amount) return totalBalance
if (!stakingLockedBalance) return totalBalance

return new BN(totalBalance).sub(new BN(stakingLockedBalance.amount))
}

0 comments on commit 2e47c60

Please sign in to comment.