Skip to content

Conversation

@aimensahnoun
Copy link
Member

@aimensahnoun aimensahnoun commented Mar 20, 2025

Resolves #1574

Description of the changes

This PR adds and updates currency aggregator configurations for multiple blockchain networks:

  • Gnosis
  • Arbitrum One
  • Optimism
  • Base
  • Avalanche
  • BSC

Why is this change necessary/important?

These changes expand the supported token pair mappings across multiple networks, enabling more currency conversion options for the Request Network protocol.

Impact of the changes

  • Increases the number of supported token pairs for currency conversion
  • Enables price aggregation for new tokens on Arbitrum One
  • Adds complete token pair mapping support for Avalanche, Base, and BSC networks

Process

Used the chainlinkPath script from the toolbox to generate the aggregator configurations:

  1. Run: yarn toolbox chainlinkPath mainnet
  2. Script fetches all Chainlink aggregator events from the contract
  3. Generates a graph of currency conversion paths
  4. Outputs the configuration in the format needed for conversion-aggregators.ts

Summary by CodeRabbit

  • New Features

    • Expanded currency conversion support to include multiple blockchain networks, including xdai, arbitrum-one, avalanche, bsc, optimism, and base.
    • Introduced new JSON files defining relationships for various Ethereum addresses, enhancing network connectivity.
  • Bug Fixes

    • Removed unsupported ERC20 token from the test suite for conversion support.
  • Refactor

    • Reorganized configuration data to streamline conversion logic.
    • Removed outdated network exclusions to deliver a more unified conversion experience.

…, bsc, optimism, and base; update existing aggregator configurations
@aimensahnoun aimensahnoun self-assigned this Mar 20, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 20, 2025

Walkthrough

The changes update multiple aggregator files for mapping Ethereum addresses and their interconnections. Several new JSON files have been introduced (for Avalanche, Base, BSC, Optimism, and XDAI), while existing files (Arbitrum One, Fantom, Mainnet, Matic, and Sepolia) have been modified with added, removed, or replaced keys. In addition, the conversion aggregators file now imports these new JSON files, updating the configuration by adding the new networks to the currency pairs and removing them from the no-conversion list.

Changes

File(s) Change Summary
aggregators/arbitrum-one.json, aggregators/avalanche.json, aggregators/base.json, aggregators/bsc.json, aggregators/optimism.json, aggregators/xdai.json New JSON aggregator files added; each defines mappings between Ethereum addresses and their relationships.
aggregators/fantom.json, aggregators/mainnet.json, aggregators/matic.json, aggregators/sepolia.json Updated JSON files with added, removed, or updated key-value pairs to adjust address mappings and relationships.
conversion-aggregators.ts Added new JSON aggregator imports; updated chainlinkCurrencyPairs to include new networks and removed them from noConversionNetworks.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant InvoiceService
    participant ConversionAggregators
    User->>InvoiceService: Request conversion invoice (e.g., Base, BSC, Optimism, XDAI)
    InvoiceService->>ConversionAggregators: Lookup network aggregator mapping
    ConversionAggregators-->>InvoiceService: Return currency pairs configuration
    InvoiceService->>ExternalPaymentProcessor: Process conversion invoice
Loading

Assessment against linked issues

