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

feat: multichain indexer #292

Closed
wants to merge 2 commits into from
Closed

feat: multichain indexer #292

wants to merge 2 commits into from

Conversation

gaboesquivel
Copy link
Member

@gaboesquivel gaboesquivel commented Jul 28, 2024

Summary by Sourcery

This pull request introduces a multichain indexer to handle multiple blockchain networks. It refactors the contract exports for better organization, adds chain information to token contract data structures, and updates client creation logic to dynamically use the appropriate chain configuration. Additionally, outdated contract files were removed and replaced with updated versions.

  • New Features:
    • Introduced a multichain indexer for handling multiple blockchain networks.
  • Enhancements:
    • Refactored contract exports to organize them into 'auction' and 'tokens' directories.
    • Added chain information to EVM and EOS token contract data structures.
    • Updated the client creation logic to dynamically use the appropriate chain configuration.
  • Chores:
    • Removed outdated contract files and replaced them with updated versions in the appropriate directories.

Summary by CodeRabbit

  • New Features

    • Updated dependencies to enhance application stability and functionality, including significant upgrades for @rainbow-me/rainbowkit, @wagmi/connectors, and wagmi.
    • Introduced new properties to token contracts, providing clearer blockchain network affiliations.
  • Bug Fixes

    • Improved client instantiation methods for better performance and reliability in blockchain interactions.
  • Documentation

    • Updated package descriptions and organized module exports for better clarity and maintainability.
  • Chores

    • Removed outdated installation scripts and adjusted dependency orders for improved management.

Copy link

vercel bot commented Jul 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
bitlauncher ❌ Failed (Inspect) Jul 28, 2024 6:09pm
smartsale-faucet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 28, 2024 6:09pm

Copy link
Contributor

sourcery-ai bot commented Jul 28, 2024

Reviewer's Guide by Sourcery

This pull request implements a multichain indexer by reorganizing contract exports, adding chain properties to contract objects, and updating client definitions. It also replaces 'smartsaleChains' with 'appChains' for better chain management.

File-Level Changes

Files Changes
packages/app-contracts/src/dev/index.ts
packages/app-contracts/src/prod/index.ts
packages/app-contracts/src/index.ts
Reorganized exports and added contract data imports. Defined and exported 'devContracts', 'prodContracts', and 'appContracts' objects.
apps/indexer/src/lib/issuer-client.ts
apps/indexer/src/lib/utils.ts
apps/indexer/src/modules/auction/easyauction.ts
apps/indexer/src/modules/swaps/evm-transfers.ts
apps/indexer/src/modules/auction/auction-indexer.ts
apps/indexer/src/modules/presale/evm-contributions.ts
Moved 'client' definitions inside functions or modules. Replaced 'smartsaleChains' with 'appChains'.
packages/app-contracts/src/dev/tokens/eos-fake-bitusd.ts
packages/app-contracts/src/dev/tokens/eos-fake-usdt.ts
packages/app-contracts/src/prod/tokens/eos-bitusd.ts
packages/app-contracts/src/prod/tokens/eos-usdt.ts
Updated import from 'TokenContractData' to 'EOSTokenContractData'.
packages/app-contracts/src/dev/auction/testnet-allow-list.ts
packages/app-contracts/src/dev/auction/testnet-deposit-order.ts
packages/app-contracts/src/dev/auction/testnet-easy-auction.ts
packages/app-contracts/src/dev/tokens/sepolia-usdt.ts
packages/app-contracts/src/dev/tokens/testnet-mbots-prelaunch.ts
packages/app-contracts/src/dev/tokens/testnet-usd-cred.ts
packages/app-contracts/src/dev/tokens/testnet-usdt.ts
Added 'chain' property to contract objects.
packages/app-env/src/chains.ts
packages/app-env/src/env.ts
Replaced 'smartsaleChains' with 'appChains' and updated chain mappings.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

coderabbitai bot commented Jul 28, 2024

Walkthrough

This update encompasses a series of enhancements across multiple modules aimed at improving dependency management, refining client configurations for blockchain interactions, and restructuring code for clarity and maintainability. Key changes include upgrading package versions, modifying client instantiation methods, and reorganizing contract exports, which collectively enhance the functionality and adaptability of the application.

Changes

Files Change Summary
apps/faucet/package.json, apps/webapp/package.json Updated dependencies to newer versions and removed deprecated scripts, improving stability and feature access.
apps/indexer/src/lib/issuer-client.ts, apps/indexer/src/lib/utils.ts, apps/indexer/src/modules/auction/auction-indexer.ts, apps/indexer/src/modules/auction/easyauction.ts Refined client instantiation for blockchain interactions, enhancing performance and modularity in fetching data.
apps/indexer/src/modules/presale/evm-contributions.ts, apps/indexer/src/modules/swaps/evm-transfers.ts Replaced chain management imports to unify source data, aiding in modularity and clarity.
packages/app-contracts/src/dev/*.ts, packages/app-contracts/src/prod/*.ts Added chain properties to various contract definitions, improving context for blockchain interactions and aligning with new organization structure.
packages/app-env/package.json, packages/app-env/src/chains.ts, packages/app-env/src/env.ts Modified environment settings and updated dependencies, enhancing clarity and flexibility in chain management configurations.

Sequence Diagram(s)

sequenceDiagram
    participant A as Client
    participant B as Issuer
    participant C as Auction Indexer
    participant D as Token Contract

    A->>B: Request Token Details
    B->>D: Fetch from Blockchain
    D-->>B: Return Token Data
    B-->>A: Send Token Details

    A->>C: Start Auction Indexing
    C->>D: Retrieve Auction Events
    D-->>C: Send Auction Data
    C-->>A: Provide Auction Status
Loading

🐰 In fields so wide and bright,
With code that hops, day and night.
Dependencies dance, clients now gleam,
For every function, there's a dream.
Let contracts bloom, in chains they play,
A rabbit's joy in code today! 🌼


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @gaboesquivel - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider reviewing the imports between app-contracts and app-env to ensure there are no circular dependencies.
  • Look for opportunities to further abstract common token data to reduce duplication, especially in the USDC and USDT contract definitions.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.



const auctions:ContractData[] = [
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Clarify if the empty auctions array is intentional or if it should be populated.

export * from "./tokens/eos-fake-bitusd";
export * from "./tokens/eos-fake-usdt";

import { TestnetEasyAuction } from "./auction/testnet-easy-auction";
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (complexity): Consider using dynamic imports to simplify the code and reduce maintenance overhead.

The new code introduces increased complexity due to the following reasons:

  1. Increased Number of Imports: The individual imports for each module make the import section more cluttered and harder to manage.
  2. Manual List Management: Manually creating arrays for evmTokens, eosTokens, and auctions can lead to errors and requires additional maintenance.
  3. Redundant Information: The categorization of tokens and auctions is redundant because the file paths already provide a clear structure.
  4. Increased Maintenance Overhead: Adding or modifying contracts requires updates in multiple parts of the code, increasing the likelihood of errors.

Consider using dynamic imports to simplify the code and reduce maintenance overhead. Here’s an example:

const context = require.context('./', true, /\.\/(auction|tokens)\/.*\.js$/);

const evmTokens = [];
const eosTokens = [];
const auctions = [];

context.keys().forEach((key) => {
  const module = context(key);
  const moduleName = key.split('/').pop().replace('.js', '');

  if (key.includes('/auction/')) {
    auctions.push(module[moduleName]);
  } else if (key.includes('/tokens/')) {
    if (key.includes('eos')) {
      eosTokens.push(module[moduleName]);
    } else {
      evmTokens.push(module[moduleName]);
    }
  }
});

export const devContracts = {
  tokens: {
    evm: evmTokens,
    eos: eosTokens,
  },
  auctions,
};

This approach reduces redundancy, leverages the existing file structure, and makes the code more maintainable and scalable.

Copy link

⚡️ Lighthouse report

Page: https://bitlauncher-n4rerso6b-bitcash.vercel.app/
Report https://storage.googleapis.com/lighthouse-infrastructure.appspot.com/reports/1722188532332-35596.report.html

Category Score
🟠 Performance 87
🟢 Accessibility 93
🟢 Best practices 100
🟠 SEO 67
🔴 PWA 38

Page: https://bitlauncher-n4rerso6b-bitcash.vercel.app/about
Report https://storage.googleapis.com/lighthouse-infrastructure.appspot.com/reports/1722188532687-88583.report.html

Category Score
🟠 Performance 87
🟢 Accessibility 93
🟢 Best practices 100
🟠 SEO 67
🔴 PWA 38

Page: https://bitlauncher-n4rerso6b-bitcash.vercel.app/security
Report https://storage.googleapis.com/lighthouse-infrastructure.appspot.com/reports/1722188533003-22250.report.html

Category Score
🟠 Performance 88
🟢 Accessibility 93
🟢 Best practices 100
🟠 SEO 67
🔴 PWA 38

Page: https://bitlauncher-n4rerso6b-bitcash.vercel.app/bitcash-bitlauncher
Report https://storage.googleapis.com/lighthouse-infrastructure.appspot.com/reports/1722188533310-30993.report.html

Category Score
🟠 Performance 87
🟢 Accessibility 93
🟢 Best practices 100
🟠 SEO 67
🔴 PWA 38

Page: https://bitlauncher-n4rerso6b-bitcash.vercel.app/blog
Report https://storage.googleapis.com/lighthouse-infrastructure.appspot.com/reports/1722188533613-73101.report.html

Category Score
🟠 Performance 88
🟢 Accessibility 93
🟢 Best practices 100
🟠 SEO 67
🔴 PWA 38

Page: https://bitlauncher-n4rerso6b-bitcash.vercel.app/blog/ai
Report https://storage.googleapis.com/lighthouse-infrastructure.appspot.com/reports/1722188533936-22364.report.html

Category Score
🟠 Performance 86
🟢 Accessibility 93
🟢 Best practices 100
🟠 SEO 67
🔴 PWA 38

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4190291 and d6f3e88.

Files ignored due to path filters (1)
  • bun.lockb is excluded by !**/bun.lockb
