Repository navigation
Description
Overview
Every currency display in the app funnels through one of two formatters, and both hardcode a 2-decimal precision ceiling regardless of which asset is being shown, even though both functions explicitly accept an asset: "USDC" | "XLM" parameter:
src/lib/utils.ts:
export function formatCurrency(amount: number, asset: "USDC" | "XLM" = "USDC") {
if (!Number.isFinite(amount)) return `0 ${asset}`;
const abs = Math.abs(amount);
return `${abs.toLocaleString("en-US", { maximumFractionDigits: 2 })} ${asset}`;
}src/components/ui/StatCard.tsx's internal formatter:
case "currency": {
const formatted = value.toLocaleString("en-US", { maximumFractionDigits: 2 });
const display = `${formatted} ${asset}`;
const exact = `${value.toLocaleString("en-US", { maximumFractionDigits: 6 })} ${asset}`;
return { display, exact };
}Both accept asset, both use it only to pick the trailing unit label, and neither branches on it for precision. XLM is a native Stellar asset with 7 decimal places of on-chain precision (1 XLM = 10,000,000 stroops) — this is the same 7-decimal precision the rest of this codebase clearly already knows about and treats as significant elsewhere (src/lib/wallet.ts signs real Soroban transactions with stroop-level amounts; the whole point of #17, "Eliminate floating-point drift in aggregated financial figures," is that this app cares about sub-cent/sub-stroop precision in its money math). Bounty.asset, Milestone.asset, and MaintenancePool.asset are all typed "USDC" | "XLM", and the adapters (adaptBounty, adaptMilestone, adaptMaintenancePool) pass whatever asset the backend sends straight through with no assumption that it'll always be USDC — XLM is a first-class, exercised code path, not a hypothetical.
With maximumFractionDigits: 2 applied unconditionally, an XLM amount like 12.3456789 XLM displays as "12.35 XLM" — silently rounding away 5 decimal places of real, on-chain value — and, more alarmingly, a small XLM amount like 0.0000005 XLM (a genuinely nonzero balance at native precision) rounds to "0 XLM", indistinguishable from an actual zero. This directly undermines StatCard's own stated design goal ("financial figures are NOT abbreviated... Instead the value text scales down gracefully... and the full unabbreviated figure is always available via the title attribute") — the exact tooltip string also only goes to maximumFractionDigits: 6 (one digit short of XLM's full 7-decimal precision) and, more importantly, formatCurrency (used everywhere outside StatCard, e.g. BountyCard, IssueDetailPage, ActivityList, MilestonesPage) has no "exact" fallback at all — whatever maximumFractionDigits: 2 throws away for an XLM amount is gone from the UI entirely, with no tooltip, no secondary display, nothing.
Requirements
- Make
formatCurrencybranch itsmaximumFractionDigitson theassetparameter: an XLM-appropriate precision (up to 7 decimal places; consider whether trailing zeros should be trimmed for readability, e.g. viatoLocaleString'sminimumFractionDigits/maximumFractionDigitscombination or a custom trim) versus USDC's existing 2. - Apply the same asset-aware precision fix to
StatCard's internalformatValue, for both thedisplayandexactstrings — theexactstring in particular should reflect XLM's true 7-decimal precision, not top out at 6. - Decide and document the display policy for very small XLM amounts (e.g. sub-0.0000001 XLM) — should they ever round to a literal "0 XLM," or should there be a floor below which the display switches to a "<0.0000001 XLM" style representation to avoid ever showing a genuinely nonzero balance as zero? This directly interacts with
StatCard's zero-state logic (isNumericZero = typeof value === "number" && value === 0), which is a strict equality check on the raw number, not the display string — worth confirming this doesn't need to change, but call it out explicitly since it's adjacent, easily-confused territory. - Audit every call site of
formatCurrencyfor any place that assumes 2-decimal-max output specifically (e.g. any manual string-length/width calculations) that might break once XLM amounts can render longer.
Acceptance Criteria
-
formatCurrency(12.3456789, "XLM")(or equivalent) displays meaningfully more precision thanformatCurrency(12.3456789, "USDC")— the two are no longer identical modulo the trailing unit label. - A small nonzero XLM amount (e.g.
0.0000005) does not display as"0 XLM". -
StatCard'sexacttooltip string for an XLM value reflects up to 7 decimal places, not 6. - USDC formatting is unchanged (2 decimal places, no regression).
- A test in
StatCard.test.tsx(extending its existing "large financial value" / "pre-formatted string" suites) and a new test forformatCurrencyinsrc/lib/utils.test.ts(there is currently no test file forutils.tsat all) cover both assets at multiple precision levels, including a small-XLM-amount non-zero case.
Additional Notes
Precise references:
src/lib/utils.ts:34-38—formatCurrency, the hardcodedmaximumFractionDigits: 2.src/components/ui/StatCard.tsx:74-88(the"currency"branch offormatValue) and:58-59(the doc comment:asset?: "USDC" | "XLM"— "Currency asset label appended when format="currency". Defaults to "USDC"." — note the doc comment itself only describesassetas controlling the trailing label, confirming this was a deliberate (if incomplete) design, not an oversight in the type signature alone).src/types/index.ts:23-40(Bounty.asset),:42-51(Milestone.asset),:74-80(MaintenancePool.asset) — all"USDC" | "XLM", confirming XLM is a modeled, first-class asset throughout the domain types, not just an incidental union member.src/lib/adapters.ts:42-53,108-114—RawBounty.asset/RawMaintenancePool.asset, both passed through from the backend with no asset-specific branching, confirming XLM bounties/pools are a real, exercised path today.
Relationship to other issues: distinct from #17 ("Eliminate floating-point drift in aggregated financial figures"), which is about summation/accumulation error from using JS floats for money math across many operations. This issue is about display quantization — the formatter deliberately throwing away real precision it was given, for one specific asset, regardless of whether the underlying number itself is exact. Fixing #17 doesn't fix this, and fixing this doesn't fix #17; they compound if both are present (a value that's already drifted from float summation, then further rounded away by 2-decimal display, for an asset that needed 7).
Test/reproduction plan: unit-test formatCurrency(0.0000005, "XLM") and confirm it is not "0 XLM"; unit-test formatCurrency(12.3456789, "XLM") and confirm more than 2 fractional digits are present; unit-test formatCurrency(12.3456789, "USDC") and confirm it's still exactly "12.35 USDC" (no regression); repeat the currency-precision assertions for StatCard's display/exact pair via StatCard.test.tsx, checking the title attribute specifically for the 7-decimal XLM case.
Activity
nighshift-labs commentedon Aug 17, 2026
I reproduced the issue at public tip
5eec1ce: the current formatter returns12.35 XLMfor12.3456789and0 XLMfor0.0000005, while USDC remains correctly two-decimal. I prepared a bounded precision-policy/test slice here:research/2026-08-17-mergefi-xlm-display-precision-prospect.mdanddeliverables/mergefi-xlm-display-precision-micro-delivery.md.Would maintainers prefer the below-one-stroop display policy to be
<0.0000001 XLM, and can you confirm the campaign reward/acceptance path before anyone implements?biqqest commentedon Aug 25, 2026
@biqqest has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @biqqest to this issue.
brightcli-stack commentedon Aug 25, 2026
@brightcli-stack has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @brightcli-stack to this issue.
codewithzubair07 commentedon Aug 25, 2026
@codewithzubair07 has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @codewithzubair07 to this issue.
OmniZlatoon commentedon Aug 25, 2026
@OmniZlatoon has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @OmniZlatoon to this issue.
Songu3020 commentedon Aug 25, 2026
@Songu3020 has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Songu3020 to this issue.
drips-wave commentedon Aug 25, 2026
Congratulations, @brightcli-stack! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on August 31, 2026.
🧑💻 @brightcli-stack: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.
Warning
When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.
🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.
🌊 Happy Wave 🌊
fix: validate deposits, fix milestone progress, XLM precision, role-b…
drips-wave commentedon Aug 25, 2026
This issue has been completed by @brightcli-stack as part of the Stellar Wave Program's 8th Wave 🥳
😎 @brightcli-stack: You earned 200 Points for completing this issue! After the current Wave ends, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.
🧑💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.