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

chore: Add base mainnet addresses for go live #373

Merged
merged 15 commits into from
Oct 7, 2024

Conversation

CryptoFewka
Copy link
Contributor

@CryptoFewka CryptoFewka commented Oct 3, 2024

Summary by CodeRabbit

  • New Features

    • Added support for the base_mainnet blockchain network, enhancing the existing network configurations.
    • Updated representation of Zeta Protocol's main networks to include base_mainnet.
    • Introduced new constants for the base_mainnet network within the SALT_NUMBERS configuration.
  • Dependencies

    • Updated the hardhat package to a newer version.
    • Added a new dependency for chokidar.

Copy link
Contributor

coderabbitai bot commented Oct 3, 2024

Warning

Rate limit exceeded

@CryptoFewka has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 13 minutes and 14 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Files that changed from the base of the PR and between 15ff4de and c434152.

📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes introduced in this pull request consist of adding a new blockchain network configuration for base_mainnet in the Hardhat configuration file, updating related types and constants for the Zeta Protocol, and modifying the package.json to update dependencies. Specifically, the base_mainnet configuration includes its chainId, API, and browser URLs. Additionally, the zetaProtocolMainNetworks type and SALT_NUMBERS constants have been updated to include base_mainnet. The hardhat dependency has been upgraded, and a new dependency, chokidar, has been added.

Changes

File Change Summary
v1/hardhat.config.ts Added custom chain configuration for base_mainnet with chainId, API URL, and browser URL.
v1/lib/address.tools.ts Updated ZetaProtocolMainNetwork type and zetaProtocolMainNetworks constant to include base_mainnet.
v1/lib/contracts.constants.ts Added new base_mainnet entry to SALT_NUMBERS with initialized properties.
v1/package.json Updated hardhat version from ^2.17.2 to ^2.22.12 and added chokidar dependency with version ^4.0.1.

Possibly related PRs

  • feat: contract addresses #348: The addition of the base_mainnet configuration in the main PR aligns with the broader context of managing blockchain addresses across multiple networks, including the new custom chain configuration introduced in the main PR.

Suggested reviewers

  • lumtis
  • CharlieMc0
  • brewmaster012
  • andresaiello
  • fbac

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

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai 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.

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.

@CryptoFewka CryptoFewka changed the title Add base mainnet addresses Chore: Add base mainnet addresses for go live Oct 3, 2024
@CryptoFewka CryptoFewka changed the title Chore: Add base mainnet addresses for go live chore: Add base mainnet addresses for go live Oct 3, 2024
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

🧹 Outside diff range and nitpick comments (2)
v1/hardhat.config.ts (1)

50-57: LGTM! Consider adding API key and explanatory comment.

The addition of the Base Mainnet configuration looks good and is consistent with other custom chain configurations. The chain ID and URLs are correct for Base Mainnet.

To further improve this change:

  1. Consider adding an API key entry for base_mainnet in the apiKey section above, similar to other networks.
  2. It might be helpful to add a comment explaining the purpose of this addition, e.g., "// Base Mainnet configuration".

Here's a suggested modification:

 etherscan: {
   apiKey: {
     amoy_testnet: process.env.POLYGONSCAN_API_KEY || "",
     base_testnet: process.env.BASESCAN_API_KEY || "",
+    base_mainnet: process.env.BASESCAN_API_KEY || "",
     // BSC
     bsc: process.env.BSCSCAN_API_KEY || "",
     // ... (other configurations)
   },
   customChains: [
     // ... (other custom chains)
+    // Base Mainnet configuration
     {
       chainId: 8453,
       network: "base_mainnet",
       urls: {
         apiURL: "https://api.basescan.org/api",
         browserURL: "https://basescan.org/",
       },
     },
   ],
 },
v1/package.json (1)

92-92: Consider a patch version bump.

Given the updates to dependencies, particularly the hardhat version, it might be appropriate to increment the patch version of this package (e.g., from 0.0.8 to 0.0.9). This would signal to users that there have been minor updates or bug fixes.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between a80faa8 and 4bd145e.

