fix: ARC bridge/swap USDC hide max button + arc bridge code cleanup#43693
fix: ARC bridge/swap USDC hide max button + arc bridge code cleanup#43693maxime-oe wants to merge 1 commit into
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. |
49cd083 to
d86cf25
Compare
✨ Files requiring CODEOWNER review ✨👨🔧 @MetaMask/core-extension-ux (1 files, +4 -8)
💎 @MetaMask/metamask-assets (1 files, +0 -12)
🔄 @MetaMask/swaps-engineers (4 files, +63 -63)
|
Builds ready [d86cf25]
⚡ Performance Benchmarks (Total: 🟢 18 pass · 🟡 7 warn · 🔴 0 fail)
Bundle size diffs [🚀 Bundle size reduced!]
|
d86cf25 to
6e0638b
Compare
Builds ready [6e0638b]
⚡ Performance Benchmarks (Total: 🟢 19 pass · 🟡 6 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
6e0638b to
0030d6f
Compare
Builds ready [0030d6f]
⚡ Performance Benchmarks (Total: 🟢 14 pass · 🟡 10 warn · 🔴 1 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
0030d6f to
c3ed97c
Compare
c3ed97c to
1b34cd5
Compare
1b34cd5 to
041c49f
Compare
041c49f to
8ae0f7f
Compare
Builds ready [8ae0f7f]
⚡ Performance Benchmarks (Total: 🟢 16 pass · 🟡 8 warn · 🔴 1 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
8ae0f7f to
1ef3d9c
Compare
1ef3d9c to
20d4ffe
Compare
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 20d4ffe. Configure here.
| balanceByChainIdByAccountAddress[chainId]?.[lowercasedAddress] | ||
| ?.balance) | ||
| : (tokenBalances?.[chainId]?.[token.address as Hex] ?? | ||
| tokenBalances?.[chainId]?.[token.address.toLowerCase() as Hex]); |
There was a problem hiding this comment.
ARC USDC misses account tracker
High Severity
On Arc, wallet USDC is treated as the chain native balance (account tracker), while getNativeAssetForChainId now points at 0x3600…. getNativeAssetsWithBalance only reads ERC20 tokenBalances for that address, and setEVMSrcNativeBalance fetches the same ERC20 balance, so bridge can show zero USDC, omit it from the picker, and mis-run gas checks.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 20d4ffe. Configure here.
|
Builds ready [20d4ffe]
⚡ Performance Benchmarks (Total: 🟢 16 pass · 🟡 8 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|





Description
Patch equivalent of MetaMask/core#9196 for testing and non-reg.
Goals:
Solve remaining issues with Swap/Bridge on ARC: Most importantly the "max swap" behavior (since the current approach doesn't consider USDC as native, which leaves "max" button visible).
Remove as many "quick fixes" as possible from the codebase.
Changelog
CHANGELOG entry: hide max button for ARC USDC Swap
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Touches shared bridge-controller native/balance/CAIP parsing used across swap and bridge flows; incorrect native classification could affect max amounts, gas reserve checks, and balances on Arc and other ERC20-as-native chains.
Overview
Moves Arc swap/bridge behavior into
@metamask/bridge-controller(yarn patch) so Arc’s default asset is USDC at0x3600…(6 decimals) with chain id 5042, and tightens native detection for CAIP-19 asset ids and ERC20 balance fetching when the “native” asset is really an ERC20.The extension drops Arc-specific workarounds:
BRIDGE_CHAINID_TO_DEFAULT_FROM_TOKEN,BRIDGE_ASSET_PICKER_HIDDEN_ASSETS, wallet swap token overrides, andARC_ERC20_USDC_BRIDGE_ASSET. Defaults now usegetNativeAssetForChainIdeverywhere; bridge asset picker reads ERC20 balances for pseudo-native tokens (fixes USD pricing); balance thunks pass the real native token address instead of always0x0.Together this should treat Arc USDC as the chain native in bridge/swap (including max button / reserve logic that keys off
isNativeAddress).Reviewed by Cursor Bugbot for commit 20d4ffe. Bugbot is set up for automated code reviews on this repo. Configure here.