Repository navigation
Conversation
There was no public, machine-readable view of what the launchpad has actually done. Add /stats and /api/stats: launches, distinct launchers, trades, distinct traders, trade-time USD volume, creator fees and burns, per chain and per UTC day, with a CSV export. Every USD figure is the value the indexer stored in the event's own hour; events without an hourly price are excluded and counted instead of being valued at today's price. The three aggregate reads use GROUPING SETS to return per-chain and global rows in one pass, share one 30-second memo between the page and the API, and fail soft to available:false rather than showing fake zeros. Verified against a seeded Postgres with 7d/30d/all windows.
|
Warning Review limit reachedThis review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry. Next included review available in 59 minutes. View limit details
|
|
@coderabbitai please review the PR |
|
Action not completed
|
What
Adds a public protocol stats page and machine-readable API:
GET /stats— cards, two server-rendered daily charts, per-chain table and top launches, with window/chain filters.GET /api/stats?window=7d|30d|90d|all&chain=base|robinhood|arc|elysium&format=json|csv— the same aggregates.format=csvdownloads the daily series (text/csv, one row per UTC day).The page and the API share one 30-second memo per window/chain. No new dependencies, no new environment variables, no new external hosts.
What is measured
All figures are aggregates of the existing index (
bb_launches,bb_launch_swaps,bb_launch_fee_events):unpriced_trades/unpriced_fee_eventswhen an event has no price for its own hourUSD is trade-time USD, not today's price applied to old volume: it is the value the indexer stored in the event's own UTC hour. Events without an hourly price are excluded and counted, never guessed; the page shows a warning and the API returns
usd_partial: true. Token-side fee burns are not valued in USD. The home hero additionally falls back to the current price for unpriced events, so the two can differ exactly by those counts — this is documented on the page and indocs/stats.md.Implementation notes
GROUPING SETS ((chain_id), ())to return per-chain and global rows in one pass; distinct wallet counts are therefore correct per chain and globally.date_trunc('day', block_time AT TIME ZONE 'UTC')and gap-filled fromsincethrough today with zeros, not holes.available: falsemeans the database is unset or the aggregate read failed. The page says so instead of drawing a zero chart; it does not pretend empty shapes are facts.<title>per bar and a<details>table of the exact numbers, so there is no client chart dependency and the data is accessible.Docs / discoverability
docs/stats.md: field meanings, SQL sources, trade-time USD rules, response shape, CSV, and why the home totals can differ./llms.txtgains the endpoint and the/statspage.STATIC_SITEMAP_ROUTES(and its test) gains/stats.Verification
The SQL was also exercised against a temporary seeded Postgres 18 (schema applied with
db/schema.sql; 5 launches, 7 swaps and 6 fee events across Base/Robinhood/Arc, including a 60-day-old launch and an unpriced trade/fee). With the built app running against it:30d→ 4 launches, 3 launchers, 6 trades, 3 traders, $425 volume, $16 collected, $3 burned, $13 to creators, 1 unpriced trade, 1 unpriced fee; Base $400 / Robinhood $25; top ALPHA $300, BETA $100, GAMMA $25.7d→ 3 launches, 4 trades, $325 volume, 7 daily points including zero days.all→ 5 launches, 7 trades, $1425 volume, 61 daily points; top ECHO $5000.format=csv→ correct header plus one row per day./statsrendered the cards, both charts, the by-chain table and the warning at 133 KB HTML.node .github/scripts/pr-guard.mjs --base upstream/main --head HEAD→ pass (0 blocking, 0 for review).Scope
Additive: new files under
app/src/lib/stats/,app/src/app/stats/,app/src/app/api/stats/andapp/src/components/stats/, plus the small sitemap/llms/docs changes above. No existing route or read model is modified, so it does not overlap the open security/indexer, bridge, i18n or fee PRs.