feat(leaderboard): rank by verified earnings (30d) by default (#978)#986
Merged
Conversation
Phase 4 (1/4): the trading leaderboard now leads with verified on-chain earnings instead of the gameable trade-count. - LeaderboardClient: "Earnings (30d)" is the new default sort + a new column (desktop + mobile). It's server-priced USD, so it needs no client compute and sorts correctly on first paint (not in STATS_DEPENDENT_KEYS). Trade/volume/ P&L chips remain. - page.tsx: rebuildLeaderboard merges the verified-earnings leaderboard onto the swap rows by stx (union — earnings-only agents with no trades now appear too), ranks by earnings desc (tiebreak: trades, latest). Cache key bumped v1→v2. Cost (the part that matters): the earnings GROUP BY gets its OWN 1h cache (getCachedEarnings), decoupled from the 5-min swap rebuild — so it runs ~24×/day/colo, not 288×. Index-served by migration 022's partial index. Pre-PR /code-review caught + fixed: (1) the 1h-overlay decoupling above (I'd regressed it to the 5-min cadence); (2) $0 earnings now render "—" instead of "$0.00" on every trade-only row under the default earnings sort. Correctness pass was clean (merge/sort/cache/empty-path/signature verified).
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
landing-page | ea31dde | Commit Preview URL Branch Preview URL |
Jun 08 2026, 09:33 AM |
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.
Phase 4 (1 of 4) — the visible win. The trading leaderboard now leads with verified on-chain earnings instead of the trade-count that got gamed (the whole reason for #978).
What changed
LeaderboardClient— "Earnings (30d)" is the new default sort + a new column (desktop table + mobile list). Trade/Volume/P&L chips remain as secondary sorts. Earnings is server-priced USD, so it's not inSTATS_DEPENDENT_KEYS→ sorts correctly on first paint with no "loading prices…" wait. $0 earners render—(not$0.00).page.tsxrebuildLeaderboard— merges the verified-earnings leaderboard onto the swap rows bystx(a union: earnings-only agents with no trades now appear too), ranks byearnings desc(tiebreak trades, then latest). Cache key bumpedv1→v2so old-shape payloads aren't served.Cost (kept flat — the part you flagged)
The earnings
GROUP BYgets its own 1h cache (getCachedEarnings), decoupled from the 5-min swap rebuild — so it runs ~24×/day/colo, not 288×. Index-served by migration 022's partial index. No unbounded cardinality (single fixed key)./code-reviewran before this PR (high effort)getEarningsLeaderboardsignature were all verified correct.$0.00on every trade-only row under the default earnings sort → renders—.Notes
—earnings and an earnings-only agent shows0 trades— intended (one board, earnings-ranked).Next in Phase 4: profile Earnings section, homepage hero stat, Club badges. Part of #978.