Files selected for processing (29)
  • apps/faucet/package.json (1 hunks)
  • apps/indexer/src/lib/issuer-client.ts (1 hunks)
  • apps/indexer/src/lib/utils.ts (2 hunks)
  • apps/indexer/src/modules/auction/auction-indexer.ts (1 hunks)
  • apps/indexer/src/modules/auction/easyauction.ts (1 hunks)
  • apps/indexer/src/modules/presale/evm-contributions.ts (2 hunks)
  • apps/indexer/src/modules/swaps/evm-transfers.ts (1 hunks)
  • apps/indexer/src/routes/healthcheck.ts (1 hunks)
  • apps/webapp/package.json (4 hunks)
  • packages/app-contracts/src/dev/auction/testnet-allow-list.ts (1 hunks)
  • packages/app-contracts/src/dev/auction/testnet-deposit-order.ts (1 hunks)
  • packages/app-contracts/src/dev/auction/testnet-easy-auction.ts (1 hunks)
  • packages/app-contracts/src/dev/index.ts (1 hunks)
  • packages/app-contracts/src/dev/tokens/eos-fake-bitusd.ts (1 hunks)
  • packages/app-contracts/src/dev/tokens/eos-fake-usdt.ts (1 hunks)
  • packages/app-contracts/src/dev/tokens/sepolia-usdt.ts (2 hunks)
  • packages/app-contracts/src/dev/tokens/testnet-mbots-prelaunch.ts (2 hunks)
  • packages/app-contracts/src/dev/tokens/testnet-usd-cred.ts (2 hunks)
  • packages/app-contracts/src/dev/tokens/testnet-usdt.ts (2 hunks)
  • packages/app-contracts/src/index.ts (1 hunks)
  • packages/app-contracts/src/prod/index.ts (1 hunks)
  • packages/app-contracts/src/prod/tokens/eos-bitusd.ts (1 hunks)
  • packages/app-contracts/src/prod/tokens/eos-usdt.ts (1 hunks)
  • packages/app-contracts/src/prod/tokens/usdc.ts (1 hunks)
  • packages/app-contracts/src/prod/tokens/usdt.ts (15 hunks)
  • packages/app-contracts/src/types.ts (2 hunks)
  • packages/app-env/package.json (1 hunks)
  • packages/app-env/src/chains.ts (2 hunks)
  • packages/app-env/src/env.ts (3 hunks)
Files skipped from review due to trivial changes (1)
  • apps/indexer/src/routes/healthcheck.ts
Additional comments not posted (86)
packages/app-contracts/src/index.ts (3)

1-2: Imports look good.

The imports devContracts and prodContracts are correctly defined.


4-6: Re-exporting modules and types.

The re-exporting of dev, prod, and types modules is correctly defined.


8-11: Unified export of contracts.

The appContracts object encapsulates both devContracts and prodContracts, improving modularity and maintainability.

apps/indexer/src/modules/auction/easyauction.ts (3)

1-3: Imports look good.

The imports http, createPublicClient, getContract, and other necessary modules are correctly defined.


5-8: Client configuration looks good.

The client constant is correctly defined using createPublicClient with eosEvmTestnet and http().


Line range hint 10-13:
Contract export looks good.

The easyAuction export is correctly defined using getContract with TestnetEasyAuction and the client.

packages/app-contracts/src/prod/tokens/eos-usdt.ts (2)

1-1: Import looks good.

The import EOSTokenContractData is correctly defined.


Line range hint 3-12:
Constant definition looks good.

The EOSUSDT constant is correctly defined with the type EOSTokenContractData.

packages/app-contracts/src/prod/tokens/eos-bitusd.ts (2)

1-1: Import statement updated correctly.

The import statement now correctly imports EOSTokenContractData instead of TokenContractData.


Line range hint 3-10:
Type updated correctly for EOSBITUSD.

The type of the EOSBITUSD constant has been updated to EOSTokenContractData, enhancing type safety and aligning with the intended use of EOS-specific token data structures.

packages/app-contracts/src/dev/tokens/eos-fake-bitusd.ts (2)

1-1: Import statement updated correctly.

The import statement now correctly imports EOSTokenContractData instead of TokenContractData.


Line range hint 3-10:
Type updated correctly for EOSFakeBITUSD.

The type of the EOSFakeBITUSD constant has been updated to EOSTokenContractData, enhancing type safety and aligning with the intended use of EOS-specific token data structures.

packages/app-contracts/src/dev/tokens/eos-fake-usdt.ts (2)

1-1: Import statement updated correctly.

The import statement now correctly imports EOSTokenContractData instead of TokenContractData.


Line range hint 3-10:
Type updated correctly for EOSFakeUSDT.

The type of the EOSFakeUSDT constant has been updated to EOSTokenContractData, enhancing type safety and aligning with the intended use of EOS-specific token data structures.

packages/app-env/package.json (2)

5-5: Approved: Simplified package description.

The change from "bitlauncher Environment Configurations" to "Environment Configurations" improves clarity.


11-13: Approved: Dependency updates.

The addition of lodash and the reordering of dependencies are appropriate changes.

However, ensure that lodash is used in the codebase.

Verification successful

Verified: lodash is used in the codebase.

