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: contract addresses #348

Merged
merged 2 commits into from
Sep 19, 2024
Merged

feat: contract addresses #348

merged 2 commits into from
Sep 19, 2024

Conversation

fadeev
Copy link
Member

@fadeev fadeev commented Sep 12, 2024

  • Moved contract addresses JSON from v1 to v2 because we have tools that depend on these addresses so before we migrate to a better system we need these addresses published.

Summary by CodeRabbit

  • New Features

    • Introduced comprehensive lists of blockchain addresses for mainnet and testnet environments, enhancing cross-chain functionality and interoperability.
    • Added detailed asset information for various token types, facilitating integration with decentralized applications.
  • Documentation

    • Updated the readme file to include a warning about not modifying automatically generated addresses, improving user guidance.

Copy link
Contributor

coderabbitai bot commented Sep 12, 2024

Warning

Rate limit exceeded

@fadeev has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 45 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 92837ac and 57e861c.

Walkthrough

Walkthrough

The changes introduce two new JSON files, addresses.mainnet.json and addresses.testnet.json, which contain comprehensive lists of blockchain addresses categorized by functionality across various blockchain networks. Each entry includes attributes such as address, category, chain_id, chain_name, and type. Additionally, a line was added to the readme.md file to inform users that the addresses are automatically generated and should not be modified directly.

Changes

File Path Change Summary
v2/data/addresses.mainnet.json Added a comprehensive list of blockchain addresses with attributes for mainnet networks.
v2/data/addresses.testnet.json Added a comprehensive list of blockchain addresses with attributes for testnet networks.
v2/data/readme.md Added a warning note indicating that addresses are automatically generated and should not be modified directly.

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

@fadeev fadeev marked this pull request as draft September 12, 2024 05:45
@codecov-commenter
Copy link

