feat(jobs): derive artist coin stats on-chain (shadow of Birdeye CoinStatsJob) - #998
Open
rickyrombo wants to merge 2 commits into
Open
feat(jobs): derive artist coin stats on-chain (shadow of Birdeye CoinStatsJob)#998rickyrombo wants to merge 2 commits into
rickyrombo wants to merge 2 commits into
Conversation
…StatsJob) Adds CoinStatsOnchainJob, which computes price, holder count, liquidity (pool TVL), market cap, all-time volume, and 24h price change from on-chain data (Meteora DBC/DAMM v2 pools, token-account balances, and an RPC getTokenSupply) instead of Birdeye. It writes a new shadow table artist_coin_stats_onchain and runs alongside the existing CoinStatsJob so the two can be compared via the artist_coin_stats_comparison view before cutover. Also adds artist_coin_price_history (24h change) and artist_coin_volume_accumulator (running volume) plus seed base rows for the new tables. AudioPriceJob (the AUDIO->USD anchor) is unchanged. Co-Authored-By: Claude Opus 4.8 <[email protected]>
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
Adds
CoinStatsOnchainJob— an on-chain replacement for the Birdeye-backedCoinStatsJob, which is ~99.6% of our Birdeye compute-unit spend. It derives the coin stats the product actually renders from data we already index on-chain, instead of calling Birdeye:artist_coin_pricesview (Meteora DBC/DAMM v2 pools)sol_token_account_balances(distinct owners, balance > 0)getTokenSupply;price × supplyShadow rollout
The job writes a new
artist_coin_stats_onchaintable and runs alongside the existingCoinStatsJob(both every 15 min). Consumers still read the liveartist_coin_stats, so there's zero product impact. The newartist_coin_stats_comparisonview exposes per-coin Birdeye-vs-on-chain deltas for validation. Once validated, a follow-up PR repoints consumers and deletesCoinStatsJob+ the unused Birdeye methods.AudioPriceJob(the AUDIO→USD anchor, still Birdeye) is intentionally out of scope.Also
artist_coin_stats_onchain,artist_coin_price_history,artist_coin_volume_accumulator(migrations 0229–0231).database/seed.go: base rows for the new tables +sol_meteora_dbc_pools.coin_stats_onchain_test.goseeds a DBC coin and asserts every derived field + the AUDIO no-clobber guard.Known fidelity gaps vs Birdeye
We track one canonical pool per coin, so a graduated coin with secondary/external markets will have understated liquidity/volume (price stays close via arbitrage); there's also a brief migration-lag window. The comparison view is the detector — review it before cutover. 24h change is blank for the first ~24h after deploy (no snapshot yet).
Test
go test ./jobs/ ./database/pass; full build/vet clean; regenerated dump loads.🤖 Generated with Claude Code