The addition of lodash as a dependency is justified as it is used in multiple files:

  • apps/webapp/components/layout/providers.tsx
  • apps/webapp/lib/projects.ts
  • apps/webapp/scripts/translate-category.ts
  • apps/webapp/scripts/translate.ts
  • apps/webapp/services/datocms/datocms-blog.service.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if `lodash` is used in the codebase.

# Test: Search for the usage of `lodash`. Expect: At least one occurrence of `lodash` usage.
rg --type js --type ts 'lodash'

Length of output: 369

apps/indexer/src/lib/issuer-client.ts (2)

14-17: Approved: Client instantiation moved inside function.

Moving the client instantiation inside the getCurrentBlockHeight function ensures a new instance is created each time, avoiding potential issues with stale data.


1-13: Verify the removal of sepoliaClient.

Ensure that the removal of sepoliaClient does not affect other parts of the codebase.

packages/app-contracts/src/prod/index.ts (4)

2-5: Approved: Improved organization of token exports.

Moving the token exports to a nested tokens directory enhances the organization and clarity of the code.


7-11: Approved: Necessary imports for token contracts.

The new imports for token contracts are necessary for the new prodContracts structure and ensure that the relevant contract data is available.


13-27: Approved: Enhanced modularity and clarity with prodContracts structure.

The new evmTokens, eosTokens, and auctions arrays, along with the prodContracts object, enhance the modularity and clarity of the code.


28-34: Approved: Clear and organized prodContracts export.

The prodContracts object export provides a clear and organized structure for accessing token contracts and auctions in the application.

packages/app-contracts/src/types.ts (2)

21-21: LGTM! Verify the usage of the updated interface.

The addition of the chain property to EVMContractData enhances the data structure. Ensure that all instances of EVMContractData are updated to include the new chain property.

Verification successful

All instances of EVMContractData have been updated to include the chain property.

The addition of the chain property to EVMContractData has been successfully integrated into the identified instances:

  • TestnetEasyAuction
  • TestnetDepositOrder
  • TestnetAllowList
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all instances of `EVMContractData` are updated to include the new `chain` property.

# Test: Search for the usage of `EVMContractData`. Expect: All instances should include the `chain` property.
rg --type ts -A 5 $'EVMContractData'

Length of output: 3157


Script:

#!/bin/bash
# Description: Verify that the `chain` property is included in all instances of `EVMContractData`.

# Check the specific instances of `EVMContractData` in the identified files.
rg --type ts -A 10 'export const TestnetEasyAuction: EVMContractData =' packages/app-contracts/src/dev/auction/testnet-easy-auction.ts
rg --type ts -A 10 'export const TestnetDepositOrder: EVMContractData =' packages/app-contracts/src/dev/auction/testnet-deposit-order.ts
rg --type ts -A 10 'export const TestnetAllowList: EVMContractData =' packages/app-contracts/src/dev/auction/testnet-allow-list.ts

Length of output: 1256


27-27: LGTM! Verify the usage of the updated interface.

The addition of the chain property to EVMTokenContractData enhances the data structure. Ensure that all instances of EVMTokenContractData are updated to include the new chain property.

packages/app-env/src/chains.ts (4)

1-1: LGTM!

The inclusion of devContracts and prodContracts from the app-contracts module enhances the dynamic handling of blockchain networks.


23-23: LGTM!

The removal of the as const assertion from eosEvmTestnet allows for more flexibility in its application.


25-26: LGTM!

The updates to prodChains and testChains arrays enhance the configurability of the chains used in different environments, aligning them with the respective contract definitions.


28-34: LGTM!

The renaming of the export to appChains reflects a broader purpose for this structure. The refactoring of the createMapFromId function improves code readability and efficiency.

apps/faucet/package.json (3)

17-17: LGTM!

The version update for @rainbow-me/rainbowkit to 2.1.2 ensures compatibility and leverages improvements in the library.


19-19: LGTM!

The version update for @wagmi/connectors to ^5.1.1 ensures compatibility and leverages improvements in the library.


33-33: LGTM!

The version update for wagmi to ^2.12.1 ensures compatibility and leverages improvements in the library.

packages/app-contracts/src/dev/index.ts (4)

1-8: LGTM! The reorganization of exports improves modularity.

The new export paths are correctly organized into auction and tokens directories, enhancing code clarity and maintainability.


10-17: LGTM! The explicit imports improve dependency clarity.

The imports for each contract are correctly added, aligning with the new export structure and enhancing code readability.


20-35: LGTM! The introduction of arrays consolidates contract data effectively.

The arrays for evmTokens, eosTokens, and auctions are correctly defined, improving data organization and access.


37-43: LGTM! The devContracts object enhances usability.

The devContracts object is correctly defined, encapsulating the organized contract data and improving module usability.

packages/app-contracts/src/dev/auction/testnet-allow-list.ts (2)

1-1: LGTM! The import for sepolia is correct and necessary.

The import for sepolia from viem/chains is correctly added, supporting the new chain property in the TestnetAllowList object.


10-10: LGTM! The addition of the chain property enhances clarity.

The chain property is correctly added to the TestnetAllowList object, providing clearer context regarding the associated blockchain network.

packages/app-contracts/src/dev/auction/testnet-deposit-order.ts (2)

