Skip to content

Conversation

@limitofzero
Copy link
Contributor

@limitofzero limitofzero commented Aug 4, 2025

Summary

Fixes #6082

This token contract accepts salt for eip712 domain structure instead of chainId
image

permit-utils lib that we use supports this type of permits, I've just added the flag to add this check for this token:

https://github.com/1inch/permit-signed-approvals-utils/blob/fde3bc38d6179f4d3ab9fac8b1b5f9834521eace/src/eip-2612-permit.const.ts#L31

Also I added an ability to check only specific token address by adding new parameter in cli

Summary by CodeRabbit

  • New Features
    • Added support for specifying a token address to filter permit info results.
  • Bug Fixes
    • Updated token classification so that "USD Coin (PoS)" is now recognized as EIP-2612 supported.
  • Chores
    • Updated a dependency version for improved compatibility.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@socket-security
Copy link

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​cowprotocol/​permit-utils@​0.7.0-RC.0 ⏵ 0.7.0-RC.17310098 +191 +1100

View full report

@limitofzero
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Aug 4, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 4, 2025

Walkthrough

The changes introduce an optional token parameter to the permit info fetching logic, allowing filtering by a specific token address. This involves updates to type definitions, function signatures, and CLI argument handling. Additionally, a token's permit support classification is updated in a JSON data file, and a dependency version is incremented in package.json.

Changes

Cohort / File(s) Change Summary
Add token filter option to permit info fetching
src/permitInfo/fetchPermitInfo.ts, src/permitInfo/fetchPermitInfoByChain.ts
Introduced an optional token parameter to filter permit info fetching by a specific token address. Updated type definitions, function signatures, and CLI argument parsing to support this option.
Token permit type update
src/public/PermitInfo.137.json
Moved a token entry from "unsupported" to "eip-2612" type, reclassifying its permit support.
Dependency update
package.json
Updated the version of @cowprotocol/permit-utils from ^0.7.0-RC.0 to ^0.7.0-RC.1.

Sequence Diagram(s)

sequenceDiagram
    participant CLI
    participant fetchPermitInfoByChain
    participant fetchPermitInfo
    participant TokenList

    CLI->>fetchPermitInfoByChain: Call with chainId, recheck, output, token
    fetchPermitInfoByChain->>fetchPermitInfo: Pass options (including token)
    fetchPermitInfo->>TokenList: Load tokens
    alt token specified
        fetchPermitInfo->>TokenList: Filter tokens by address
        alt token found
            fetchPermitInfo->>fetchPermitInfo: Fetch permit info for filtered token
        else token not found
            fetchPermitInfo->>fetchPermitInfo: Log and return early
        end
    else no token specified
        fetchPermitInfo->>fetchPermitInfo: Fetch permit info for all tokens
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • Fix/fetch permit argv #941: Modifies fetchPermitInfoByChain to handle additional CLI arguments and pass them to fetchPermitInfo, similar to the changes in this PR.

Suggested reviewers

  • shoom3301

Poem

A token hop, a filter drop,
Now fetch just what you need—
From JSON fields to CLI yields,
The code has gained new speed.
With permit types and versions bright,
This bunny’s work is neat—delight! 🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 7c967df and 73a0f03.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (4)
  • package.json (1 hunks)
  • src/permitInfo/fetchPermitInfo.ts (2 hunks)
  • src/permitInfo/fetchPermitInfoByChain.ts (2 hunks)
  • src/public/PermitInfo.137.json (1 hunks)
🔇 Additional comments (7)
package.json (1)

44-44: LGTM! Dependency version update aligns with permit enhancement.

The version bump from RC.0 to RC.1 for @cowprotocol/permit-utils is appropriate and likely includes the salt support for EIP-712 permits mentioned in the PR objectives.

src/permitInfo/fetchPermitInfoByChain.ts (2)

8-8: LGTM! Clean addition of token parameter.

The extraction of the token parameter from the command line arguments is correctly positioned and follows the existing pattern.


25-25: LGTM! Proper parameter forwarding.

The token parameter is correctly passed through to the fetchPermitInfo function, maintaining consistency with the function signature.

src/public/PermitInfo.137.json (1)

97-101: LGTM! Token reclassification is appropriate.

The reclassification of "USD Coin (PoS)" from unsupported to EIP-2612 support is correctly formatted and aligns with the PR's objective to support salt-based EIP-712 permits.

src/permitInfo/fetchPermitInfo.ts (3)

56-56: LGTM! Clean type extension.

The addition of the optional token parameter to the FetchPermitInfoOptions type is well-structured and follows TypeScript conventions.


60-60: LGTM! Proper parameter destructuring.

The token parameter is correctly added to the destructuring assignment, maintaining consistency with the function signature.


89-101: LGTM! Well-implemented token filtering logic.

The token filtering implementation is robust:

  • Case-insensitive address comparison for better user experience
  • Early return when no matching token is found, avoiding unnecessary processing
  • Clear logging for user feedback
  • Efficient array replacement using length clearing and spread operator

This enhancement successfully enables selective permit info fetching for specific tokens as mentioned in the PR objectives.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/support-salt-for-eip712

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.
  • 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.

Support

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

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 generate unit tests to generate unit tests for 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.

@limitofzero limitofzero added the bug Something isn't working label Aug 4, 2025
@limitofzero limitofzero self-assigned this Aug 4, 2025
Copy link
Collaborator

Choose a reason for hiding this comment

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

As mentioned on cowprotocol/cowswap#6086 (comment), let's update DAI on Polygon too

"0x8f3cf7ad23cd3cadbd9735aff958023239c6a063": {
"type": "unsupported",
"name": "(PoS) Dai Stablecoin"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image there is another issue with this token, I can fix it but I need time to investigate the reason

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for checking, never mind that one for now.

@alfetopito alfetopito merged commit ff3d06d into main Aug 4, 2025
7 of 8 checks passed
@alfetopito alfetopito deleted the fix/support-salt-for-eip712 branch August 4, 2025 15:50
@github-actions github-actions bot locked and limited conversation to collaborators Aug 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants