Skip to content

fix: add mUSD to assets controllers#8688

Merged
salimtb merged 4 commits intomainfrom
feat/musd-zero-balance-token-detection-fix
May 5, 2026
Merged

fix: add mUSD to assets controllers#8688
salimtb merged 4 commits intomainfrom
feat/musd-zero-balance-token-detection-fix

Conversation

@salimtb
Copy link
Copy Markdown
Contributor

@salimtb salimtb commented May 5, 2026

Explanation

UI PR: MetaMask/metamask-extension#42390

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes token discovery/import behavior for mUSD across multiple chains, which could impact whether the asset appears by default and how it is re-added across account/network changes. Risk is mitigated by added unit tests, but regressions could affect token visibility/import timing.

Overview
Switches default mUSD handling from upfront TokensController state seeding to detection-based discovery on Ethereum mainnet (0x1), Linea (0xe708), and Monad mainnet (0x8f), and drops Monad testnet from the default list.

TokenDetectionController now merges mUSD metadata into the in-memory token list cache and ensures mUSD is included in detection slices (polling/WS/RPC), including a special case to add mUSD even when RPC returns a zero balance. TokenBalancesController now also schedules mUSD for import on those chains even when balances are zero.

Removes the prior mUSD seeding/event-subscription paths from TokensController (and related messenger allowed events), updates tests accordingly, and adds shared mUSD constants/metadata plus changelog and lint-suppression updates.

Reviewed by Cursor Bugbot for commit 6fa961b. Bugbot is set up for automated code reviews on this repo. Configure here.

@salimtb salimtb marked this pull request as ready for review May 5, 2026 10:15
@salimtb salimtb requested review from a team as code owners May 5, 2026 10:15
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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 6fa961b. Configure here.

Comment thread packages/assets-controllers/src/TokenDetectionController.ts
Comment thread eslint-suppressions.json
}
},
"packages/assets-controllers/src/TokensController.test.ts": {
"@typescript-eslint/explicit-function-return-type": {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surprised this count got increased, no chance we can avoid this? 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can fix it yes , will push in a short moment

* Metadata matches `GET /v3/assets` on `tokens.api.cx.metamask.io` (assetIds CAIP-19).
*/
export const MUSD_TOKEN_DETECTION_CHAIN_IDS = [
'0x1', // Ethereum mainnet (eip155:1)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surprised these need hardcoding, is there no ChainId enum?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm let me clean this later , we can use ChainId here indeed

@salimtb salimtb added this pull request to the merge queue May 5, 2026
Merged via the queue into main with commit 4ef58ba May 5, 2026
366 checks passed
@salimtb salimtb deleted the feat/musd-zero-balance-token-detection-fix branch May 5, 2026 10:40
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.

3 participants