1-1: LGTM! The import for sepolia is correct and necessary.

The import for sepolia from viem/chains is correctly added, supporting the new chain property in the TestnetDepositOrder object.


10-10: LGTM! The addition of the chain property enhances clarity.

The chain property is correctly added to the TestnetDepositOrder object, providing clearer context regarding the associated blockchain network.

apps/indexer/src/lib/utils.ts (2)

3-4: LGTM! Imports are appropriate.

The new imports http, createPublicClient, and eosEvmTestnet are correctly added and align with the changes in the getTokenDetails function.


41-43: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to getTokenDetails match the new client setup.

Verification successful

LGTM! The function getTokenDetails is correctly used in the codebase and matches the new client setup.

  • apps/indexer/src/lib/utils.ts: Function definition with the new client setup.
  • apps/indexer/src/modules/auction/auction-indexer.ts: Correct usage of getTokenDetails.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `getTokenDetails` match the new client setup.

# Test: Search for the function usage. Expect: Only occurrences of the new client setup.
rg --type python -A 5 $'getTokenDetails'

Length of output: 70


Script:

#!/bin/bash
# Description: Verify all function calls to `getTokenDetails` match the new client setup.

# Test: Search for the function usage. Expect: Only occurrences of the new client setup.
rg --type typescript -A 5 'getTokenDetails'

Length of output: 78


Script:

#!/bin/bash
# Description: Verify all function calls to `getTokenDetails` match the new client setup.

# Test: Search for the function usage. Expect: Only occurrences of the new client setup.
rg --type ts -A 5 'getTokenDetails'

Length of output: 1701

packages/app-contracts/src/prod/tokens/usdc.ts (8)

5-17: LGTM! Contract definition for Arbitrum is correct.

The contract for Arbitrum is correctly defined with all required properties.


18-28: LGTM! Contract definition for Avalanche is correct.

The contract for Avalanche is correctly defined with all required properties.


29-40: LGTM! Contract definition for Base is correct.

The contract for Base is correctly defined with all required properties.


41-52: LGTM! Contract definition for Celo is correct.

The contract for Celo is correctly defined with all required properties.


53-64: LGTM! Contract definition for Ethereum is correct.

The contract for Ethereum is correctly defined with all required properties.


65-76: LGTM! Contract definition for Optimism is correct.

The contract for Optimism is correctly defined with all required properties.


77-88: LGTM! Contract definition for Polygon is correct.

The contract for Polygon is correctly defined with all required properties.


89-100: LGTM! Contract definition for ZKsync is correct.

The contract for ZKsync is correctly defined with all required properties.

packages/app-env/src/env.ts (3)

1-1: LGTM! Import statement updated correctly.

The import statement for smartsaleChains has been correctly replaced with appChains.


19-19: LGTM! Configuration updated correctly for prod.

The chains property in the prod configuration is correctly set to appChains.prod.


42-42: LGTM! Configuration updated correctly for dev.

The chains property in the dev configuration is correctly set to appChains.dev.

apps/indexer/src/modules/presale/evm-contributions.ts (2)

7-7: Verify the correctness of the new import.

Ensure that appChains from app-env is the correct replacement for smartsaleChains.

Verification successful

Verify the usage of appChains in evm-contributions.ts.

Ensure that appChains is used correctly and consistently as a replacement for smartsaleChains.


The new import of appChains from app-env is correct and consistent with the rest of the codebase.

  • The appChains constant is defined and exported correctly in packages/app-env/src/chains.ts.
  • The usage of appChains in apps/indexer/src/modules/presale/evm-contributions.ts is appropriate and consistent with its intended purpose.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new import.

# Test: Search for the definition of `appChains` in the codebase.
ast-grep --lang typescript --pattern $'const appChains = $_' 

Length of output: 309


Script:

#!/bin/bash
# Description: Verify the usage of `appChains` in evm-contributions.ts.

# Test: Search for all references to `appChains` in the evm-contributions.ts file.
rg 'appChains' apps/indexer/src/modules/presale/evm-contributions.ts -A 5 -B 5

Length of output: 897


17-17: Verify the correctness of the new chain retrieval logic.

Ensure that appChains.dev.get(token.chainId) is the correct replacement for smartsaleChains.dev.get(token.chainId).

Verification successful

Verified the correctness of the new chain retrieval logic.

The replacement of smartsaleChains.dev.get(token.chainId) with appChains.dev.get(token.chainId) is correct. The appChains object is properly defined and initialized, ensuring the chain retrieval logic is consistent with the rest of the codebase.

  • appChains is defined in packages/app-env/src/chains.ts.
  • appChains.dev is a Map created from prodChains.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new chain retrieval logic.

# Test: Search for the definition of `appChains.dev.get` in the codebase.
ast-grep --lang typescript --pattern $'appChains.dev.get($_)' 

Length of output: 268


Script:

#!/bin/bash
# Description: Search for the definition of `appChains` in the codebase.

# Test: Search for the definition and initialization of `appChains`.
ast-grep --lang typescript --pattern $'const appChains = $_' 

Length of output: 309


Script:

#!/bin/bash
# Description: Search for the definitions of `createMapFromId` and `prodChains` in the codebase.

