Skip to content

Commit

Permalink
fixed bug returning invalid cw20 stakers
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso committed May 1, 2024
1 parent 52740a4 commit 285bf99
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/data/formulas/contract/staking/cw20Stake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,11 @@ export const topStakers: ContractFormula<
keys.join(':')
)) ?? {}
const stakes = Object.entries(stakers)
// Remove zero balances.
.filter(([, balance]) => Number(balance) > 0)
// Remove invalid addresses that end in colons (not sure how these appear,
// probably the snapshot map internals) and zero balances.
.filter(
([address, balance]) => !address.endsWith(':') && Number(balance) > 0
)
// Descending by balance.
.sort(([, a], [, b]) => Number(b) - Number(a))
.slice(0, limitNum)
Expand Down

0 comments on commit 285bf99

Please sign in to comment.