codecov-commenter commented Sep 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.37%. Comparing base (292d235) to head (57e861c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #348   +/-   ##
=======================================
  Coverage   97.37%   97.37%           
=======================================
  Files           7        7           
  Lines         305      305           
  Branches       98       98           
=======================================
  Hits          297      297           
  Misses          8        8           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 292d235 and 92837ac.

Files selected for processing (3)
  • v2/data/addresses.mainnet.json (1 hunks)
  • v2/data/addresses.testnet.json (1 hunks)
  • v2/data/readme.md (1 hunks)
Files skipped from review due to trivial changes (1)
  • v2/data/readme.md
Additional comments not posted (4)
v2/data/addresses.mainnet.json (3)

1-381: The file structure and data format look good!

The JSON array of objects follows a consistent structure, with each object representing a blockchain address and its associated metadata. The data format appears to be well-defined and adheres to the expected schema.


4-4: Verify the consistency of category values.

The category property seems to have a limited set of allowed values. Ensure that all category values are valid and consistent throughout the array.

Also applies to: 11-11, 18-18, 25-25, 32-32, 39-39, 46-46, 53-53, 60-60, 67-67, 74-74, 81-81, 88-88, 95-95, 102-102, 109-109, 116-116, 123-123, 130-130, 137-137, 144-144, 151-151, 158-158, 165-165, 172-172, 179-179, 186-186, 193-193, 200-200, 207-207, 220-220, 233-233, 246-246, 259-259, 272-272, 285-285, 298-298, 311-311, 324-324, 337-337, 349-349, 362-362, 376-376

Verification successful

Category values are consistent.

The category values in v2/data/addresses.mainnet.json are consistent with the expected values "messaging" and "omnichain" as mentioned in the review comment. No discrepancies were found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of `category` values.

# Test: Extract unique `category` values.
# Expect: Only valid categories like "messaging", "omnichain", etc.
jq -r '.[].category' v2/data/addresses.mainnet.json | sort | uniq

Length of output: 87


7-7: Verify the consistency of type values.

Similar to the category property, the type property appears to have a predefined set of allowed values. Validate that all type values are consistent and match the expected set of values.

Also applies to: 14-14, 21-21, 28-28, 35-35, 42-42, 49-49, 56-56, 63-63, 70-70, 77-77, 84-84, 91-91, 98-98, 105-105, 112-112, 119-119, 126-126, 133-133, 140-140, 147-147, 154-154, 161-161, 168-168, 175-175, 182-182, 189-189, 196-196, 203-203, 211-211, 224-224, 237-237, 250-250, 263-263, 276-276, 289-289, 302-302, 315-315, 328-328, 341-341, 354-354, 367-367, 379-379

v2/data/addresses.testnet.json (1)

1-439: LGTM!

The addresses.testnet.json file looks good overall:

  • The JSON structure is valid and consistent.
  • The data format and properties used for each address object seem appropriate and well-organized.
  • Categorizing the addresses by category and type provides a clear way to identify their functionality.
  • Including the chain_id and chain_name properties helps specify the blockchain network for each address.
  • The additional properties like asset, coin_type, decimals, description, foreign_chain_id, and symbol give useful context about associated assets where applicable.

I didn't find any glaring issues or inconsistencies with the data. Nice work on putting together this comprehensive list of addresses!

@@ -0,0 +1,381 @@
[
{
"address": "0x000007Cf399229b2f5A4D043F20E90C9C98B7C6a",
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Duplicate address values found in addresses.mainnet.json.

The following address values are duplicated in the JSON file, which may affect data integrity:

  • 0x70e967acFcC17c3941E87562161406d41676FD83
  • 0x7828F92E7d79E141189f24C98aceF71Bc07bad3f
  • 0xaeB6dDB7708467814D557e340283248be8E43124
  • 0xaf28a257D292e7f0E531073f70a175b57E0261a8

Please review and ensure each address is unique.

Analysis chain

Verify the uniqueness of address values.

To ensure data integrity, it's important to confirm that each address value is unique across all objects in the array.

Also applies to: 10-10, 17-17, 24-24, 31-31, 38-38, 45-45, 52-52, 59-59, 66-66, 73-73, 80-80, 87-87, 94-94, 101-101, 108-108, 115-115, 122-122, 129-129, 136-136, 143-143, 150-150, 157-157, 164-164, 171-171, 178-178, 185-185, 192-192, 199-199, 206-206, 219-219, 232-232, 245-245, 258-258, 271-271, 284-284, 297-297, 310-310, 323-323, 336-336, 348-348, 361-361, 375-375

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the uniqueness of `address` values.

# Test: Extract `address` values and check for duplicates.
# Expect: No output, indicating no duplicates found.
jq -r '.[].address' v2/data/addresses.mainnet.json | sort | uniq -d

Length of output: 241


Tip

Codebase Verification

Inconsistent Address Formats Detected

The address formats for the specified chain_name values are inconsistent with the expected standards. Ethereum-based chains ("eth_mainnet", "bsc_mainnet", "polygon_mainnet", "zeta_mainnet") have addresses starting with "bc1q", which is incorrect. Similarly, "btc_mainnet" has addresses starting with "0x", which is also incorrect. Please review and correct these address formats.

  • Ethereum-based chains should have addresses starting with "0x".
  • Bitcoin-based chains should have addresses starting with "bc1q".
Analysis chain

Verify the consistency of address formats for each chain_name.

Each chain_name likely has its own expected format for address values. It's crucial to validate that the address values adhere to the correct format based on the associated chain_name.

Also applies to: 10-10, 17-17, 24-24, 31-31, 38-38, 45-45, 52-52, 59-59, 66-66, 73-73, 80-80, 87-87, 94-94, 101-101, 108-108, 115-115, 122-122, 129-129, 136-136, 143-143, 150-150, 157-157, 164-164, 171-171, 178-178, 185-185, 192-192, 199-199, 206-206, 219-219, 232-232, 245-245, 258-258, 271-271, 284-284, 297-297, 310-310, 323-323, 336-336, 348-348, 361-361, 375-375

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of `address` formats for each `chain_name`.

# Test: Check if `address` values start with "0x" for `chain_name` "eth_mainnet".
# Expect: All `address` values should start with "0x".
jq -r 'select(.[].chain_name == "eth_mainnet") | .[].address' v2/data/addresses.mainnet.json | grep -v '^0x'

# Test: Check if `address` values start with "0x" for `chain_name` "bsc_mainnet".
# Expect: All `address` values should start with "0x". 
jq -r 'select(.[].chain_name == "bsc_mainnet") | .[].address' v2/data/addresses.mainnet.json | grep -v '^0x'

# Test: Check if `address` values start with "0x" for `chain_name` "polygon_mainnet".
# Expect: All `address` values should start with "0x".
jq -r 'select(.[].chain_name == "polygon_mainnet") | .[].address' v2/data/addresses.mainnet.json | grep -v '^0x'

# Test: Check if `address` values start with "0x" for `chain_name` "zeta_mainnet".
# Expect: All `address` values should start with "0x".
jq -r 'select(.[].chain_name == "zeta_mainnet") | .[].address' v2/data/addresses.mainnet.json | grep -v '^0x'

# Test: Check if `address` values start with "bc1q" for `chain_name` "btc_mainnet".
# Expect: All `address` values should start with "bc1q".
jq -r 'select(.[].chain_name == "btc_mainnet") | .[].address' v2/data/addresses.mainnet.json | grep -v '^bc1q'

Length of output: 4173

Comment on lines +206 to +217
"address": "0x05BA149A7bd6dC1F937fA9046A9e05C05f3b18b0",
"asset": "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
"category": "omnichain",
"chain_id": 7000,
"chain_name": "zeta_mainnet",
"coin_type": "erc20",
"decimals": 18,
"description": "ZetaChain ZRC20 USDC on BSC",
"foreign_chain_id": "56",
"symbol": "USDC.BSC",
"type": "zrc20"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Incomplete Metadata for "zrc20" Objects

The verification process found that several "zrc20" objects have incomplete metadata due to empty "asset" fields. Please ensure that all required properties have valid values.

  • Objects with empty "asset" fields:
    • Address: 0x13A0c5930C028511Dc02665E7285134B6d11A5f4
    • Address: 0x48f80608B672DC30DC7e3dbBd0343c5F02C738Eb
    • Address: 0xADF73ebA3Ebaa7254E859549A44c74eF7cff7501
    • Address: 0xd97B1de3619ed2c6BEb3860147E30cA8A7dC9891
Analysis chain

Verify the completeness of metadata for "zrc20" objects.

Objects with type "zrc20" contain additional metadata properties. Ensure that all required metadata properties are present and have valid values for each "zrc20" object.

Also applies to: 218-230, 231-243, 245-256, 257-269, 270-282, 283-295, 296-308, 309-321, 322-334, 335-347, 348-360, 361-373

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the completeness of metadata for "zrc20" objects.

# Test: Check if all "zrc20" objects have the required metadata properties.
# Expect: All objects should have "address", "asset", "category", "chain_id", "chain_name", 
#         "coin_type", "decimals", "description", "foreign_chain_id", "symbol", and "type".
jq -r 'select(.[].type == "zrc20") | select(has("address") and has("asset") and has("category") and has("chain_id") and has("chain_name") and has("coin_type") and has("decimals") and has("description") and has("foreign_chain_id") and has("symbol") and has("type") | not)' v2/data/addresses.mainnet.json

# Test: Check if all "zrc20" objects have non-empty values for the required metadata properties.
# Expect: All required properties should have non-empty values.
jq -r 'select(.[].type == "zrc20") | select((.address == "") or (.asset == "") or (.category == "") or (.chain_id == "") or (.chain_name == "") or (.coin_type == "") or (.decimals == "") or (.description == "") or (.foreign_chain_id == "") or (.symbol == "") or (.type == ""))' v2/data/addresses.mainnet.json

Length of output: 802


Script:

#!/bin/bash
# Description: Verify the completeness of metadata for "zrc20" objects.

# Test: Check if all "zrc20" objects have the required metadata properties.
# Expect: All objects should have "address", "asset", "category", "chain_id", "chain_name", 
#         "coin_type", "decimals", "description", "foreign_chain_id", "symbol", and "type".
jq -r '.[] | select(.type == "zrc20") | select(has("address") and has("asset") and has("category") and has("chain_id") and has("chain_name") and has("coin_type") and has("decimals") and has("description") and has("foreign_chain_id") and has("symbol") and has("type") | not)' v2/data/addresses.mainnet.json

# Test: Check if all "zrc20" objects have non-empty values for the required metadata properties.
# Expect: All required properties should have non-empty values.
jq -r '.[] | select(.type == "zrc20") | select((.address == "") or (.asset == "") or (.category == "") or (.chain_id == "") or (.chain_name == "") or (.coin_type == "") or (.decimals == "") or (.description == "") or (.foreign_chain_id == "") or (.symbol == "") or (.type == ""))' v2/data/addresses.mainnet.json

Length of output: 1910

@fadeev fadeev marked this pull request as ready for review September 12, 2024 05:56
"category": "messaging",
"chain_id": 1,
"chain_name": "eth_mainnet",
"type": "connector"
Copy link
Contributor

Choose a reason for hiding this comment

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

we have some contracts here that are not used in v2, like connector etc, which tools depend on having these addresses in v2 folder?

"scripts": {
"lint": "npx eslint . --ignore-pattern coverage/ --ignore-pattern coverage.json --ignore-pattern lib/ --ignore-pattern out --ignore-pattern cache_forge/",
"lint:fix": "npx eslint . --fix --ignore-pattern coverage/ --ignore-pattern coverage.json --ignore-pattern lib/ --ignore-pattern out --ignore-pattern cache_forge/",
"test": "forge clean && forge test -vvv",
"coverage": "forge clean && forge coverage --no-match-coverage \"(script|test)\" --report lcov",
"typechain": "npx typechain --target ethers-v6 \"out/**/!(*.t|test).sol/!(*.abi).json\" --out-dir types",
"generate": "forge clean && forge build && forge fmt && ./scripts/generate_go.sh || true && yarn lint:fix && yarn typechain",
"generate": "forge clean && forge build && forge fmt && ./scripts/generate_go.sh || true && yarn lint:fix && yarn typechain && yarn docs && del-cli dist && tsc || true",
Copy link
Contributor

Choose a reason for hiding this comment

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

could you give more details on these changes, why we need dist folder, is it the output of typescript if needed i would move it to separate npm script and call that script here

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.

5 participants