Fix GM pool USD scaling and modernize pools UX#177
Merged
Conversation
|
@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. |
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. |
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.
Summary
closes #174
Fixes the
/poolspage USD scaling bug and improves the GM pools table/readability experience.USD-denominated contract values use
10^30precision, while token amounts use Stellar’s10^7precision. 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
USD_DECIMALS = 30andTOKEN_DECIMALS = 7pool math helpers.Verification
bun run --cwd apps/web test src/features/pools/lib/pool-math.test.tsbun 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/poolsvisual smoke checked at desktop and 360px mobile.Notes
Full repo
bun run typecheckandbun run lintare currently blocked by pre-existing unrelated errors outside this change set.