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 data for Base mainnet go live (part one) #372

Merged
merged 11 commits into from
Oct 3, 2024

Conversation

CryptoFewka
Copy link
Contributor

@CryptoFewka CryptoFewka commented Oct 3, 2024

Description

This PR contains the settings and files needed to deploy a v1 contract stack for the first time on an EVM chain.

New Features

  • Added support for the Base mainnet in the Zeta Protocol, enhancing network flexibility.
  • Introduced new constants for Base mainnet configurations in the SALT_NUMBERS object.

Summary by CodeRabbit

  • New Features

    • Added support for the "base_mainnet" network in Hardhat configuration for verification purposes.
    • Expanded the Zeta Protocol to recognize "base_mainnet" as a valid main network.
    • Introduced new network entry in SALT_NUMBERS for "base_mainnet" with essential properties.
  • Chores

    • Updated Hardhat dependency version and added new package dependency for improved functionality.

Copy link
Contributor

coderabbitai bot commented Oct 3, 2024

📝 Walkthrough

Walkthrough

The pull request introduces several updates to the Hardhat configuration and related files to support the "base_mainnet" network. Key changes include the addition of a custom chain configuration in hardhat.config.ts, updates to the ZetaProtocolMainNetwork type and constants in address.tools.ts, and the inclusion of a new entry for base_mainnet in the SALT_NUMBERS object in contracts.constants.ts. Additionally, the package.json file has been modified to update the hardhat dependency version and add a new dependency for chokidar.

Changes

File Change Summary
v1/hardhat.config.ts Added custom chain configuration for "base_mainnet" with Chain ID 8453 and relevant API/Browser URLs.
v1/lib/address.tools.ts Updated ZetaProtocolMainNetwork type and zetaProtocolMainNetworks constant to include "base_mainnet".
v1/lib/contracts.constants.ts Added new entry for base_mainnet in SALT_NUMBERS with properties initialized to "0".
v1/package.json Updated hardhat dependency from ^2.17.2 to ^2.22.12 and added chokidar dependency ^4.0.1.

Possibly related PRs

  • feat: contract addresses #348: The main PR introduces a new network configuration for "base_mainnet," while the retrieved PR includes a comprehensive list of blockchain addresses that may involve the "base_mainnet" network, indicating a potential connection in terms of network management and address handling.

Suggested reviewers

  • lumtis
  • CharlieMc0
  • brewmaster012
  • andresaiello

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 Setup Base mainnet chore: add data for Base mainnet go live Oct 3, 2024
@CryptoFewka CryptoFewka self-assigned this Oct 3, 2024
@CryptoFewka CryptoFewka marked this pull request as ready for review October 3, 2024 15:56
@CryptoFewka
Copy link
Contributor Author

This has been deployed, and produced the following output:

Deploying ZetaToken to base_mainnet
Deployed ZetaToken. Address: 0x7FB8E2aE4A5923BBd8e1513945914b5AB69cdA2a
Constructor Args [
  '0x70e967acFcC17c3941E87562161406d41676FD83',
  '0x4Ed087B3aB502475c97cF9d3f1637eFd2470B8FE'
]
ETH spent: 1936030540237249
Deploying ZetaConnector to base_mainnet
Deployed ZetaConnector. Address: 0xfc6a3d4D373B522B182E8caDd66ECF140a313E2F
Constructor Args [
  '0x7FB8E2aE4A5923BBd8e1513945914b5AB69cdA2a',
  '0x70e967acFcC17c3941E87562161406d41676FD83',
  '0x4Ed087B3aB502475c97cF9d3f1637eFd2470B8FE',
  '0x4Ed087B3aB502475c97cF9d3f1637eFd2470B8FE'
]
ETH spent: 1908746747218699
Deploying ERC20Custody to base_mainnet
Deployed ERC20Custody. Address: 0x53b0705194e686Ba745eF8A80cB1Ef355dE645D0
Constructor Args [
  '0x70e967acFcC17c3941E87562161406d41676FD83',
  '0x4Ed087B3aB502475c97cF9d3f1637eFd2470B8FE',
  '0',
  '1000000000000000000000',
  '0x7FB8E2aE4A5923BBd8e1513945914b5AB69cdA2a'
]
ETH spent: 1832976446002511

@CryptoFewka CryptoFewka changed the title chore: add data for Base mainnet go live chore: add data for Base mainnet go live (part one) 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 (4)
v1/hardhat.config.ts (2)

50-57: LGTM! Consider adding an API key for Base mainnet.

The addition of the Base mainnet configuration to the customChains array is correct and aligns with the PR objectives. The chainId, network name, and URLs are accurate for Base mainnet.

Consider adding an API key for Base mainnet in the apiKey object above, similar to other networks. This would ensure that the verification process works smoothly for Base mainnet as well. You can add it like this:

apiKey: {
  // ... existing keys
  base_mainnet: process.env.BASESCAN_API_KEY || "",
}

Don't forget to add the corresponding environment variable in your .env file and deployment process.


50-57: Summary: Base mainnet support successfully added

The changes in this file successfully add support for Base mainnet to the Hardhat configuration. This addition enhances the protocol's flexibility by allowing it to interact with and verify contracts on the Base mainnet.

As the project continues to expand support for various networks, consider implementing a more scalable approach to manage network configurations. This could involve:

  1. Creating a separate configuration file for network details.
  2. Implementing a function to dynamically load network configurations.
  3. Using environment variables or a configuration management system for easier deployment across different environments.

These steps would make it easier to add or modify network support in the future without cluttering the main Hardhat configuration file.

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

