Skip to content

Conversation

@GeorgeGkas
Copy link
Contributor

@GeorgeGkas GeorgeGkas commented Oct 30, 2025

Description

POL token is defined with zero address in our backend services but its actual address is 0x0000000000000000000000000000000000001010. That creates an issue where both tokes are rendered even if they are the same. To mitigate this issue we keep the one with zero address as it's more consistent with similar logic.

Changelog

CHANGELOG entry: Fixes an issue where users will see two POL tokens on swap select token screen

Related issues

Fixes: #19334

Manual testing steps

- Ensure that users see only one POL token on Select Token screen of swaps.
- Ensure that POL token rendered in Select Token screen of swaps have correct balance.
- Ensure that users can complete a swap or bridge transaction using POL token both as source and dest.

Screenshots/Recordings

Before

Screenshot 2025-10-30 at 11 40 04 AM

After

Screenshot 2025-10-30 at 2 18 18 PM

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Normalize Polygon native token addressing to dedupe POL across token sources and ensure correct rendering/exclusion.

  • Bridge tokens:
    • Normalize Polygon native token by mapping 0x0000000000000000000000000000000000001010 to zeroAddress() in useTokens getTokenKey for consistent deduplication across sources.
    • Respect exclusions for POL regardless of whether specified as zeroAddress() or native address.
  • Tests:
    • Add comprehensive tests in hooks/useTokens.test.ts covering:
      • Duplicate prevention between tokensWithBalance and topTokens (both address variants).
      • Mixed-chain behavior (ETH unaffected), allTokens normalization, and exclusion cases.
  • Constants:
    • Introduce POLYGON_NATIVE_TOKEN in constants/assets.ts.

Written by Cursor Bugbot for commit 3cde5f8. This will update automatically on new commits. Configure here.

@GeorgeGkas GeorgeGkas requested a review from a team as a code owner October 30, 2025 12:55
@github-actions
Copy link
Contributor

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.

@metamaskbot metamaskbot added the team-swaps-and-bridge Swaps and Bridge team label Oct 30, 2025
@sonarqubecloud
Copy link

@SteP-n-s SteP-n-s added this pull request to the merge queue Oct 31, 2025
Merged via the queue into main with commit cdad5de Oct 31, 2025
148 of 164 checks passed
@SteP-n-s SteP-n-s deleted the swaps-2973-duplicate-pol-tokens branch October 31, 2025 10:07
@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2025
@metamaskbot metamaskbot added the release-7.59.0 Issue or pull request that will be included in release 7.59.0 label Oct 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.59.0 Issue or pull request that will be included in release 7.59.0 size-L team-swaps-and-bridge Swaps and Bridge team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Duplicated POL token when bridge token selector

4 participants