Skip to content

Conversation

@vignesha22
Copy link
Contributor

@vignesha22 vignesha22 commented Aug 1, 2025

Description

  • Fixed Cron job related bugs
  • Added more logs on cronJob for better debugging
  • Changed to more generic fetching of network config

Types of changes

What types of changes does your code introduce?

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Other (please describe):

Further comments (optional)

Summary by CodeRabbit

  • New Features

    • Added support for a new blockchain network with chain ID 88888888 and its USDC token.
    • Introduced centralized configuration for multi-token paymasters and oracles across multiple networks.
  • Chores

    • Seeded initial token and paymaster data for multi-token paymaster functionality.
  • Refactor

    • Updated cron jobs to use imported constants for paymasters and oracles, simplifying configuration management.
    • Improved error handling and logging in scheduled jobs.
    • Adjusted cron schedule for native token oracle updates to run every 30 minutes.
  • Bug Fixes

    • Enhanced network configuration retrieval to handle optional or missing entry points.

@coderabbitai
Copy link

coderabbitai bot commented Aug 1, 2025

Walkthrough

This change introduces a migration script to seed the multi_token_paymaster table, adds and updates constants for multi-token paymasters and oracles across multiple blockchain networks, and enhances the server and utility logic for handling these configurations. Error handling and logging are improved, cron job schedules are updated, and configuration retrieval is made more robust.

Changes

Cohort / File(s) Change Summary
Migration: Seed Multi-Token Paymaster Table
backend/migrations/2025073000001-seed-data.cjs
Adds a migration script to seed the multi_token_paymaster table with multiple token configurations, including normalized addresses, paymaster/oracle addresses, decimals, and timestamps. Provides both up (insert) and down (delete) functions for migration control.
Multi-Token Paymaster & Oracle Constants
backend/src/constants/MultiTokenPaymasterCronJob.ts
Introduces static mappings for multi-token paymaster and oracle addresses across several blockchain networks, exported as constants for use in cron jobs and other backend logic.
Token Decimals and Symbol Update
backend/src/constants/MultitokenPaymaster.ts
Adds a new network (chain ID 88888888) and token mapping to the TokenDecimalsAndSymbol constant, specifying decimals and symbol for a USDC token.
Server Logic & Cron Job Refactor
backend/src/server.ts
Refactors server-side cron jobs to use the new constants directly, improves error handling and logging, adjusts cron schedules, and simplifies network config retrieval. Removes decoding of configuration from server config in favor of imported constants.
Network Config Utility Enhancement
backend/src/utils/common.ts
Updates getNetworkConfig to make the entryPoint parameter optional, adds explicit handling for missing or empty entryPoint, and ensures robust fallback behavior when searching for network configurations.

Sequence Diagram(s)