78-78: LGTM: Addition of Base mainnet to zetaProtocolMainNetworks array

The addition of "base_mainnet" to the zetaProtocolMainNetworks array is consistent with the type declaration change and ensures that all ZetaProtocolMainNetwork values are included.

Consider ordering the array elements alphabetically for better maintainability and consistency. Here's a suggested revision:

export const zetaProtocolMainNetworks: ZetaProtocolMainNetwork[] = [
  "base_mainnet",
  "bsc_mainnet",
  "btc_mainnet",
  "eth_mainnet",
  "polygon_mainnet",
  "zeta_mainnet",
];

This alphabetical ordering would make it easier to locate specific networks and maintain the list as it grows.

v1/package.json (1)

92-92: Formatting change approved. Consider project-wide consistency.

The addition of a trailing comma in the version field is a minor syntactical change that improves consistency with modern JSON styling practices.

To ensure consistency across the project, consider running a JSON formatter on all configuration files. You can use a tool like Prettier with the following command:

npx prettier --write "**/*.json"

This will help maintain a consistent style across all JSON files in the project.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between a80faa8 and 1a3256a.

⛔ 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 (5)
v1/lib/contracts.constants.ts (1)

15-20: Verify the salt values for base_mainnet

The addition of base_mainnet to SALT_NUMBERS aligns with the PR objective of adding support for Base mainnet. However, there are a few points to consider:

  1. All values for base_mainnet are set to "0". Is this intentional for the initial setup?
  2. The comment above SALT_NUMBERS mentions that values should be calculated using a get-salt script. Has this script been run for base_mainnet?
  3. Other mainnet entries (e.g., eth_mainnet, bsc_mainnet) have non-zero values. Should base_mainnet follow a similar pattern?

If setting all values to "0" is intentional, consider adding a comment explaining why. Otherwise, please verify if the get-salt script should be run to generate appropriate values.

To check if there's any existing usage of non-zero values for Base mainnet, you can run:

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

Line range hint 1-108: Summary: Changes successfully implement Base mainnet support

The changes in this file successfully add support for the Base mainnet to the Zeta Protocol. The implementation is consistent with the existing code structure and achieves the PR objectives.

Key points:

  1. ZetaProtocolMainNetwork type now includes "base_mainnet".
  2. zetaProtocolMainNetworks array has been updated accordingly.

These changes enhance the protocol's flexibility and network support as intended. The code is well-structured and maintains consistency with the existing implementation.


70-70: LGTM: Addition of Base mainnet to ZetaProtocolMainNetwork type

The addition of "base_mainnet" to the ZetaProtocolMainNetwork type is consistent with the PR objective and follows the existing structure. This change enhances the protocol's flexibility by supporting the Base mainnet.

To ensure consistency across the codebase, please run the following script:

This script will help identify any areas that might need updates due to this change.

✅ Verification successful

Verified: Addition of Base mainnet to ZetaProtocolMainNetwork type

The addition of "base_mainnet" to the ZetaProtocolMainNetwork type has been successfully verified. All usages across the codebase are consistent and align with the PR objectives, ensuring enhanced support for the Base mainnet without introducing any conflicts.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of ZetaProtocolMainNetwork type and "base_mainnet" string

# Test 1: Search for ZetaProtocolMainNetwork type usage
echo "Searching for ZetaProtocolMainNetwork type usage:"
rg --type typescript "ZetaProtocolMainNetwork"

# Test 2: Search for "base_mainnet" string usage
echo "Searching for \"base_mainnet\" string usage:"
rg --type typescript "base_mainnet"

Length of output: 356


Script:

#!/bin/bash
# Description: Verify the usage of ZetaProtocolMainNetwork type and "base_mainnet" string in TypeScript files

# Test 1: Search for ZetaProtocolMainNetwork type usage in .ts and .tsx files
echo "Searching for ZetaProtocolMainNetwork type usage in TypeScript files:"
rg "ZetaProtocolMainNetwork" -g "*.ts" -g "*.tsx"

# Test 2: Search for "base_mainnet" string usage in .ts and .tsx files
echo "Searching for \"base_mainnet\" string usage in TypeScript files:"
rg "base_mainnet" -g "*.ts" -g "*.tsx"

Length of output: 943

v1/package.json (2)

93-95: ⚠️ Potential issue

Consider moving chokidar to devDependencies.

The addition of chokidar, a file watching library, as a production dependency is unusual. Typically, file watching is a development-time concern rather than a runtime requirement for a smart contract project.

Please clarify the intended use of chokidar in production. If it's only needed for development tasks, consider moving it to the devDependencies section:

-  "dependencies": {
-    "chokidar": "^4.0.1"
-  }
   "devDependencies": {
+    "chokidar": "^4.0.1",
     // ... other dev dependencies
   }

To verify the usage of chokidar in the project, run the following script:

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

echo "Searching for chokidar usage in the project:"
rg --type js --type ts 'require\(["\']chokidar["\']|from\s+["\']chokidar["\']'

If chokidar is only used in development scripts or tools, it should be moved to devDependencies.


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

The update from Hardhat 2.17.2 to 2.22.12 is a significant version jump. While this update is likely to bring improvements and bug fixes, it's important to ensure it doesn't introduce any breaking changes to your build process or scripts.

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

@CryptoFewka CryptoFewka merged commit 8d665c0 into main Oct 3, 2024
11 of 13 checks passed
@CryptoFewka CryptoFewka deleted the add-base-mainnet branch October 3, 2024 16:33
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.

3 participants