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: update polygon and base contract addresses #330

Merged
merged 2 commits into from
Sep 5, 2024

Conversation

fadeev
Copy link
Member

@fadeev fadeev commented Aug 15, 2024

  • workaround for base_sepolia and base_testnet
  • generated addresses for all contracts and tokens
  • fixed decimals for ERC-20 tokens

Summary by CodeRabbit

  • New Features

    • Introduced a new section for the "base_testnet" with enhanced asset configurations, including multiple key connectors and token addresses.
    • Added USDT and USDC entries for better support of omnichain assets on the ZetaChain.
    • Introduced new asset entries for various categories within "base_sepolia" and "zeta_testnet."
  • Bug Fixes

    • Restructured asset definitions for "base_testnet" and other environments to ensure accurate data retrieval and configuration.
  • Documentation

    • Updated type declarations for better clarity and safety, enhancing the overall understanding of supported tokens and blockchain networks.

Copy link
Contributor

coderabbitai bot commented Aug 15, 2024

Walkthrough

Walkthrough

The recent updates enhance the JSON configuration files and TypeScript type definitions for the ZetaChain network and blockchain asset management. New sections have been added for testnet and mainnet assets, optimizing their organization and specificity. Type definitions have been expanded for better coverage of blockchain parameters, ensuring clearer system interactions. Additionally, logic adjustments in the tasks file ensure that the correct endpoint is utilized for the base_sepolia chain, improving overall functionality.

Changes

File(s) Summary of Changes
v1/data/addresses.json Added a new section for base_testnet under ccm with specific connectors and token addresses, restructuring previous entries.
v1/data/addresses.mainnet.json Updated decimals for USDC and USDT (from 18 to 6) and added new entries for USDT and USDC on POL, enhancing asset information for the ZetaChain network.
v1/data/addresses.testnet.json Introduced multiple new entries for assets under base_sepolia and ZetaChain, including connectors and messaging assets. Removed outdated entries from previous configurations.
v1/lib/types.ts Refined type declarations for ParamSymbol, ParamChainName, and ParamType to enhance specificity and coverage of blockchain parameters.
v1/tasks/addresses.ts Adjusted logic to correctly set RPC endpoint URLs for the base_sepolia chain, ensuring appropriate testnet endpoint usage in specific asynchronous functions.

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

@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.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7baf222 and be2a6e0.

Files selected for processing (5)
  • v1/data/addresses.json (2 hunks)
  • v1/data/addresses.mainnet.json (1 hunks)
  • v1/data/addresses.testnet.json (3 hunks)
  • v1/lib/types.ts (1 hunks)
  • v1/tasks/addresses.ts (2 hunks)
Additional context used
Gitleaks
v1/data/addresses.json

9-9: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

Additional comments not posted (16)
v1/lib/types.ts (3)

1-1: Enhance type safety with comprehensive symbols.

The expanded ParamSymbol type now covers a broader range of tokens, which enhances type safety and flexibility. Ensure all usages of ParamSymbol are updated to accommodate these new values.


2-2: Improved specificity in chain names.

The ParamChainName type now includes additional blockchain networks, providing more precise context for operations. Verify that these changes are correctly reflected in the rest of the codebase.


3-3: Expanded operational roles for ParamType.

The ParamType type now includes additional operational roles, which should improve clarity and alignment with system functionality. Ensure these roles are correctly used throughout the codebase.

v1/data/addresses.json (2)

3-11: Verify the new base_testnet configuration.

The new base_testnet section provides detailed configuration for various components. Ensure these addresses are correct and intended for public use.

Tools
Gitleaks

9-9: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


9-9: Potential exposure of sensitive information.

Line 9 may contain a generic API key or sensitive information. Double-check that this address is safe to include in the public configuration.

Tools
Gitleaks

9-9: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

v1/data/addresses.mainnet.json (2)

348-360: New entry for USDT on POL added.

The addition of USDT on POL expands the dataset for omnichain assets. Ensure this entry is accurate and consistent with other entries.


361-373: New entry for USDC on POL added.

The addition of USDC on POL enhances the dataset for omnichain assets. Verify the accuracy and consistency of this entry with other similar entries.

v1/data/addresses.testnet.json (7)

174-186: New asset entry is consistent and correctly formatted.

The entry for the ZRC20 asset on the ZetaChain testnet is properly structured and includes all necessary details.


327-333: New asset entry is consistent and correctly formatted.

The entry for the connector asset on the base_sepolia chain is properly structured and includes all necessary details.


334-340: New asset entry is consistent and correctly formatted.

The entry for the erc20Custody asset on the base_sepolia chain is properly structured and includes all necessary details.


341-347: New asset entry is consistent and correctly formatted.

The entry for the pauser asset on the base_sepolia chain is properly structured and includes all necessary details.


348-354: New asset entry is consistent and correctly formatted.

The entry for the tss asset on the base_sepolia chain is properly structured and includes all necessary details.


355-361: New asset entry is consistent and correctly formatted.

The entry for the tssUpdater asset on the base_sepolia chain is properly structured and includes all necessary details.


362-368: New asset entry is consistent and correctly formatted.

