Skip to content

Commit

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

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

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

return new BN(freeBalance)
.add(new BN(lockedBalance)
.sub(new BN(stakingLockedBalance.amount)))
return new BN(totalBalance).sub(new BN(stakingLockedBalance.amount))
}

0 comments on commit 0acf055

Please sign in to comment.