feat(protocol): rank top-5 factory pairs by trailing 30d USD (#1263) #1298

Merged
PlasticDigits merged 3 commits from issue/1263-protocol-top-pairs into main 2026-09-21 05:38:22 +00:00

Summary

  • Adds /protocol Top pairs (30d) — at most five factory pairs ranked by trailing 30-day priced USD volume, with current v2 AMM TVL and server-side vol/LP (N× or —).
  • Indexer stamps pair_volume_30d in the existing ~5 min volume aggregator (same NULL / idle-0 / ≥10^20 rules as 24h pair volume). GET /api/v1/protocol/top-pairs JOINs that stamp + pair_liquidity_usd; GET never scans swap_events / pair_reserves.
  • Gems reuse COLUMBUS5_GEM_ADDRESSES. Hard cap 5; limit/window allowlisted; from/to/sort/ticker → 400; 60s cache ignores junk keys. Does not add sort=volume_usd_30d to GET /pairs or change GET /overview.
  • Also tightens .githooks/pre-push so a new remote branch only checks unpublished commits (not all of main history).

Closes #1263

Test plan

  • VERIFY_ISSUE_1263_SKIP_RELATED=1 make verify-issue-1263 (docs, source guards, indexer lib + indexer_protocol_top_pairs, ProtocolPage RTL)
  • Indexer integration retest on dedicated dex_indexer_test_1263 (8/8 + 2 unit)
  • make verify-issue-653
  • VERIFY_ISSUE_655_SKIP_E2E=1 VERIFY_ISSUE_655_SKIP_RELATED=1 make verify-issue-655
  • VERIFY_ISSUE_692_SKIP_E2E=1 VERIFY_ISSUE_692_SKIP_RELATED=1 make verify-issue-692
  • Manual /protocol 1280 + 390: ≤5 economic rows, Charts link, gems absent
  • curl GET /api/v1/protocol/top-pairs (≤5 items) and ?limit=6 → 400
  • Optional LocalTerra P19: hub pair with 30d activity appears; gems still excluded
  • Full make verify-issue-550 / 569 / 562 (562 currently fails on this main snapshot via unrelated SwapPage #679 ~192 vs ~39.66 LUNC fee; gem-specific 562 checks passed)

Acceptance (issue #1263)

  • AC1 Top pairs panel after Global stats, before Protocol fees, cap 5
  • AC2 Columns Pair | 30d vol | v2 LP | Vol/LP; trailing titles; not 24h reused
  • AC3 Rollup GET + EXPLAIN; overview still O(1)
  • AC4 Server-side ratio; missing/≤0/overflow TVL → null / —
  • AC5 Gem-legged pairs excluded
  • AC6 Unpriced/idle/empty ranking
  • AC7 GET 400 + cache junk
  • AC8 chartsPairHref; no innerHTML / javascript href
  • AC9 One chrome layer; no voting/farm/APR lecture
  • AC10 Docs P1263 / I1263 + make verify-issue-1263 (related 550/569/562 full green not re-run here; 653/655/692 skip-e2e green)

Out of scope (as specified): BTC/ETH/stocks, farm/APR, CMM txs, /pool 30d column, historical TVL average, UTC chart, CosmWasm, Coolify.

## Summary - Adds `/protocol` **Top pairs (30d)** — at most five factory pairs ranked by trailing 30-day priced USD volume, with current v2 AMM TVL and server-side vol/LP (`N×` or —). - Indexer stamps `pair_volume_30d` in the existing ~5 min volume aggregator (same NULL / idle-0 / ≥10^20 rules as 24h pair volume). `GET /api/v1/protocol/top-pairs` JOINs that stamp + `pair_liquidity_usd`; GET never scans `swap_events` / `pair_reserves`. - Gems reuse `COLUMBUS5_GEM_ADDRESSES`. Hard cap 5; `limit`/`window` allowlisted; `from`/`to`/`sort`/`ticker` → 400; 60s cache ignores junk keys. Does not add `sort=volume_usd_30d` to `GET /pairs` or change `GET /overview`. - Also tightens `.githooks/pre-push` so a **new** remote branch only checks unpublished commits (not all of `main` history). Closes #1263 ## Test plan - [x] `VERIFY_ISSUE_1263_SKIP_RELATED=1 make verify-issue-1263` (docs, source guards, indexer lib + `indexer_protocol_top_pairs`, ProtocolPage RTL) - [x] Indexer integration retest on dedicated `dex_indexer_test_1263` (8/8 + 2 unit) - [x] `make verify-issue-653` - [x] `VERIFY_ISSUE_655_SKIP_E2E=1 VERIFY_ISSUE_655_SKIP_RELATED=1 make verify-issue-655` - [x] `VERIFY_ISSUE_692_SKIP_E2E=1 VERIFY_ISSUE_692_SKIP_RELATED=1 make verify-issue-692` - [ ] Manual `/protocol` 1280 + 390: ≤5 economic rows, Charts link, gems absent - [ ] `curl` `GET /api/v1/protocol/top-pairs` (≤5 items) and `?limit=6` → 400 - [ ] Optional LocalTerra P19: hub pair with 30d activity appears; gems still excluded - [ ] Full `make verify-issue-550` / `569` / `562` (562 currently fails on this main snapshot via unrelated SwapPage #679 `~192` vs `~39.66` LUNC fee; gem-specific 562 checks passed) ## Acceptance (issue #1263) - [x] AC1 Top pairs panel after Global stats, before Protocol fees, cap 5 - [x] AC2 Columns Pair | 30d vol | v2 LP | Vol/LP; trailing titles; not 24h reused - [x] AC3 Rollup GET + EXPLAIN; overview still O(1) - [x] AC4 Server-side ratio; missing/≤0/overflow TVL → null / — - [x] AC5 Gem-legged pairs excluded - [x] AC6 Unpriced/idle/empty ranking - [x] AC7 GET 400 + cache junk - [x] AC8 chartsPairHref; no innerHTML / javascript href - [x] AC9 One chrome layer; no voting/farm/APR lecture - [x] AC10 Docs P1263 / I1263 + `make verify-issue-1263` (related 550/569/562 full green not re-run here; 653/655/692 skip-e2e green) Out of scope (as specified): BTC/ETH/stocks, farm/APR, CMM txs, `/pool` 30d column, historical TVL average, UTC chart, CosmWasm, Coolify.
Stamp pair_volume_30d in the volume aggregator and expose GET /api/v1/protocol/top-pairs
so /protocol can show current v2 LP and vol/LP without a live swap_events scan.
fix(githooks): scan only unpublished commits on new-branch push
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
53d4689974
A new remote ref used to run rev-list on the tip oid, which walked every
ancestor including history already on origin/main. Exclude remote-tracking
commits so only the commits being introduced are checked.
Author
Owner

drain skip: no occupying job for rebase/fix-pr/CI-wait; remaining continue

drain skip: no occupying job for rebase/fix-pr/CI-wait; remaining continue
Merge origin/main into issue/1263-protocol-top-pairs
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
7f71e44af3
Keep top-5 30d pair ranking. Rename pair_volume_30d sqlx version to 20260921120001 so it does not collide with traders rolling NUMERIC(38, 0).
PlasticDigits deleted branch issue/1263-protocol-top-pairs 2026-09-21 05:38:22 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!1298
No description provided.