Real-time discovery surfaces. Hot Now collections, top-buyer leaderboards, and the bar-metrics aggregator that keeps the homepage warm without thrashing the database.
The discover surface needs to feel alive without melting the database. Two strips at the top of the marketplace — Hot Now and Top Buyers — answer the user's first question on every visit ("what is happening right now?") while staying within tight server budgets through aggressive caching and shared aggregations.
Hot Now surfaces collections that are trending in the last short window, blending sale velocity, distinct buyer count, and momentum versus a longer baseline. The strip pulls from the bar-metrics aggregator (services/server/src/marketplace/bar-metrics), which precomputes the trending list and stores it under a short Redis TTL. The homepage component (HotNowStrip) consumes the cached list directly — no per-request scan of the activity log.
marketplace.buyerLeaderboard returns ranked buyer addresses with their volume, buy count, royalties paid, token rewards earned, and profit/loss. Each entry includes:
| Field | Purpose |
|---|---|
rank | Position in the current scope (season or global) |
address | Buyer wallet (links into the airdrop leaderboard with prefilled filters) |
buys / sells / mints | Activity counts |
buyVolumeUsdCents / sellVolumeUsdCents | USD-cents totals, integer-only |
royaltiesUsdCents | Creator royalties this buyer paid (positive signal — surfaced in the UI) |
tokenRewardsUsdCents | Reward claims earned by this buyer |
profitUsdCents / lossUsdCents | Realized P&L within the scope |
The leaderboard supports both global and season scopes, optional chain or EVM-chain filters, and arbitrary sort keys. The first three ranks render with gold/silver/bronze gradient medals in the TopBuyersStrip component.
The leaderboard aggregation hits assetActivity with several joins and is too heavy to recompute per request. The router caches the result under CacheKey.marketplaceBuyerLeaderboard keyed on the full input (limit, sort key, chain, season window) for 30 seconds. Both the homepage strip (small limit) and the full leaderboard page (large limit) hit the same scan; only the slice differs.
Stats endpoints (stats) cache for 8 seconds to absorb refresh storms without staling the displayed numbers.
All USD values flow through the system as integer cents. No floats, no rounding drift between server and UI. Display formatters divide by 100 only at the render layer, so $1,234.56 is stored as 123456 and totals always reconcile to the cent.