fix(jobs): on-chain holder count should match Birdeye (token accounts, not distinct owners) - #1000
Merged
Merged
Conversation
…lder metric CoinStatsOnchainJob computed holder = COUNT(DISTINCT owner), which undercounts: the claimable-tokens program authority owns one token account per user (the user-bank mechanism), so many real holders collapse into a single program owner. Verified on-chain — e.g. MONIST has 145 non-zero token accounts across only 7 distinct owners, because one program authority holds 139 of them. Count token accounts (COUNT(*)) to match Birdeye's holder metric and reflect real distinct-user holdings. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
CoinStatsOnchainJobcomputed the on-chainholdermetric asCOUNT(DISTINCT owner). That undercounts real holders: the Audius claimable-tokens program authority owns one token account per user (the user-bank mechanism), so many distinct users collapse into a single program owner.Switch to
COUNT(*)(token accounts with balance > 0) to match Birdeye's metric and reflect real distinct-user holdings.How it was found
Validated against a public Solana RPC (
getProgramAccountson the token program), cross-referenced with the DB:So
COUNT(DISTINCT owner)returned 5 / 7 where the real (and Birdeye) count is 16 / 145. The DB had full coverage in both cases; the bug was purely the aggregation.Test
Updated
coin_stats_onchain_test.go: two token accounts now share one owner, and the assertion expects the token-account count (4), not the distinct-owner count (3).go test ./jobs/passes; build clean.🤖 Generated with Claude Code