Skip to content
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

refactor!: enhance ChainAddresses structure and update values #110

Merged
merged 2 commits into from
Feb 11, 2025

Conversation

shuhuiluo
Copy link
Collaborator

@shuhuiluo shuhuiluo commented Feb 9, 2025

Updated ChainAddresses field names for clarity and consistency. Introduced new v4-specific fields and corrected existing address values across multiple networks. These changes improve readability and ensure better network compatibility.

Closes #91.

Summary by CodeRabbit

  • New Features

    • Expanded blockchain network support with additional networks including BASE Sepolia, Unichain, and Monad Testnet.
    • Token mappings have been enhanced to include support for new network tokens.
  • Refactor

    • Improved naming consistency for network address configurations, ensuring clearer and standardized address identifiers.
    • Updated package version to enhance stability and performance.

Updated `ChainAddresses` field names for clarity and consistency. Introduced new v4-specific fields and corrected existing address values across multiple networks. These changes improve readability and ensure better network compatibility.
@shuhuiluo shuhuiluo requested a review from malik672 February 9, 2025 06:03
Copy link

coderabbitai bot commented Feb 9, 2025

Walkthrough

This pull request updates the blockchain address handling by renaming various fields and introducing new ones in the ChainAddresses struct. It also revises constants and the SUPPORTED_CHAINS collection in the ChainId enum to include new chain identifiers and variants. Additionally, the WETH9 implementation has been expanded to support additional chain identifiers and tokens. The changes include updating field names and address literals for consistency, updating initialization logic, and modifying tests to reflect the new definitions.

Changes

File(s) Change Summary
src/addresses.rs Renamed multiple fields (e.g., v3_core_factory_addressv3_core_factory), added new fields (v4_state_view, v4_quoter), updated default implementations and lazy_static blocks with 0x prefix, added UNICHAIN and MONAD_TESTNET constants.
src/chains.rs Added new enum variants (BASE_SEPOLIA, UNICHAIN, MONAD_TESTNET), renamed ASTROCHAIN_SEPOLIA to UNICHAIN_SEPOLIA, updated SUPPORTED_CHAINS constant size from 24 to 27.
src/entities/weth9.rs Expanded token mappings: added support for chain IDs 11155111 and 84532, included new token WMON for chain ID 10143, and updated the on_chain method accordingly.
Cargo.toml Updated package version from 4.0.0-rc4 to 4.0.0-rc5.

Assessment against linked issues

Objective Addressed Explanation
Sync with upstream (#91)

Possibly related PRs

Suggested reviewers

  • malik672

Poem

I'm a rabbit with a code-filled heart,
Hopping through bytes and fields with art,
Renamed addresses and tokens in the breeze,
New chains and constants that aim to please,
With a 0x hop and a joyful leap,
I celebrate these changes in bounds so deep!


📜 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 cbe544f and 5fda25e.

📒 Files selected for processing (1)
  • Cargo.toml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • Cargo.toml

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • 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. (Beta)
  • @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

@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: 0

🧹 Nitpick comments (1)
src/addresses.rs (1)

646-654: Consider adding tests for QUOTER_V2_ADDRESSES.

While there are comprehensive tests for SWAP_ROUTER_02_ADDRESSES, similar test coverage for the new QUOTER_V2_ADDRESSES would be beneficial.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 42e8959 and cbe544f.

📒 Files selected for processing (3)
  • src/addresses.rs (21 hunks)
  • src/chains.rs (2 hunks)
  • src/entities/weth9.rs (6 hunks)
🔇 Additional comments (5)
src/chains.rs (1)

26-36: LGTM! Chain variants and IDs are properly defined.

The new chain variants are correctly added with appropriate chain IDs, and the SUPPORTED_CHAINS array is properly updated to include them.

Also applies to: 43-71

src/entities/weth9.rs (1)

36-37: LGTM! WETH9 token mappings are properly updated.

The new chain IDs are correctly mapped to their respective WETH tokens. Note that MONAD_TESTNET appropriately uses "WMON" (Wrapped Monad) instead of "WETH".

Also applies to: 48-49, 57-58, 81-87, 165-171, 235-241

src/addresses.rs (3)

8-24: LGTM! ChainAddresses struct improvements enhance clarity.

The field renames and additions are well-structured:

  1. Removed redundant "_address" suffixes for better readability
  2. Added v4-specific fields as optional addresses

482-496: LGTM! New chain addresses are properly defined.

The address constants for UNICHAIN_SEPOLIA, UNICHAIN, and MONAD_TESTNET are correctly defined with appropriate addresses for all required contracts.

Also applies to: 499-514, 516-525


533-562: LGTM! Chain-to-addresses mapping is properly updated.

The CHAIN_TO_ADDRESSES_MAP is correctly updated to include the new chains and their respective addresses.

@shuhuiluo shuhuiluo merged commit 07e4903 into master Feb 11, 2025
3 checks passed
@shuhuiluo shuhuiluo deleted the address branch February 11, 2025 02:28
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.

Sync with upstream
2 participants