Objective Addressed Explanation
Enable conversion invoices on Base, BSC, Optimism, and Gnosis (XDAI) [#1574]

Possibly related PRs

  • chore: publish 0.49.0 #1439: The changes in the main PR, which involve adding new key-value pairs in the arbitrum-one.json file, are related to the updates in the retrieved PR that also includes enhancements to payment network types, specifically mentioning support for Arbitrum, indicating a direct connection at the code level.
  • chore: publish 0.58.0 #1571: The changes in the main PR, which involve adding new key-value pairs in the arbitrum-one.json file, are related to the updates in the retrieved PR that also includes modifications to the @requestnetwork/currency package, indicating a connection through shared dependencies and potential updates to the same data structures.
  • chore: publish 0.48.0 #1435: The changes in the main PR, which involve adding new key-value pairs in the JSON structure for address mappings, are related to the retrieved PR, which includes bug fixes for invalid decimal places for specific tokens on the Sepolia network, as both involve modifications to address mappings and currency handling.

Suggested reviewers

  • kevindavee
  • leoslr
  • MantisClone
  • sstefdev
  • alexandre-abrioux

📜 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 d9e6288 and 1cf99ff.

📒 Files selected for processing (1)
  • packages/advanced-logic/test/extensions/payment-network/any-to-eth-proxy.test.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-and-test
🔇 Additional comments (2)
packages/advanced-logic/test/extensions/payment-network/any-to-eth-proxy.test.ts (2)

340-344: Test case properly updated to use ERC20 token instead of BTC

The change from BTC to ERC20 with the OCEAN token address is consistent with the PR objectives to update currency aggregator configurations across networks.


354-354: Error message correctly updated to reflect the new token address

The error message has been properly updated to reference the OCEAN token address instead of the previous BTC value, maintaining consistency with the updated test case.

✨ Finishing Touches
  • 📝 Generate Docstrings

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

…ism-and-gnosis' of github.com:RequestNetwork/requestNetwork into 1574-create-conversion-invoices-fails-on-base-bsc-optimism-and-gnosis
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: 0

🧹 Nitpick comments (1)
packages/advanced-logic/test/extensions/payment-network/any-to-eth-proxy.test.ts (1)

354-354: Simplified error message format

The error message format has been simplified to only include the token name (OCEAN) without the full address and network in the error message, unlike other similar error messages in the test files. While this works, consider standardizing error message formats across the codebase.

Consider using a consistent format for error messages across all test files:

-          'The currency (OCEAN) of the request is not supported for this payment network.',
+          'The currency (OCEAN-mainnet, 0x967da4048cD07aB37855c090aAF366e4ce1b9F48) of the request is not supported for this payment network.',
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6ad6dfa and d9e6288.

📒 Files selected for processing (3)
  • packages/advanced-logic/test/extensions/payment-network/any-to-erc20-proxy.test.ts (2 hunks)
  • packages/advanced-logic/test/extensions/payment-network/any-to-eth-proxy.test.ts (2 hunks)
  • packages/advanced-logic/test/extensions/payment-network/meta.test.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-and-test
🔇 Additional comments (5)
packages/advanced-logic/test/extensions/payment-network/meta.test.ts (2)

150-153: Consistent test data update for OCEAN token

The changes correctly update the test scenario to use the OCEAN ERC20 token address instead of BTC for testing unsupported currency behavior. This aligns with the purpose of adding new currency aggregator configurations.


164-164: Error message updated to match new currency

The error message has been correctly updated to reflect the OCEAN token instead of BTC, maintaining consistency with the test case modifications.

packages/advanced-logic/test/extensions/payment-network/any-to-eth-proxy.test.ts (1)

341-344: Test data updated for OCEAN token

The test case has been appropriately updated to use the OCEAN ERC20 token for testing unsupported currency behavior. This change is consistent with the PR's purpose of updating currency configurations.

packages/advanced-logic/test/extensions/payment-network/any-to-erc20-proxy.test.ts (2)

396-399: Test data updated for OCEAN token validation

The test case has been appropriately updated to use the OCEAN ERC20 token for testing unsupported currency behavior, consistent with other test file changes in this PR.


410-410: Error message updated to match new currency

The error message has been correctly updated to include the full details of the OCEAN token, maintaining consistency between test case and expected error.

@MantisClone
Copy link
Member

MantisClone commented Mar 21, 2025

@aimensahnoun Please explain how these aggregator configuration changes were generated to the PR description 🙏 - You mentioned there was a toolbox script you used.

Copy link
Member

@MantisClone MantisClone left a comment

Choose a reason for hiding this comment

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

Approved 👍 Pending comment resolution.

@aimensahnoun aimensahnoun merged commit 2e139be into master Mar 24, 2025
10 checks passed
@aimensahnoun aimensahnoun deleted the 1574-create-conversion-invoices-fails-on-base-bsc-optimism-and-gnosis branch March 24, 2025 12:19
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.

Create conversion invoices fails on Base, BSC, Optimism, and Gnosis

4 participants