The entry for the zetaToken asset on the base_sepolia chain is properly structured and includes all necessary details.

v1/tasks/addresses.ts (2)

210-211: Correct endpoint logic for base_sepolia.

The conditional logic correctly maps "base_sepolia" to "base_testnet" to ensure the correct endpoint is used.


236-237: Correct endpoint logic for base_sepolia.

The conditional logic correctly maps "base_sepolia" to "base_testnet" to ensure the correct endpoint is used.

@fadeev fadeev changed the title chore: udpate polygon and base contract addresses chore: update polygon and base contract addresses Aug 15, 2024
| "USDT.BSC"
| "USDT.ETH";

export type ParamChainName = ZetaProtocolNetwork;
Copy link
Member

Choose a reason for hiding this comment

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

Can we update ZetaProtocolNetwork directly and leave this 1:1 type? We are using this on Hub. Also this already includes base_testnet if this is the only change for this type.

Screenshot 2024-08-15 at 15 57 20

Copy link
Member Author

Choose a reason for hiding this comment

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

On chain it's stored as base_sepolia, in the networks package it's base_testnet. I don't expect we change what's on chain, so I propose we change what's in the networks.

https://github.com/zeta-chain/networks/blob/cff04701454b30f401d4b3a12e2ff5ba840c8766/data/networks.json#L57

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I see, is it too much effort to rename all base_testnet instances in favor of base_sepolia in both repositories? I think we should have only one, and agree we should match what's already on chain

Copy link
Member Author

Choose a reason for hiding this comment

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

PR to update the networks package to "base_sepolia" is above.

This PR updates the types in this repo to "base_sepolia". No effort at all.

Copy link
Member

@Mfigueira Mfigueira Aug 15, 2024

Choose a reason for hiding this comment

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

Amazing! Hadn't seen the comment above with the other PR due to a github sync delay.

My original suggestion still applies with a further update then. We should keep ParamChainName = ZetaProtocolNetwork and update base_testnet to base_sepolia in address.tools.ts.

Copy link
Member Author

Choose a reason for hiding this comment

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

types.ts is generated automatically from the addresses JSON. address.tools.ts is a legacy types file maintained manually. Consider switching to types.ts as it ensures that types actually reflect the values that are in the addresses JSON. Let me know if something's missing from types.ts.

Copy link
Member

Choose a reason for hiding this comment

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

That makes sense. We can definitively switch to use that types.ts file directly. Do you think we can remove the address.tools.ts to avoid duplication?

Copy link
Member

@Mfigueira Mfigueira Aug 16, 2024

Choose a reason for hiding this comment

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

I'm taking a look and seems some constants from address.tools.ts are being used in other places from this repo. Maybe we can make a new issue/PR to refactor this separately.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think anyone's going to be refactoring v1 contracts as they're all being replaced by v2.

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.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between be2a6e0 and efa0751.

Files selected for processing (3)
  • v1/data/addresses.mainnet.json (4 hunks)
  • v1/data/addresses.testnet.json (8 hunks)
  • v1/tasks/addresses.ts (3 hunks)
Files skipped from review as they are similar to previous changes (2)
  • v1/data/addresses.mainnet.json
  • v1/tasks/addresses.ts
Additional comments not posted (7)
v1/data/addresses.testnet.json (7)

174-186: Entry for zeta_testnet is well-structured.

The new ZRC20 asset entry for zeta_testnet is correctly formatted and includes all necessary fields.


327-333: Entry for base_sepolia connector is correctly formatted.

The new connector asset entry for base_sepolia is well-structured and includes all required fields.


334-340: Entry for base_sepolia ERC20 custody is well-structured.

The new ERC20 custody asset entry for base_sepolia is correctly formatted and includes all required fields.


341-347: Entry for base_sepolia pauser is correctly formatted.

The new pauser asset entry for base_sepolia is well-structured and includes all required fields.


348-354: Entry for base_sepolia TSS is well-structured.

The new TSS asset entry for base_sepolia is correctly formatted and includes all required fields.


355-361: Entry for base_sepolia TSS updater is correctly formatted.

The new TSS updater asset entry for base_sepolia is well-structured and includes all required fields.


362-368: Entry for base_sepolia zetaToken is well-structured.

The new zetaToken asset entry for base_sepolia is correctly formatted and includes all required fields.

@@ -1,5 +1,15 @@
{
"ccm": {
"base_testnet": {
Copy link
Member

@Mfigueira Mfigueira Aug 16, 2024

Choose a reason for hiding this comment

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

Should this be updated to base_sepolia?

Suggested change
"base_testnet": {
"base_sepolia": {

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a legacy file that hasn't been updated in ages. This file as well as address.tools.ts and some other files are just there, because they may have been used by the protocol contracts deploy scripts.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated files are addresses.mainnet.json and addresses.testnet.json.

Copy link
Member

Choose a reason for hiding this comment

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

Got it, just wondering about this file being updated in this PR, we can ignore this

@fadeev fadeev merged commit 2cf7ef2 into main Sep 5, 2024
7 checks passed
@fadeev fadeev deleted the polygon-base-addresses branch September 5, 2024 08:10
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