⛔ Files ignored due to path filters (2)
  • v1/data/addresses.json is excluded by !v1/data/**
  • v1/data/addresses.mainnet.json is excluded by !v1/data/**
📒 Files selected for processing (4)
  • v1/hardhat.config.ts (1 hunks)
  • v1/lib/address.tools.ts (1 hunks)
  • v1/lib/contracts.constants.ts (1 hunks)
  • v1/package.json (2 hunks)
🔇 Additional comments (6)
v1/lib/contracts.constants.ts (1)

15-20: Verify salt numbers for Base Mainnet

The addition of the base_mainnet entry is good and follows the existing structure. However, there are a few points to consider:

  1. All salt numbers are currently set to "0". Is this intentional, or are these placeholders?
  2. Remember the comment above SALT_NUMBERS: "dev: this values should be calculated using get-salt script". Have you run this script for the Base Mainnet values?
  3. Using "0" for all contracts might lead to conflicts if these values are used for unique identification.

Please verify if "0" is the correct value for all contracts on Base Mainnet. If these are placeholders, update them with the correct values calculated using the get-salt script.

To help verify the uniqueness of salt numbers across networks, you can run the following script:

This script will help identify any potential issues with salt number uniqueness and the frequency of "0" values.

v1/lib/address.tools.ts (3)

70-70: LGTM: Addition of "base_mainnet" to ZetaProtocolMainNetwork type

The addition of "base_mainnet" to the ZetaProtocolMainNetwork type is correct and aligns with the PR objective of adding base mainnet addresses. This change is consistent with the existing type declaration format and doesn't introduce any issues.


70-70: Summary: Successfully added base mainnet support

The changes to add "base_mainnet" to both the ZetaProtocolMainNetwork type and the zetaProtocolMainNetworks array are correct and consistent. These additions successfully implement the PR objective of adding base mainnet addresses to the Zeta Protocol.

Key points:

  1. The type declaration is updated to include "base_mainnet".
  2. The constant array is updated to reflect the new type.
  3. Alphabetical order is maintained in the array, preserving readability and consistency.

These changes enhance the protocol's support for different networks without introducing any apparent issues or inconsistencies in the existing code structure.

Also applies to: 78-78


78-78: LGTM: Addition of "base_mainnet" to zetaProtocolMainNetworks array

The addition of "base_mainnet" to the zetaProtocolMainNetworks array is correct and consistent with the updated type declaration. The alphabetical order is maintained, which is good for readability and consistency.

To ensure that this change is properly reflected throughout the codebase, let's verify its usage:

✅ Verification successful

LGTM: Addition of "base_mainnet" to zetaProtocolMainNetworks array

The addition of "base_mainnet" to the zetaProtocolMainNetworks array has been successfully verified. All references to zetaProtocolMainNetworks are appropriately updated, and no hardcoded main network lists were found that require modification.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the updated zetaProtocolMainNetworks constant

# Test: Search for references to zetaProtocolMainNetworks
echo "Searching for references to zetaProtocolMainNetworks:"
rg --type typescript "zetaProtocolMainNetworks"

# Test: Search for any hardcoded lists of main networks that might need updating
echo "Searching for potential hardcoded lists of main networks:"
rg --type typescript -e "bsc_mainnet.*eth_mainnet.*polygon_mainnet"

Length of output: 429


Script:

#!/bin/bash
# Description: Verify the usage of the updated zetaProtocolMainNetworks constant

# Test: Search for references to zetaProtocolMainNetworks in TypeScript files
echo "Searching for references to zetaProtocolMainNetworks in .ts and .tsx files:"
rg "zetaProtocolMainNetworks" --glob "**/*.ts" --glob "**/*.tsx"

# Test: Search for any hardcoded lists of main networks that might need updating in TypeScript files
echo "Searching for potential hardcoded lists of main networks in .ts and .tsx files:"
rg -e "bsc_mainnet.*eth_mainnet.*polygon_mainnet" --glob "**/*.ts" --glob "**/*.tsx"

Length of output: 821

v1/package.json (2)

93-95: Approve chokidar addition, but clarify its intended use.

The addition of chokidar (a file watching library) suggests new functionality related to file system monitoring. This could be beneficial for development workflows or build processes.

Could you please provide more context on why chokidar was added and where it's being used in the project? This will help ensure it's being used appropriately and efficiently.

To help verify its usage, you can run the following script:

#!/bin/bash
# Description: Check for chokidar usage in the project

# Test: Search for chokidar imports or requires
rg --type typescript --type javascript 'require\(["\']chokidar["\']\)|import .* from ["\']chokidar["\'']'

# Test: Look for potential file watching setup
rg --type typescript --type javascript 'watch\(|watchFile\('

50-50: Hardhat version update looks good, but verify compatibility.

The update of hardhat from "^2.17.2" to "^2.22.12" is a good practice to keep dependencies current. However, it's important to ensure this update doesn't introduce any breaking changes or conflicts with other dependencies.

Please run the following script to check for any potential conflicts or issues:

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

🧹 Outside diff range and nitpick comments (1)
v1/hardhat.config.ts (1)

24-24: LGTM with a minor suggestion.

The addition of the Base Mainnet API key is correct and follows the existing pattern. Using an environment variable for the API key is a good security practice.

Consider reordering the keys alphabetically to maintain consistency and improve readability:

 apiKey: {
   amoy_testnet: process.env.POLYGONSCAN_API_KEY || "",
+  base_mainnet: process.env.BASESCAN_API_KEY || "",
   base_testnet: process.env.BASESCAN_API_KEY || "",
-  base_mainnet: process.env.BASESCAN_API_KEY || "",
   // BSC
   bsc: process.env.BSCSCAN_API_KEY || "",
🧰 Tools
🪛 GitHub Check: lint

[failure] 24-24:
Expected object keys to be in ascending order. 'base_mainnet' should be before 'base_testnet'

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4bd145e and 15ff4de.

📒 Files selected for processing (1)
  • v1/hardhat.config.ts (2 hunks)
🧰 Additional context used
🪛 GitHub Check: lint
v1/hardhat.config.ts

[failure] 24-24:
Expected object keys to be in ascending order. 'base_mainnet' should be before 'base_testnet'

🔇 Additional comments (1)
v1/hardhat.config.ts (1)

Line range hint 1-95: Overall, the changes look good.

The additions for Base Mainnet in the Hardhat configuration file are correct and consistent with the existing patterns. The use of environment variables for API keys is a good security practice. A minor suggestion was made to improve key ordering, and a verification step was recommended to ensure the accuracy of the Base Mainnet details.

v1/hardhat.config.ts Outdated Show resolved Hide resolved
@lumtis
Copy link
Member

lumtis commented Oct 7, 2024

Looks good to me. The CI failure is not related to the change. I will merge now.

@fadeev do we still need the v1 generate to pass?

@lumtis lumtis merged commit 874f1cc into main Oct 7, 2024
8 of 9 checks passed
@lumtis lumtis deleted the add-base-mainnet-addresses branch October 7, 2024 11:15
@fadeev
Copy link
Member

fadeev commented Oct 7, 2024

Looks good to me. The CI failure is not related to the change. I will merge now.

@fadeev do we still need the v1 generate to pass?

I guess not.

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.

4 participants