# Test: Search for the definition and initialization of `createMapFromId`.
ast-grep --lang typescript --pattern $'function createMapFromId($_)' 

# Test: Search for the definition and initialization of `prodChains`.
ast-grep --lang typescript --pattern $'const prodChains = $_' 

Length of output: 132


Script:

#!/bin/bash
# Description: Refined search for the definitions of `createMapFromId` and `prodChains` in the codebase.

# Test: Search for the definition and initialization of `createMapFromId`.
rg 'function createMapFromId' -A 5

# Test: Search for the definition and initialization of `prodChains`.
rg 'const prodChains' -A 5

Length of output: 744

apps/indexer/src/modules/swaps/evm-transfers.ts (3)

1-1: Verify the correctness of the new imports.

Ensure that appContracts from app-contracts and appChains from app-env are the correct replacements.

Verification successful

Verify the usage of the new imports.

Ensure that appContracts from app-contracts and appChains from app-env are used correctly in apps/indexer/src/modules/swaps/evm-transfers.ts.


The new imports are correct and consistent with the rest of the codebase.

  • appContracts from app-contracts is used to access dev.tokens.evm.
  • appChains from app-env is used to get chain information based on chainId.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new imports.

# Test: Search for the definitions of `appContracts` and `appChains` in the codebase.
ast-grep --lang typescript --pattern $'const appContracts = $_'
ast-grep --lang typescript --pattern $'const appChains = $_'

Length of output: 603


Script:

#!/bin/bash
# Description: Verify the usage of the new imports in the file.

# Test: Search for the usage of `appContracts` and `appChains` in the specified file.
rg 'appContracts' apps/indexer/src/modules/swaps/evm-transfers.ts -A 5
rg 'appChains' apps/indexer/src/modules/swaps/evm-transfers.ts -A 5

Length of output: 1153


9-9: Verify the correctness of the new initialization.

Ensure that appContracts.dev.tokens.evm is the correct replacement for the previous token initialization.

Verification successful

The initialization of the tokens variable with appContracts.dev.tokens.evm is correct and consistent with the codebase.

  • The appContracts object includes devContracts, which contains the tokens.evm property.
  • The evmTokens is correctly defined as an array of EVMTokenContractData.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new initialization.

# Test: Search for the definition of `appContracts.dev.tokens.evm` in the codebase.
ast-grep --lang typescript --pattern $'appContracts.dev.tokens.evm'

Length of output: 183


Script:

#!/bin/bash
# Description: Trace the definition and initialization of `appContracts` to verify its structure.

# Search for the definition of `appContracts`
ast-grep --lang typescript --pattern $'const appContracts = $_' -A 10

Length of output: 379


Script:

#!/bin/bash
# Description: Trace the definition and structure of `devContracts` to verify it includes `tokens.evm`.

# Search for the definition of `devContracts`
ast-grep --lang typescript --pattern $'const devContracts = $_' -A 10

Length of output: 470


Script:

#!/bin/bash
# Description: Trace the definition and structure of `evmTokens` to verify it matches `EVMTokenContractData[]`.

# Search for the definition of `evmTokens`
ast-grep --lang typescript --pattern $'const evmTokens = $_' -A 10

Length of output: 67


Script:

#!/bin/bash
# Description: Search for the definition of `evmTokens` across the entire codebase.

# Search for `evmTokens` across the codebase
rg 'evmTokens'

Length of output: 306


17-17: Verify the correctness of the new chain retrieval logic.

Ensure that appChains.dev.get(token.chainId) is the correct replacement for smartsaleChains.dev.get(token.chainId).

Verification successful

Verify the definition and usage of appChains.

Ensure that appChains is correctly defined and has the necessary structure to replace smartsaleChains.


Verify the structure returned by createMapFromId.

Ensure that createMapFromId returns an object with a get method, confirming the validity of appChains.dev.get.


Locate the definition or import of createMapFromId.

Search for the term createMapFromId across the codebase to find its definition or import statement.


Verified the correctness of the new chain retrieval logic.

The appChains.dev.get(token.chainId) is a valid replacement for smartsaleChains.dev.get(token.chainId) as appChains is correctly defined and structured.

  • The appChains object has a dev property created using createMapFromId.
  • The createMapFromId function returns a Map<number, Chain>, ensuring the presence of a get method.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new chain retrieval logic.

# Test: Search for the definition of `appChains.dev.get` in the codebase.
ast-grep --lang typescript --pattern $'appChains.dev.get($_)' 

Length of output: 268


Script:

#!/bin/bash
# Description: Verify the definition and structure of `appChains`.

# Test: Search for the definition of `appChains` in the codebase.
ast-grep --lang typescript --pattern $'const appChains = $_' 

Length of output: 309


Script:

#!/bin/bash
# Description: Verify the structure returned by `createMapFromId`.

# Test: Search for the definition of `createMapFromId` in the codebase.
ast-grep --lang typescript --pattern $'function createMapFromId($_) { $$$ }' 

Length of output: 77


Script:

#!/bin/bash
# Description: Locate the definition or import of `createMapFromId`.

# Test: Search for the term `createMapFromId` across the codebase.
rg 'createMapFromId'

Length of output: 249

apps/webapp/package.json (2)

18-18: Verify the impact of the script removal.

Ensure that the removal of the vercel:install script does not affect the deployment process.

Verification successful

Let's correct the rg command and re-run the script to verify the impact of the vercel:install script removal.


To ensure comprehensive verification, let's search for vercel:install in additional file types, including shell scripts and other relevant configuration files.


Let's correct the rg command to exclude the unrecognized file type yml and re-run the script to verify the impact of the vercel:install script removal.


Verification successful.

The vercel:install script is not used anywhere in the codebase. Its removal does not affect the deployment process.

  • No instances of vercel:install found in JSON, JS, TS, SH, or YAML files.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of the script removal.

# Test: Search for the usage of the `vercel:install` script in the codebase.
rg --type json --type js --type ts --type tsx $'"vercel:install"'

Length of output: 94


Script:

#!/bin/bash
# Description: Verify the impact of the script removal.

# Test: Search for the usage of the `vercel:install` script in the codebase.
rg --type json --type js --type ts $'"vercel:install"'

Length of output: 55


Script:

#!/bin/bash
# Description: Verify the impact of the script removal.

# Test: Search for the usage of the `vercel:install` script in the codebase, including shell scripts and other relevant configuration files.
rg --type json --type js --type ts --type sh --type yaml --type yml $'"vercel:install"'

Length of output: 116


Script:

#!/bin/bash
# Description: Verify the impact of the script removal.

# Test: Search for the usage of the `vercel:install` script in the codebase, including shell scripts and other relevant configuration files.
rg --type json --type js --type ts --type sh --type yaml $'"vercel:install"'

Length of output: 77


43-43: Verify the correctness and compatibility of the new versions and dependencies.

Ensure that the new versions and dependencies are correct and compatible with the rest of the codebase.

Also applies to: 51-51, 54-56, 74-74, 96-96

Verification successful

To verify the correctness and compatibility of the new versions and dependencies, we need to correct the ast-grep patterns and re-run the verification script.


To verify the correctness and compatibility of the new versions and dependencies, we will use rg to search for these dependencies in the codebase.


Verify the correctness and compatibility of the new versions and dependencies.

The rg search results confirm that the new versions and dependencies are correctly defined and used throughout the codebase. The following dependencies were found in multiple files, indicating their proper integration:

  • @rainbow-me/rainbowkit
  • @wagmi/connectors
  • app-contracts
  • app-env
  • app-lib
  • nookies
  • wagmi

These dependencies are imported and used in various TypeScript and JavaScript files, ensuring their compatibility with the codebase.

  • apps/webapp/package.json: Lines 43-43, 51-51, 54-56, 74-74, 96-96
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness and compatibility of the new versions and dependencies.

# Test: Search for the definitions of the new versions and dependencies in the codebase.
ast-grep --lang typescript --pattern $'@rainbow-me/rainbowkit'
ast-grep --lang typescript --pattern $'@wagmi/connectors'
ast-grep --lang typescript --pattern $'app-contracts'
ast-grep --lang typescript --pattern $'app-env'
ast-grep --lang typescript --pattern $'app-lib'
ast-grep --lang typescript --pattern $'nookies'
ast-grep --lang typescript --pattern $'wagmi'

Length of output: 802


Script:

#!/bin/bash
# Description: Verify the correctness and compatibility of the new versions and dependencies.

# Corrected patterns for searching the definitions of the new versions and dependencies in the codebase.
ast-grep --lang typescript --pattern '@rainbow-me/rainbowkit'
ast-grep --lang typescript --pattern '@wagmi/connectors'
ast-grep --lang typescript --pattern 'app-contracts'
ast-grep --lang typescript --pattern 'app-env'
ast-grep --lang typescript --pattern 'app-lib'
ast-grep --lang typescript --pattern 'nookies'
ast-grep --lang typescript --pattern 'wagmi'

Length of output: 802


Script:

#!/bin/bash
# Description: Verify the correctness and compatibility of the new versions and dependencies using ripgrep.

# Search for the definitions of the new versions and dependencies in the codebase.
rg '@rainbow-me/rainbowkit'
rg '@wagmi/connectors'
rg 'app-contracts'
rg 'app-env'
rg 'app-lib'
rg 'nookies'
rg 'wagmi'

Length of output: 11801

packages/app-contracts/src/prod/tokens/usdt.ts (14)

Line range hint 5-16:
LGTM!

The contract object for Ethereum Mainnet is correctly structured and the chain property is appropriately assigned.


Line range hint 17-28:
LGTM!

The contract object for Arbitrum Mainnet is correctly structured and the chain property is appropriately assigned.


Line range hint 29-40:
LGTM!

The contract object for Avalanche Mainnet is correctly structured and the chain property is appropriately assigned.


Line range hint 41-52:
LGTM!

The contract object for Binance Smart Chain Mainnet is correctly structured and the chain property is appropriately assigned.


Line range hint 53-64:
LGTM!

The contract object for Fantom Mainnet is correctly structured and the chain property is appropriately assigned.


Line range hint 65-76:
LGTM!

The contract object for Polygon Mainnet is correctly structured and the chain property is appropriately assigned.


