Skip to content

Fix GM pool USD scaling and modernize pools UX#177

Merged
IbrahimIjai merged 4 commits into
SO4-Markets:mainfrom
0xMegie:issue-174
Jun 20, 2026
Merged

Fix GM pool USD scaling and modernize pools UX#177
IbrahimIjai merged 4 commits into
SO4-Markets:mainfrom
0xMegie:issue-174

Conversation

@0xMegie

@0xMegie 0xMegie commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

closes #174
Fixes the /pools page USD scaling bug and improves the GM pools table/readability experience.

USD-denominated contract values use 10^30 precision, while token amounts use Stellar’s 10^7 precision. The pools page was previously converting both with the token scale, which produced massively incorrect TVL, Open Interest, and funding values. This PR introduces explicit USD conversion helpers, applies them to the affected pool fields, and adds focused tests to prevent regression.

Also modernizes the GM pools table with compact formatting, sortable columns, responsive mobile cards, clearer partial-data states, and obvious active-route highlighting in the app navbar.

Changes

  • Added explicit USD_DECIMALS = 30 and TOKEN_DECIMALS = 7 pool math helpers.
  • Fixed TVL, Open Interest, composition USD inputs, and funding conversion.
  • Displays funding as an hourly percentage.
  • Added unit tests for:
    • 30-decimal USD values
    • 7-decimal token values
    • zero/missing values
    • negative USD values
    • open interest and funding conversion
  • Updated pool rows to use compact/tabular values with full-value hover titles.
  • Added sortable TVL, Open Interest, and APY columns.
  • Improved desktop table scannability with sticky header, zebra rows, and hover affordance.
  • Improved mobile pool cards and narrow viewport behavior.
  • Preserved partial-data affordance with failed-read detail in hover title.
  • Added clear TanStack Router active-state styling for app navbar links.
  • Kept Stats/Docs disabled and never active.

Verification

  • bun run --cwd apps/web test src/features/pools/lib/pool-math.test.ts
  • bun run --cwd apps/web lint src/features/pools/components/gm-pools-table.tsx src/features/pools/components/gm-pool-row.tsx src/features/pools/lib/pool-math.ts src/features/pools/lib/pool-math.test.ts src/ui/Navbar.tsx
  • Live /pools visual smoke checked at desktop and 360px mobile.

Notes

Full repo bun run typecheck and bun run lint are currently blocked by pre-existing unrelated errors outside this change set.

@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

@0xMegie is attempting to deploy a commit to the Ijai's projects Team on Vercel.

A member of the Team first needs to authorize it.

@IbrahimIjai

Copy link
Copy Markdown
Contributor

Reviewed end-to-end, solid work, approving. ✅ The core fix is exactly right: the USD path goes through formatSorobanAmount, so the 10³⁰ value is scaled down in bigint space before hitting Number(). Funding math matches useFundingRate 1:1, the scale conversions are unit-tested (USD/token/zero/negative/OI/funding), and lint + typecheck are clean on all touched files. Sorting, compact formatting with full-value tooltips, empty state, and the nav active-highlight all look great.

@IbrahimIjai IbrahimIjai merged commit 5a3a770 into SO4-Markets:main Jun 20, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue #1 — Pools table renders nonsense numbers; modernize the table and add active-route highlighting

2 participants