Skip to content

fix: remove POL duplicates#976

Merged
alfetopito merged 4 commits intomainfrom
fix/duplicates
Jun 18, 2025
Merged

fix: remove POL duplicates#976
alfetopito merged 4 commits intomainfrom
fix/duplicates

Conversation

@alfetopito
Copy link
Collaborator

@alfetopito alfetopito commented Jun 18, 2025

Summary

POL is duplicated currently because it's being added to Uniswap and Coingecko generated token lists.
image

This change:

  • adds the possibility to prevent a token from being added to the list
  • blocks the token with address 0x0000000000000000000000000000000000001010 from being added to Polygon lists
  • BONUS: replaced ts-node with tsx as ts-node was no longer working for me locally, and tsx worked out of the box this time.

Testing

Ran the script locally

Summary by CodeRabbit

  • Bug Fixes
    • Removed the native Polygon token (MATIC/POL) from CoinGecko and Uniswap token lists for Polygon.
  • Chores
    • Updated internal logic to support token removal via overrides.
    • Adjusted package dependencies, replacing ts-node with tsx for script execution.

@alfetopito alfetopito self-assigned this Jun 18, 2025
@alfetopito alfetopito requested a review from a team June 18, 2025 10:54
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 18, 2025

Walkthrough

This update removes the Polygon native token (address 0x0000000000000000000000000000000000001010) from relevant token lists and introduces an override to exclude it from processing. The build script is updated to use "tsx" instead of "ts-node", with corresponding dependency adjustments. Minor refactoring of import order and type definitions is included.

Changes

File(s) Change Summary
package.json Switched script runner from "ts-node" to "tsx"; removed "ts-node" dependency; added "tsx" as a devDependency.
src/public/CoinGecko.137.json,
src/public/Uniswap.137.json
Removed Polygon native token entry (address 0x000...1010); incremented version numbers.
src/scripts/auxLists/index.ts Added override for Polygon native token address, setting it to null for exclusion.
src/scripts/auxLists/processTokenList.ts Updated logic to filter out tokens with override set to null; reordered imports.
src/scripts/auxLists/utils.ts Changed Overrides type to allow null values; reordered imports.

Sequence Diagram(s)

sequenceDiagram
    participant Script as Build Script
    participant TokenList as Token List Processor
    participant Overrides as Override Config
    participant Output as Output List

    Script->>TokenList: Run processTokenList()
    TokenList->>Overrides: Check for token overrides
    Overrides-->>TokenList: Return override (may be null)
    TokenList->>TokenList: If override is null, exclude token
    TokenList->>Output: Write filtered token list
Loading

Possibly related PRs

  • cowprotocol/token-lists#943: Removes or overrides the Polygon native token at address 0x000...1010, similar to this PR's exclusion logic.
  • cowprotocol/token-lists#922: Previously added the same Polygon native token now being removed, showing a direct relationship in token handling.

Suggested reviewers

  • shoom3301

Poem

A hop, a skip, a token gone,
The Polygon bunny hops along—
With scripts anew and lists refined,
The native coin is left behind.
"tsx" now leads the run,
While null means tokens come undone.
Onward, code! The work is done.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2bace19 and 11b7114.

📒 Files selected for processing (1)
  • src/scripts/auxLists/processTokenList.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/scripts/auxLists/processTokenList.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Validate list schema
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
package.json (1)

38-38: Clarify tsx invocation for future flags

Using bare tsx depends on Yarn forwarding the remaining CLI args (the script path) verbatim.
If you later need Node flags (--inspect, --no-warnings, etc.) or a specific tsconfig, you’ll have to modify this again.
Consider making the full CLI explicit now to avoid follow-up edits.

src/scripts/auxLists/index.ts (1)

13-13: Guard against case-mismatch when looking up overrides

processTokenList lower–cases the address before doing the lookup (overrides[token.address.toLowerCase()]).
Here you store the address literal already in lower-case, which is correct, but it’s easy to accidentally paste a checksummed / mixed-case address next time and silently miss the override.

Consider forcing the key to lower-case at assignment time as well:

-OVERRIDES[SupportedChainId.POLYGON]['0x0000000000000000000000000000000000001010'] = null
+OVERRIDES[SupportedChainId.POLYGON]['0x0000000000000000000000000000000000001010'.toLowerCase()] = null

Not a blocker, but it hardens the pattern against future copy-paste errors.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b706f57 and 2bace19.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • package.json (2 hunks)
  • src/public/CoinGecko.137.json (1 hunks)
  • src/public/Uniswap.137.json (1 hunks)
  • src/scripts/auxLists/index.ts (1 hunks)
  • src/scripts/auxLists/processTokenList.ts (2 hunks)
  • src/scripts/auxLists/utils.ts (2 hunks)
🔇 Additional comments (5)
package.json (1)

62-63: Ensure tsx is present in all environments

tsx moved to devDependencies, yet every yarn run-script … relies on it at runtime.
If any CI/CD job installs production dependencies only (yarn --production / npm ci --only=production), these scripts will break.

Either:

  1. Guarantee devDeps are always installed, or
  2. Promote tsx to regular dependencies.
src/scripts/auxLists/utils.ts (2)

1-1: Import re-ordering LGTM

Moving the @cowprotocol/cow-sdk import to the top improves consistency; no functional impact.


16-17: ```shell
#!/bin/bash

Display the mapping logic in processTokenList to inspect override handling

sed -n '120,190p' src/scripts/auxLists/processTokenList.ts


</details>
<details>
<summary>src/public/CoinGecko.137.json (1)</summary>

`8-8`: **Version bump: sync across Polygon (137) lists.**

The major version was incremented to 29 here; please verify that Uniswap.137.json and any other Polygon chain-137 lists have their version numbers updated in lockstep to prevent downstream mismatches.

</details>
<details>
<summary>src/public/Uniswap.137.json (1)</summary>

`8-9`: **Version bump aligns with semver rules – looks good**

A major version increment (`0.x → 1.0`) is appropriate after removing the native POL token entry.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Copy link
Contributor

@cowdan cowdan left a comment

Choose a reason for hiding this comment

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

lgtm

@alfetopito alfetopito merged commit 548399c into main Jun 18, 2025
7 checks passed
@alfetopito alfetopito deleted the fix/duplicates branch June 18, 2025 13:11
@github-actions github-actions bot locked and limited conversation to collaborators Jun 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants