fix: [MUSD-857] show native amount for erc20 money account deposits#30789
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #30789 +/- ##
=======================================
Coverage 82.77% 82.77%
=======================================
Files 5584 5585 +1
Lines 144075 144119 +44
Branches 33332 33352 +20
=======================================
+ Hits 119254 119300 +46
+ Misses 16874 16866 -8
- Partials 7947 7953 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit bc52065. Configure here.
| maximumFractionDigits: 2, | ||
| useGrouping: true, | ||
| }).format(amount.toNumber()); | ||
| return `+${formatted} ${symbol}`; |
There was a problem hiding this comment.
Stable path shows misleading zero
Medium Severity
In formatPrimaryTokenAmount, USD-pegged stables always format with two fixed decimals and never treat a rounded "0.00" as too small to display. A positive pay-token amount below half a cent (e.g. ~$0.004 USDC) can still render as +0.00 USDC, while the non-stable branch returns an empty primary line for the same “misleading zero” case this PR fixes for tokens like LINK.
Reviewed by Cursor Bugbot for commit bc52065. Configure here.
There was a problem hiding this comment.
A positive pay-token amount below half a cent (e.g. ~$0.004 USDC) can still render as +0.00 USDC,
@cursoragent this seems very unlikely to happen. Additionally, the lowest denomination of USD is a cent so we likely wouldn't want to display sub-cent values. Ultimately a product decision. I think you're overestimating the severity here.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
The hook is only consumed by Performance Test Selection: |


Description
This fixes a bug where we would miscalculate the token value shown for ERC20 token deposits to the money account. The root of the problem was that we calculated the token values assuming an incorrect number of decimal places.
Changelog
CHANGELOG entry: show correct token values for ERC20 token deposits to money account
Related issues
Fixes: musd-857
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Changes user-visible transaction amounts for Money/Pay deposits and depends on live rates; scope is limited to display logic in the Money activity hook with strong test coverage.
Overview
Fixes MetaMask Pay money-account deposit activity rows where the pay-token primary line was wrong for ERC-20s (e.g. misleading +0.00 LINK for MUSD-857).
useMoneyTransactionDisplayInfonow treatsrequiredAssets[0].amountas the 6-decimal USD deposit value for every pay token, then divides by that token’s USD price—the same model already used for native ETH. ERC-20 USD price comes from token→ETH market data × ETH→USD via a sharedgetPayTokenUsdPricehelper;getTokenToEthPriceis exported frommoneyActivityFiatfor that lookup.Stablecoins (USDC, USDT, etc.) are priced from the API, not assumed $1; the stable symbol list only drives 2-decimal display vs up to 6 trimmed decimals for other tokens. The primary line is left blank when rates are missing or the computed amount would show as zero, while the fiat line still uses existing logic.
Tests are expanded for USDC (market price, de-peg, no rates), LINK regressions, and related edge cases.
Reviewed by Cursor Bugbot for commit bc52065. Bugbot is set up for automated code reviews on this repo. Configure here.