Skip to content

chore: add Uniswap v3 router & factory to addresses #470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 25, 2025

Conversation

fadeev
Copy link
Member

@fadeev fadeev commented Mar 11, 2025

Summary by CodeRabbit

  • New Features

    • Added support for Uniswap V3 options.
    • Introduced a new network configuration on Zeta Mainnet for Uniswap V3 Router.
    • Expanded type definitions to include new Uniswap V3 types.
  • Refactor

    • Enhanced address management logic to optimize inclusion criteria for specific network configurations.

@fadeev fadeev requested review from a team as code owners March 11, 2025 10:25
Copy link
Contributor

coderabbitai bot commented Mar 11, 2025

📝 Walkthrough

Walkthrough

This pull request updates a type definition, enhances JSON address data, and modifies business logic in address handling. The ParamType union now includes two additional Uniswap V3 types. The JSON file is updated with a new entry for the Uniswap V3 Router, and the fetchFactoryV3 function is modified to conditionally skip the creation of a WETH object for certain chain IDs.

Changes

File(s) Change Summary
lib/types.ts Updated the ParamType union to include "uniswapV3Factory" and "uniswapV3Router" in addition to the existing types.
tasks/addresses.mainnet.json, tasks/addresses.ts Added a new JSON entry for a Uniswap V3 Router address and modified the fetchFactoryV3 function to avoid creating a WETH object when router.chain_id is 7000 or 7001.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant fetchFactoryV3
    participant Addresses

    Caller->>fetchFactoryV3: Call fetchFactoryV3(router, addresses)
    fetchFactoryV3->>fetchFactoryV3: Check router.chain_id
    alt chain_id is 7000 or 7001
        fetchFactoryV3->>Addresses: Skip WETH creation
    else chain_id is not 7000/7001
        fetchFactoryV3->>fetchFactoryV3: Create wethObj
        fetchFactoryV3->>Addresses: Verify if wethObj exists
        Addresses-->>fetchFactoryV3: Return existence check
        fetchFactoryV3->>Addresses: Add wethObj if not present
    end
    fetchFactoryV3-->>Caller: Return updated addresses array
Loading

Possibly related PRs

  • fix: typescript generated files errors - #475 #477: The changes in the main PR involve modifications to the ParamType type in lib/types.ts, while the retrieved PR updates the ParamSymbol type in the same file, indicating a related focus on type definitions within the same context.
  • feat: Remove outdated chains on protocol contracts types #276: The changes in the main PR to the ParamType in lib/types.ts are related to the modifications in the ParamType and ParamChainName types in the retrieved PR, as both involve updates to type definitions within the same file.

Suggested reviewers

  • CharlieMc0
  • skosito

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 265452e and 9d2924c.

⛔ Files ignored due to path filters (1)
  • data/addresses.mainnet.json is excluded by !data/**
📒 Files selected for processing (2)
  • lib/types.ts (1 hunks)
  • tasks/addresses.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • tasks/addresses.ts
  • lib/types.ts

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

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.

@@ -6,7 +6,6 @@ title = ""
no-section-label = true
additional-js = ["solidity.min.js"]
additional-css = ["book.css"]
mathjax-support = true
Copy link
Member Author

Choose a reason for hiding this comment

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

This is removed automatically by Foundry when generating docs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

same for me


if (!addresses.some((e: any) => isEqual(e, wethObj))) {
addresses.push(wethObj);
if (router.chain_id !== 7000 && router.chain_id !== 7001) {
Copy link
Member Author

Choose a reason for hiding this comment

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

We're already getting WZETA address from /get_chain_params_for_chain, so we don't need to push it again from this part of the script.

@codecov-commenter
Copy link

codecov-commenter commented Mar 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.22%. Comparing base (26f0708) to head (9d2924c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #470   +/-   ##
=======================================
  Coverage   86.22%   86.22%           
=======================================
  Files           9        9           
  Lines         559      559           
  Branches      129      129           
=======================================
  Hits          482      482           
  Misses         77       77           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fadeev fadeev linked an issue Mar 11, 2025 that may be closed by this pull request
@fadeev
Copy link
Member Author

fadeev commented Mar 25, 2025

@zeta-chain/smart-contracts please, review. I need one more approval to merge.

@fadeev fadeev merged commit 36255fd into main Mar 25, 2025
13 checks passed
@fadeev fadeev deleted the zetachain-uniswapv3-address branch March 25, 2025 13:01
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.

Add Uniswap v3 router address
4 participants