Line range hint 77-88:
LGTM!

The contract object for Optimism Mainnet is correctly structured and the chain property is appropriately assigned.


Line range hint 89-100:
LGTM!

The contract object for Harmony Mainnet is correctly structured and the chain property is appropriately assigned.


Line range hint 101-112:
LGTM!

The contract object for Moonbeam Mainnet is correctly structured and the chain property is appropriately assigned.


Line range hint 113-124:
LGTM!

The contract object for Cronos Mainnet is correctly structured and the chain property is appropriately assigned.


Line range hint 125-136:
LGTM!

The contract object for Kava Mainnet is correctly structured and the chain property is appropriately assigned.


Line range hint 137-148:
LGTM!

The contract object for Metis Mainnet is correctly structured and the chain property is appropriately assigned.


Line range hint 149-160:
LGTM!

The contract object for Gnosis Mainnet is correctly structured and the chain property is appropriately assigned.


Line range hint 161-172:
LGTM!

The contract object for Aurora Mainnet is correctly structured and the chain property is appropriately assigned.

apps/indexer/src/modules/auction/auction-indexer.ts (2)

1-9: LGTM!

The import statements are correctly updated to include http and createPublicClient from the viem library.


17-21: LGTM! But verify the client usage in the codebase.

The client initialization is correctly implemented and integrated into the startAuctionIndexer function.

However, ensure that the client is correctly used throughout the function.

Verification successful

The client usage is correctly implemented in the startAuctionIndexer function.

The client is used to fetch the block number, retrieve logs, and watch events, which are appropriate operations for a blockchain client.

  • client.getBlockNumber()
  • client.getLogs()
  • client.watchEvent()
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the client in the `startAuctionIndexer` function.

# Test: Search for the client usage. Expect: Correct usage of the client.
rg --type javascript -A 5 $'client'

Length of output: 69


Script:

#!/bin/bash
# Description: Verify the usage of the client in the `startAuctionIndexer` function.

# Find the file containing the `startAuctionIndexer` function
file_path=$(fd auction-indexer.ts)

# Search for the client usage within the file
rg 'client' -A 5 "$file_path"

Length of output: 1033

packages/app-contracts/src/dev/tokens/sepolia-usdt.ts (2)

1-2: LGTM!

The import path for EVMTokenContractData is correctly updated to reflect the new directory structure.


13-13: LGTM!

The SepoliaUSDT constant is correctly updated with the new chain property set to the sepolia object.

packages/app-contracts/src/dev/tokens/testnet-usdt.ts (2)

1-2: LGTM! Import changes improve modularity.

The updated import path and the addition of eosEvmTestnet enhance modularity and correctly reference the necessary chain configuration.


13-13: LGTM! Addition of chain property enhances clarity.

The new chain property in the TestnetUSDT object improves the clarity and functionality of the data structure by providing more context about the blockchain environment.

packages/app-contracts/src/dev/tokens/testnet-mbots-prelaunch.ts (2)

1-2: LGTM! Import changes improve modularity.

The updated import path and the addition of eosEvmTestnet enhance modularity and correctly reference the necessary chain configuration.


13-13: LGTM! Addition of chain property enhances clarity.

The new chain property in the TestnetMBOTSPL object improves the clarity and functionality of the data structure by providing more context about the blockchain environment.

packages/app-contracts/src/dev/tokens/testnet-usd-cred.ts (2)

1-2: LGTM! Import changes improve modularity.

The updated import path and the addition of eosEvmTestnet enhance modularity and correctly reference the necessary chain configuration.


13-13: LGTM! Addition of chain property enhances clarity.

The new chain property in the TestnetUSDCred object improves the clarity and functionality of the data structure by providing more context about the blockchain environment.

packages/app-contracts/src/dev/auction/testnet-easy-auction.ts (3)

1-1: Import statement for sepolia looks good.

The import path appears to be correct and necessary for the new chain property.


10-10: Addition of chain property looks good.

The chain property enhances the configuration by explicitly associating the auction with the Sepolia test network.


2-2: Verify the updated import path for EVMContractData.

Ensure that the new path ../../types correctly reflects the reorganization of the directory structure.

Verification successful

The updated import path for EVMContractData is correct.

The file packages/app-contracts/src/types.ts contains the definition of EVMContractData, and the import path ../../types correctly points to it.

  • packages/app-contracts/src/types.ts: export interface EVMContractData extends ContractData {}
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new import path for `EVMContractData`.

# Test: Check if the file exists at the new path. Expect: The file should exist.
fd 'EVMContractData.ts' --search-path 'packages/app-contracts/src/types'

Length of output: 190


Script:

#!/bin/bash
# Description: Locate the correct path for `EVMContractData.ts` in the repository.

fd 'EVMContractData.ts'

Length of output: 23


Script:

#!/bin/bash
# Description: Search for the term `EVMContractData` within the repository to find its definition or references.

rg 'EVMContractData'

Length of output: 898

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d6f3e88 and 110df55.

Files ignored due to path filters (1)
  • bun.lockb is excluded by !**/bun.lockb
Files selected for processing (1)
  • apps/webapp/package.json (5 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/webapp/package.json

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.

1 participant