Skip to content

Commit

Permalink
Swapped stakedIndexersCount subtraction from withdraw to locked
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmardefago committed Apr 8, 2021
1 parent 7b3e9b8 commit e18fe9b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mappings/staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ export function handleStakeLocked(event: StakeLocked): void {
graphNetwork.totalUnstakedTokensLocked = graphNetwork.totalUnstakedTokensLocked.plus(
event.params.tokens,
)
if (indexer.stakedTokens == indexer.lockedTokens) {
graphNetwork.stakedIndexersCount = graphNetwork.stakedIndexersCount - 1
}
graphNetwork.save()
}

Expand All @@ -133,9 +136,6 @@ export function handleStakeWithdrawn(event: StakeWithdrawn): void {
graphNetwork.totalUnstakedTokensLocked = graphNetwork.totalUnstakedTokensLocked.minus(
event.params.tokens,
)
if (indexer.stakedTokens == BigInt.fromI32(0)) {
graphNetwork.stakedIndexersCount = graphNetwork.stakedIndexersCount - 1
}
graphNetwork.save()
}

Expand Down

0 comments on commit e18fe9b

Please sign in to comment.