sequenceDiagram
    participant CronJob as Cron Job (updateTokenOracleData)
    participant Constants as Constants (MULTI_TOKEN_PAYMASTERS/ORACLES)
    participant Utils as getNetworkConfig
    participant Provider as Blockchain Provider
    participant Paymaster as Paymaster Contract

    CronJob->>Constants: Access paymaster/oracle mappings
    loop For each chainId in constants
        CronJob->>Utils: getNetworkConfig(chainId)
        alt Network config found
            CronJob->>Provider: Create provider for network
            alt Provider created
                CronJob->>Paymaster: Fetch/update token prices via oracle
                Paymaster-->>CronJob: Return updated price data
            else Provider creation fails
                CronJob->>CronJob: Log error, continue
            end
        else Network config missing
            CronJob->>CronJob: Log error, continue
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Import_Line_Change #208: Adds oracle decimals constants and methods for fetching oracle decimals, related to multi-token paymaster oracle handling.
  • PRO-3097-MTP_V07 #201: Introduces multiTokenPaymaster V07 support including ABI, model, and signing logic, related to multi-token paymaster features.
  • added some necessary improvements (#195) #196: Adds token decimals in constants for multi-token paymaster, closely related to configuration and seeding of multi-token paymaster data.

Suggested reviewers

  • kanthgithub
  • nikhilkumar1612
  • cryptonoyaiba
  • ch4r10t33r

Poem

In the warren where code bunnies hop,
We mapped paymasters from bottom to top.
Tokens and oracles, all neat in a row,
With decimals and symbols, the data will flow.
Cron jobs now smarter, logs clear as a bell—
This bunny’s migration went ever so well!
🐇✨

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: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dbc5134 and b2430de.

📒 Files selected for processing (1)
  • backend/src/server.ts (7 hunks)
🔇 Additional comments (5)
backend/src/server.ts (5)

66-74: LGTM! Paymaster configuration properly extended.

The additional configuration parameters for fee markups and token configurations are well-structured and align with the multi-token paymaster enhancements.


112-117: Good error handling improvement for server initialization.

Wrapping the initial price fetch in try-catch prevents server startup failures and provides better debugging information.


275-275: Network config retrieval correctly simplified.

The getNetworkConfig calls properly utilize the updated function signature with optional entryPoint parameter.

Also applies to: 300-300, 314-314


364-384: Excellent improvements to error handling and resilience.

The updateNativeTokenOracleData cron job now has:

  • Configurable scheduling via environment variable
  • Proper error isolation per chain
  • Network config validation
  • Detailed logging for debugging
  • Continued processing on individual chain failures

These changes significantly improve the reliability of the cron job.


392-480: Well-structured refactoring of updateTokenOracleData cron job.

The refactoring successfully:

  • Centralizes configuration using imported constants instead of base64 decoding
  • Implements comprehensive error handling at multiple levels
  • Supports multiple oracle types (chainlink, orochi, default)
  • Provides detailed logging for debugging
  • Ensures processing continues for remaining chains/tokens on individual failures

This aligns perfectly with the PR objectives of improving Cron job reliability and debugging capabilities.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch develop

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:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

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

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: 8

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 28bcf40 and dbc5134.

📒 Files selected for processing (5)
  • backend/migrations/2025073000001-seed-data.cjs (1 hunks)
  • backend/src/constants/MultiTokenPaymasterCronJob.ts (1 hunks)
  • backend/src/constants/MultitokenPaymaster.ts (1 hunks)
  • backend/src/server.ts (7 hunks)
  • backend/src/utils/common.ts (1 hunks)
🔇 Additional comments (1)
backend/src/server.ts (1)

364-387: Good improvements to error handling and performance.

The changes to reduce cron frequency from 2 to 30 minutes and add comprehensive error handling with explicit logging are excellent improvements for system stability and debugging.

Comment on lines +5 to +11
await queryInterface.sequelize.query(`INSERT INTO "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster ("TOKEN_ADDRESS", "PAYMASTER_ADDRESS", "ORACLE_ADDRESS", "CHAIN_ID", "DECIMALS", "CREATED_AT", "UPDATED_AT", "EP_VERSION") VALUES ('${ethers.utils.getAddress('0xdAC17F958D2ee523a2206206994597C13D831ec7')}', '0x5E6ce32Bb6Fa47001cf87f2f9E07d5Fd3dE57990', '0x3E7d1eAB13ad0104d2750B8863b489D65364e32D', 1, 6, NOW(), NOW(), 'EPV_07')`);
await queryInterface.sequelize.query(`INSERT INTO "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster ("TOKEN_ADDRESS", "PAYMASTER_ADDRESS", "ORACLE_ADDRESS", "CHAIN_ID", "DECIMALS", "CREATED_AT", "UPDATED_AT", "EP_VERSION") VALUES ('${ethers.utils.getAddress('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48')}', '0x5E6ce32Bb6Fa47001cf87f2f9E07d5Fd3dE57990', '0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6', 1, 6, NOW(), NOW(), 'EPV_07')`);
await queryInterface.sequelize.query(`INSERT INTO "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster ("TOKEN_ADDRESS", "PAYMASTER_ADDRESS", "ORACLE_ADDRESS", "CHAIN_ID", "DECIMALS", "CREATED_AT", "UPDATED_AT", "EP_VERSION") VALUES ('${ethers.utils.getAddress('0x514910771AF9Ca656af840dff83E8264EcF986CA')}', '0x5E6ce32Bb6Fa47001cf87f2f9E07d5Fd3dE57990', '0x2c1d072e956AFFC0D435Cb7AC38EF18d24d9127c', 1, 18, NOW(), NOW(), 'EPV_07')`);
await queryInterface.sequelize.query(`INSERT INTO "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster ("TOKEN_ADDRESS", "PAYMASTER_ADDRESS", "ORACLE_ADDRESS", "CHAIN_ID", "DECIMALS", "CREATED_AT", "UPDATED_AT", "EP_VERSION") VALUES ('${ethers.utils.getAddress('0xB8c77482e45F1F44dE1745F52C74426C631bDD52')}', '0x5E6ce32Bb6Fa47001cf87f2f9E07d5Fd3dE57990', '0x14e613AC84a31f709eadbdF89C6CC390fDc9540A', 1, 18, NOW(), NOW(), 'EPV_07')`);
await queryInterface.sequelize.query(`INSERT INTO "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster ("TOKEN_ADDRESS", "PAYMASTER_ADDRESS", "ORACLE_ADDRESS", "CHAIN_ID", "DECIMALS", "CREATED_AT", "UPDATED_AT", "EP_VERSION") VALUES ('${ethers.utils.getAddress('0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1')}', '0x5E6ce32Bb6Fa47001cf87f2f9E07d5Fd3dE57990', '0x31697852a68433DbCc2Ff612c516d69E3D9bd08F', 1, 18, NOW(), NOW(), 'EPV_07')`);
await queryInterface.sequelize.query(`INSERT INTO "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster ("TOKEN_ADDRESS", "PAYMASTER_ADDRESS", "ORACLE_ADDRESS", "CHAIN_ID", "DECIMALS", "CREATED_AT", "UPDATED_AT", "EP_VERSION") VALUES ('${ethers.utils.getAddress('0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF')}', '0x5E6ce32Bb6Fa47001cf87f2f9E07d5Fd3dE57990', '0xBAEbEFc1D023c0feCcc047Bff42E75F15Ff213E6', 1, 18, NOW(), NOW(), 'EPV_07')`);
await queryInterface.sequelize.query(`INSERT INTO "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster ("TOKEN_ADDRESS", "PAYMASTER_ADDRESS", "ORACLE_ADDRESS", "CHAIN_ID", "DECIMALS", "CREATED_AT", "UPDATED_AT", "EP_VERSION") VALUES ('${ethers.utils.getAddress('0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0')}', '0x5E6ce32Bb6Fa47001cf87f2f9E07d5Fd3dE57990', '0x7bAC85A8a13A4BcD8abb3eB7d6b4d632c5a57676', 1, 18, NOW(), NOW(), 'EPV_07')`);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Paymaster address mismatch with constants file.

The paymaster address 0x5E6ce32Bb6Fa47001cf87f2f9E07d5Fd3dE57990 used in this migration differs from the one defined in MultiTokenPaymasterCronJob.ts for chain 1 (0xb5739957aFD931FeDfb25Fb18e2eabe3C69801c5). This inconsistency could lead to issues.

Please verify which address is correct and ensure consistency across all files.

🤖 Prompt for AI Agents
In backend/migrations/2025073000001-seed-data.cjs around lines 5 to 11, the
paymaster address used in the INSERT statements does not match the paymaster
address defined in MultiTokenPaymasterCronJob.ts for chain 1. Verify the correct
paymaster address and update all occurrences in this migration file to use the
consistent, correct address matching the constants file to avoid discrepancies.

Comment on lines +14 to +16
async function down({ context: queryInterface }) {
await queryInterface.sequelize.query(`DELETE IF EXISTS FROM "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster;`);
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix SQL syntax error in DELETE statement.

The SQL syntax is incorrect. DELETE IF EXISTS is not valid SQL syntax.

-    await queryInterface.sequelize.query(`DELETE IF EXISTS FROM "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster;`);
+    await queryInterface.sequelize.query(`DELETE FROM "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster;`);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async function down({ context: queryInterface }) {
await queryInterface.sequelize.query(`DELETE IF EXISTS FROM "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster;`);
}
async function down({ context: queryInterface }) {
await queryInterface.sequelize.query(`DELETE FROM "${process.env.DATABASE_SCHEMA_NAME}".multi_token_paymaster;`);
}
🤖 Prompt for AI Agents
In backend/migrations/2025073000001-seed-data.cjs around lines 14 to 16, the SQL
statement uses invalid syntax "DELETE IF EXISTS". Replace this with a valid SQL
DELETE statement, such as "DELETE FROM" without "IF EXISTS". If conditional
deletion is needed, consider using a WHERE clause or check existence in
application logic before deletion.

Comment on lines +204 to 206
88888888: {
'0x97423A68BAe94b5De52d767a17aBCc54c157c0E5': { decimals: 6, symbol: 'USDC' }
}
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify the custom chain ID 88888888.

The chain ID 88888888 appears to be a custom or test network. Please ensure this is intentional and properly documented, as it could cause confusion with standard chain IDs.


🌐 Web query:

What is chain ID 88888888 in blockchain networks? Is it a known testnet or custom network?

💡 Result:

Chain ID 88888888 is associated with the T.E.A.M Blockchain, a custom blockchain network. This network utilizes the TEAM token (symbol: $TEAM) and offers an RPC endpoint at https://88888888.rpc.thirdweb.com. Its block explorer is available at teamscan. (thirdweb.com)

It's important to note that chain IDs are unique identifiers for blockchain networks. The same chain ID can be used by different networks, which may lead to conflicts or confusion. For instance, the chain ID 88888888 has also been used by other networks, such as the Ancient8 Mainnet. (developer.vialabs.io) This overlap can cause issues, like scam warnings when adding networks to wallets like MetaMask. (github.com)

Therefore, while chain ID 88888888 is currently assigned to the T.E.A.M Blockchain, it's advisable to verify the network's details and ensure you're connecting to the correct blockchain to avoid potential issues.

Citations:


Add documentation and confirmation for chain ID 88888888 (T.E.A.M Blockchain)

Chain ID 88888888 is indeed assigned to the T.E.A.M Blockchain (TEAM token) with RPC https://88888888.rpc.thirdweb.com and explorer “teamscan,” but it’s also been reused by other networks (e.g., Ancient8 Mainnet), which can trigger scam warnings in wallets like MetaMask. To avoid confusion and potential conflicts, please:

  • Confirm that you intend to support the T.E.A.M Blockchain and not another network using the same ID.
  • Document this chain in backend/src/constants/MultitokenPaymaster.ts (around lines 204–206) with a brief comment linking to the network details (RPC endpoint, explorer, token symbol).
  • Update your project’s README or network-configuration docs to include:
    • Chain name (“T.E.A.M Blockchain”)
    • Chain ID (88888888)
    • RPC endpoint and block explorer URL
    • Native token symbol ($TEAM)
  • (Optional) Consider centralizing supported chains into an enum or config object to prevent future ID collisions.
🤖 Prompt for AI Agents
In backend/src/constants/MultitokenPaymaster.ts around lines 204 to 206, add a
clear comment above the chain ID 88888888 entry confirming it represents the
T.E.A.M Blockchain, including its RPC endpoint, block explorer URL, and native
token symbol ($TEAM). Verify that this is the intended network to support and
not another using the same ID. Additionally, update the project README or
network configuration documentation to list the chain name, ID, RPC, explorer,
and token symbol. Optionally, refactor supported chains into a centralized enum
or config object to avoid future ID conflicts.

Comment on lines +5 to +127
export const MULTI_TOKEN_PAYMASTERS: Record<string, Record<string, string>> = {
"137": {
"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xc2132D05D31c914a87C6611C10748AEb04B58e8F": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xD6DF932A45C0f255f85145f286eA0b292B21C90B": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x8f3cf7ad23cd3cadbd9735aff958023239c6a063": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xa1c57f48f0deb89f569dfbe6e2b7f46d33606fd4": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xb5c064f955d8e7f38fe0460c556a72987494ee17": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xbbba073c31bf03b8acf7c28ef0738decf3695683": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x0b3f868e0be5597d5db7feb59e1cadbb0fdda50a": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x2e1ad108ff1d8c782fcbbb89aad783ac49586756": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xb33eaad8d922b1083446dc23f610c2567fb5180f": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x172370d5cd63279efa6d502dab29171933a610af": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xfa68fb4628dff1028cfec22b4162fccd0d45efb6": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3"
},
"8453": {
"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x9EaF8C1E34F05a589EDa6BAfdF391Cf6Ad3CB239": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3"
},
"42161": {
"0xaf88d065e77c8cC2239327C5EDb3A432268e5831": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x912CE59144191C1204E64559FE8253a0e49E6548": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x371c7ec6D8039ff7933a2AA28EB827Ffe1F52f07": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x040d1EdC9569d4Bab2D15287Dc5A4F10F56a56B8": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xf97f4df75117a78c1A5a0DBb814Af92458539FB4": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xd4d42F0b6DEF4CE0383636770eF773390d85c61A": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x3E6648C5a70A150A88bCE65F4aD4d506Fe15d2AF": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x6694340fc020c5E6B96567843da2df01b2CE1eb6": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x13Ad51ed4F1B7e9Dc168d8a00cB3f4dDD85EfA60": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xEC70Dcb4A1EFa46b8F2D97C310C9c4790ba5ffA8": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x3082CC23568eA640225c2467653dB90e9250AaA0": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3"
},
"10": {
"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x68f180fcCe6836688e9084f035309E29Bf0A2095": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x9e1028F5F1D5eDE59748FFceE5532509976840E0": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x4200000000000000000000000000000000000042": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x3c8B650257cFb5f272f799F5e2b4e65093a11a05": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x9Bcef72be871e61ED4fBbc7630889beE758eb81D": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x7F5c764cBc14f9669B88837ca1490cCa17c31607": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3"
},
"56": {
"0x55d398326f99059fF775485246999027B3197955": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x2170Ed0880ac9A755fd29B2688956BD959F933F8": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x1D2F0da169ceB9fC7B3144628dB156f3F6c60dBE": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x14016E85a25aeb13065688cAFB43044C2ef86784": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xCC42724C6683B7E57334c4E856f4c9965ED682bD": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xBf5140A22578168FD562DCcF235E5D43A02ce9B1": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xf7DE7E8A6bd59ED41a4b5fe50278b3B7f31384dF": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x7Ddc52c4De30e94Be3A6A0A2b259b2850f421989": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xAD29AbB318791D579433D831ed122aFeAf29dcfe": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xaEC945e04baF28b135Fa7c640f624f8D90F1C3a6": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x715D400F88C167884bbCc41C5FeA407ed4D2f8A0": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x90C97F71E18723b0Cf0dfa30ee176Ab653E89F40": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x965F527D9159dCe6288a2219DB51fc6Eef120dD1": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xfe56d5892BDffC7BF58f2E84BE1b2C32D21C308b": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x4691937a7508860F876c9c0a2a617E7d9E945D4B": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x16939ef78684453bfDFb47825F8a5F714f12623a": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x8F0528cE5eF7B51152A59745bEfDD91D97091d2F": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x762539b45A1dCcE3D36d080F74d1AED37844b878": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x67ee3Cb086F8a16f34beE3ca72FAD36F7Db929e2": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xFd7B3A77848f1C2D67E05E54d78d174a0C850335": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x1Fa4a73a3F0133f0025378af00236f3aBDEE5D63": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x0Eb3a705fc54725037CC9e008bDede697f62F335": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x0D8Ce2A99Bb6e3B7Db580eD848240e4a0F9aE153": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x8fF795a6F4D97E7887C79beA79aba5cc76444aDf": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x4338665CBB7B2485A8855A139b75D5e34AB0DB94": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x56b6fB708fC5732DEC1Afc8D8556423A2EDcCbD6": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xa2B726B1145A4773F68593CF171187d8EBe4d495": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x52CE071Bd9b1C4B00A0b92D298c512478CaD67e8": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x47BEAd2563dCBf3bF2c9407fEa4dC236fAbA485A": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x88f1A5ae2A3BF98AEAF342D26B30a79438c9142e": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xcF6BB5389c92Bdda8a3747Ddb454cB7a64626C63": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x3EE2200Efb3400fAbB9AacF31297cBdD1d435D47": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xAD6cAEb32CD2c308980a548bD0Bc5AA4306c6c18": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x7083609fCE4d1d8Dc0C979AAb8c869Ea2C873402": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x570A5D26f7765Ecb712C0924E4De545B89fD43dF": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0xbA2aE424d960c26247Dd6c32edC70B295c744C43": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x2eD9a5C8C13b93955103B9a7C167B67Ef4d568a3": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
"0x111111111117dC0aa78b770fA6A738034120C302": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3"
},
"1": {
"0xdAC17F958D2ee523a2206206994597C13D831ec7": "0xb5739957aFD931FeDfb25Fb18e2eabe3C69801c5",
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48": "0xb5739957aFD931FeDfb25Fb18e2eabe3C69801c5",
"0x514910771AF9Ca656af840dff83E8264EcF986CA": "0xb5739957aFD931FeDfb25Fb18e2eabe3C69801c5",
"0xB8c77482e45F1F44dE1745F52C74426C631bDD52": "0xb5739957aFD931FeDfb25Fb18e2eabe3C69801c5",
"0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1": "0xb5739957aFD931FeDfb25Fb18e2eabe3C69801c5",
"0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF": "0xb5739957aFD931FeDfb25Fb18e2eabe3C69801c5",
"0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0": "0xb5739957aFD931FeDfb25Fb18e2eabe3C69801c5"
},
"204": {
"0x7c6b91D9Be155A6Db01f749217d76fF02A7227F2": "0xb5739957aFD931FeDfb25Fb18e2eabe3C69801c5",
"0xE7798f023fC62146e8Aa1b36Da45fb70855a77Ea": "0xb5739957aFD931FeDfb25Fb18e2eabe3C69801c5",
"0x9e5aac1ba1a2e6aed6b32689dfcf62a509ca96f3": "0xb5739957aFD931FeDfb25Fb18e2eabe3C69801c5",
"0x50c5725949a6f0c72e6c4a641f24049a917db0cb": "0xb5739957aFD931FeDfb25Fb18e2eabe3C69801c5"
},
"888888888": {
"0x97423A68BAe94b5De52d767a17aBCc54c157c0E5": "0xa056CC60088CEfba94d9e16d5408459039FA8D64"
},
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Standardize token address formatting to checksummed addresses.

Token addresses are inconsistently formatted with mixed cases. All Ethereum addresses should be checksummed for consistency and to prevent potential issues.

-    "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",
+    "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063": "0x386eD13Ba07E1C409693b299BbB9839d05aF20c3",

Apply similar checksumming to all lowercase addresses in the file. You can use ethers.utils.getAddress() to get the checksummed version.

🤖 Prompt for AI Agents
In backend/src/constants/MultiTokenPaymasterCronJob.ts from lines 5 to 127, the
token addresses are inconsistently formatted with mixed or lowercase letters. To
fix this, convert all token addresses to their checksummed versions using
ethers.utils.getAddress() to ensure consistent and correct Ethereum address
formatting throughout the file.

Comment on lines +124 to +126
"888888888": {
"0x97423A68BAe94b5De52d767a17aBCc54c157c0E5": "0xa056CC60088CEfba94d9e16d5408459039FA8D64"
},
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Document the purpose of chain ID 888888888.

This custom chain ID appears in multiple files. Please add a comment explaining what network this represents (e.g., testnet, local development, etc.).

+  // Custom testnet/development network
   "888888888": {
     "0x97423A68BAe94b5De52d767a17aBCc54c157c0E5": "0xa056CC60088CEfba94d9e16d5408459039FA8D64"
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"888888888": {
"0x97423A68BAe94b5De52d767a17aBCc54c157c0E5": "0xa056CC60088CEfba94d9e16d5408459039FA8D64"
},
// Custom testnet/development network
"888888888": {
"0x97423A68BAe94b5De52d767a17aBCc54c157c0E5": "0xa056CC60088CEfba94d9e16d5408459039FA8D64"
},
🤖 Prompt for AI Agents
In backend/src/constants/MultiTokenPaymasterCronJob.ts around lines 124 to 126,
add a comment above the entry for chain ID 888888888 explaining the purpose of
this custom chain ID, specifying which network it represents such as a testnet,
local development, or any other environment. This will clarify its usage for
future maintainers.

Comment on lines +12 to 39
export function getNetworkConfig(key: any, supportedNetworks: any, entryPoint?: string[]) {
if (supportedNetworks !== '') {
const buffer = Buffer.from(supportedNetworks, 'base64');
const SUPPORTED_NETWORKS = JSON.parse(buffer.toString())
const SUPPORTED_NETWORKS = JSON.parse(buffer.toString());
if (entryPoint === undefined || entryPoint === null || entryPoint.length === 0) {
const result = SUPPORTED_NETWORKS.find((chain: any) => chain["chainId"] == key);
if (!result) {
return SupportedNetworks.find((chain) => chain.chainId == key);
}
return result;
}
const result = SUPPORTED_NETWORKS.find((chain: any) => { return chain["chainId"] == key && entryPoint.includes(chain["entryPoint"]) });
if (!result) {
return SupportedNetworks.find((chain) => chain.chainId == key && entryPoint.includes(chain.entryPoint));
}
return result
} else
return SupportedNetworks.find((chain) => chain.chainId == key && entryPoint.includes(chain.entryPoint));
} else {
if (entryPoint === undefined || entryPoint === null || entryPoint.length === 0) {
const result = SupportedNetworks.find((chain) => chain.chainId == key);
if (!result) {
return null;
}
return result;
}
const result = SupportedNetworks.find((chain) => { return chain.chainId == key && entryPoint.includes(chain.entryPoint) });
return result ? result : null;
}
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Refactor to reduce code duplication and improve type safety.

The function has duplicate logic for handling cases with and without entryPoint. Also, using any type reduces type safety.

-export function getNetworkConfig(key: any, supportedNetworks: any, entryPoint?: string[]) {
+export function getNetworkConfig(key: string | number, supportedNetworks: string, entryPoint?: string[]) {
+  const isEntryPointProvided = entryPoint !== undefined && entryPoint !== null && entryPoint.length > 0;
+  
+  let networks = SupportedNetworks;
   if (supportedNetworks !== '') {
     const buffer = Buffer.from(supportedNetworks, 'base64');
-    const SUPPORTED_NETWORKS = JSON.parse(buffer.toString());
-    if (entryPoint === undefined || entryPoint === null || entryPoint.length === 0) {
-      const result = SUPPORTED_NETWORKS.find((chain: any) => chain["chainId"] == key);
-      if (!result) {
-        return SupportedNetworks.find((chain) => chain.chainId == key);
-      }
-      return result;
-    }
-    const result = SUPPORTED_NETWORKS.find((chain: any) => { return chain["chainId"] == key && entryPoint.includes(chain["entryPoint"]) });
-    if (!result) {
-      return SupportedNetworks.find((chain) => chain.chainId == key && entryPoint.includes(chain.entryPoint));
-    }
-    return result
-  } else {
-    if (entryPoint === undefined || entryPoint === null || entryPoint.length === 0) {
-      const result = SupportedNetworks.find((chain) => chain.chainId == key);
-      if (!result) {
-        return null;
-      }
-      return result;
-    }
-    const result = SupportedNetworks.find((chain) => { return chain.chainId == key && entryPoint.includes(chain.entryPoint) });
-    return result ? result : null;
+    networks = JSON.parse(buffer.toString());
   }
+  
+  const result = networks.find((chain: any) => {
+    const chainIdMatch = chain.chainId == key;
+    if (!isEntryPointProvided) {
+      return chainIdMatch;
+    }
+    return chainIdMatch && entryPoint.includes(chain.entryPoint);
+  });
+  
+  if (!result && supportedNetworks !== '') {
+    return SupportedNetworks.find((chain) => {
+      const chainIdMatch = chain.chainId == key;
+      if (!isEntryPointProvided) {
+        return chainIdMatch;
+      }
+      return chainIdMatch && entryPoint.includes(chain.entryPoint);
+    });
+  }
+  
+  return result || null;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export function getNetworkConfig(key: any, supportedNetworks: any, entryPoint?: string[]) {
if (supportedNetworks !== '') {
const buffer = Buffer.from(supportedNetworks, 'base64');
const SUPPORTED_NETWORKS = JSON.parse(buffer.toString())
const SUPPORTED_NETWORKS = JSON.parse(buffer.toString());
if (entryPoint === undefined || entryPoint === null || entryPoint.length === 0) {
const result = SUPPORTED_NETWORKS.find((chain: any) => chain["chainId"] == key);
if (!result) {
return SupportedNetworks.find((chain) => chain.chainId == key);
}
return result;
}
const result = SUPPORTED_NETWORKS.find((chain: any) => { return chain["chainId"] == key && entryPoint.includes(chain["entryPoint"]) });
if (!result) {
return SupportedNetworks.find((chain) => chain.chainId == key && entryPoint.includes(chain.entryPoint));
}
return result
} else
return SupportedNetworks.find((chain) => chain.chainId == key && entryPoint.includes(chain.entryPoint));
} else {
if (entryPoint === undefined || entryPoint === null || entryPoint.length === 0) {
const result = SupportedNetworks.find((chain) => chain.chainId == key);
if (!result) {
return null;
}
return result;
}
const result = SupportedNetworks.find((chain) => { return chain.chainId == key && entryPoint.includes(chain.entryPoint) });
return result ? result : null;
}
}
export function getNetworkConfig(key: string | number, supportedNetworks: string, entryPoint?: string[]) {
const isEntryPointProvided = entryPoint !== undefined && entryPoint !== null && entryPoint.length > 0;
let networks = SupportedNetworks;
if (supportedNetworks !== '') {
const buffer = Buffer.from(supportedNetworks, 'base64');
networks = JSON.parse(buffer.toString());
}
const result = networks.find((chain: any) => {
const chainIdMatch = chain.chainId == key;
if (!isEntryPointProvided) {
return chainIdMatch;
}
return chainIdMatch && entryPoint.includes(chain.entryPoint);
});
if (!result && supportedNetworks !== '') {
return SupportedNetworks.find((chain) => {
const chainIdMatch = chain.chainId == key;
if (!isEntryPointProvided) {
return chainIdMatch;
}
return chainIdMatch && entryPoint.includes(chain.entryPoint);
});
}
return result || null;
}
🤖 Prompt for AI Agents
In backend/src/utils/common.ts around lines 12 to 39, the getNetworkConfig
function duplicates logic for handling cases with and without entryPoint and
uses the any type, reducing type safety. Refactor by extracting the common find
logic into a single reusable function or variable to avoid repetition, and
replace any types with more specific types or interfaces that describe the
expected structure of supportedNetworks and entryPoint. This will improve
readability, maintainability, and type safety.

@cloudflare-workers-and-pages
Copy link

Deploying arka with  Cloudflare Pages  Cloudflare Pages

Latest commit: b2430de
Status: ✅  Deploy successful!
Preview URL: https://a6973ea2.arka-3qg.pages.dev
Branch Preview URL: https://develop.arka-3qg.pages.dev

View logs

@vignesha22 vignesha22 merged commit f028108 into master Aug 5, 2025
4 of 5 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Dec 9, 2025
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants