Skip to content

Show ramp crypto amounts at the asset's own decimal precision - #6168

Open
j0ntz wants to merge 1 commit into
developfrom
jon/moonpay-decimal-precision
Open

Show ramp crypto amounts at the asset's own decimal precision#6168
j0ntz wants to merge 1 commit into
developfrom
jon/moonpay-decimal-precision

Conversation

@j0ntz

@j0ntz j0ntz commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)

Description

Asana: https://app.asana.com/0/1215088146871429/1217660195990065

MoonPay told us it raises the decimal precision of its buy flow on
September 1, 2026. BTC goes from 5 to 8 decimals, ETH from 6 to 9 decimals, and
SOL from 3 to 9 decimals, while stablecoins stay at 2. MoonPay asked integrators to confirm they treat crypto
amounts as variable-precision decimals rather than assuming a fixed count per
asset. The sell flow is unaffected.

Audit of the live buy path (src/plugins/ramps/moonpay/, which is what the Buy
tab routes to; the legacy amountQuotePlugin sits behind pluginListBuyOld):

  • Parsing and maths are already variable-precision. The quote amount is a JSON
    number rendered back through Number.toString() and then handled by
    biggystring, which is arbitrary precision and accepts exponent notation.
  • Nothing in the buy path stores or reconciles the amount at a fixed scale, and
    the one quote-vs-delivered comparison normalises both sides through the same
    number parse, so it assumes no decimal count.
  • One place did hardcode a decimal count: RampCreateScene rendered the crypto
    amount field with maxDecimals={6}, which FilledTextInput applies as
    toFixed(value, 0, 6), a truncation. Every MoonPay asset currently quotes at
    6 decimals or fewer, so the cap has never bitten; after September 1 it would
    silently drop 2 digits of BTC and 3 of ETH and SOL.

This derives the cap from the selected asset's own denomination instead, bounded
at 9 decimals. That gives BTC 8, ETH 9, SOL 9 and USDC 6, matching MoonPay's new
per-asset maximums. The bound matters for assets with more precision than a
quote can carry: when the user types a fiat amount the field divides by a float
exchange rate, whose rounding noise shows up past about 9 decimals, so rendering
ETH's full 18 would surface digits that are not real.

Verified on the iOS simulator with a before and after pair on the same input,
attached below. verify-repo.sh passes (eslint, jest, changelog).


Note

Cursor Bugbot is generating a summary for commit e85b6b3. Configure here.

@j0ntz

j0ntz commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

📸 Test evidence

before truncated at 6 decimals

before truncated at 6 decimals

after btc shows 8 decimals

after btc shows 8 decimals

after eth shows 9 decimals

after eth shows 9 decimals

Captured by the agent's in-app test run (build-and-test).

The buy/sell amount field capped the crypto value at six decimals, which
was fine while every provider quoted at or below that. MoonPay raises its
buy-flow precision on September 1, 2026 (BTC to eight decimals, ETH and
SOL to nine), so the cap would start silently truncating the amount the
user is quoted.

Derive the cap from the selected asset's denomination instead, bounded at
nine decimals. Assets with more precision than a quote can express, such
as ETH at eighteen, would otherwise surface the rounding noise of the
float exchange rate the field divides by while a fiat amount is typed.
@j0ntz
j0ntz marked this pull request as ready for review August 19, 2026 23:44
@j0ntz
j0ntz force-pushed the jon/moonpay-decimal-precision branch from 7d5423a to e85b6b3 Compare August 19, 2026 23:44
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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.

1 participant