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

Hello and Echo Contracts #485

Merged
merged 3 commits into from
Oct 15, 2024
Merged

Hello and Echo Contracts #485

merged 3 commits into from
Oct 15, 2024

Conversation

fadeev
Copy link
Member

@fadeev fadeev commented Oct 8, 2024

Depends on zeta-chain/example-contracts#201

Summary by CodeRabbit

  • New Features
    • Expanded tutorial on creating a universal app contract, enhancing clarity and detail.
    • Added new functions for contract calls and token withdrawals with gas fee management.
  • Updates
    • Increased read time for the "First Universal App on Localnet" tutorial from 10 minutes to 30 minutes.
    • Revised prerequisites and descriptions to improve instructional quality and consistency.

Copy link

vercel bot commented Oct 8, 2024

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

Name Status Preview Comments Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 8, 2024 9:22am

Copy link
Contributor

coderabbitai bot commented Oct 8, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request introduces modifications to the tutorial documentation and related contract code. Specifically, the readTime for the "First Universal App on Localnet" tutorial is updated from "10 min" to "30 min" in the _meta.json file. Additionally, the hello.mdx tutorial is revised to enhance clarity, expand prerequisites, and update the contract's implementation details. Changes include the introduction of new functions in the Hello contract and adjustments to the contract's state variable declaration, ensuring improved instructional quality.

Changes

File Path Change Summary
src/pages/developers/tutorials/_meta.json Updated readTime for "First Universal App on Localnet" tutorial from "10 min" to "30 min".
src/pages/developers/tutorials/hello.mdx Revised introduction, expanded prerequisites, updated contract description, and added new functions (call, withdrawAndCall). Modified gateway to be immutable and updated event messages for clarity.

Possibly related PRs

Suggested reviewers

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

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.

@fadeev
Copy link
Member Author

fadeev commented Oct 8, 2024

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Oct 8, 2024

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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 (7)
src/pages/developers/tutorials/hello.mdx (7)

22-23: Alert update approved with suggestion.

The updated alert effectively communicates the current limitations of the gateway availability. To enhance clarity, consider rephrasing the second sentence as follows:

- Therefore, deploying this tutorial on testnet is not possible at this time.
+ Consequently, this tutorial cannot be deployed on testnet at present.

This rephrasing maintains a more formal tone and improves readability.


Line range hint 64-85: Contract code modifications approved with suggestion.

The changes to the Hello contract are well-implemented:

  1. The immutable keyword for gateway is a gas optimization best practice.
  2. The updated onRevert function signature aligns with the UniversalContract interface.
  3. The new call and withdrawAndCall functions enhance cross-chain interaction capabilities.

To improve code consistency, consider updating the event emission in onRevert:

- emit RevertEvent("Revert on ZetaChain", revertContext);
+ emit RevertEvent("Revert on ZetaChain", revertContext);

This change maintains consistency with the "ZetaChain" terminology used throughout the contract.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~146-~146: Loose punctuation mark.
Context: ...h the following parameters: - context: A zContext struct containing: - `or...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~149-~149: Loose punctuation mark.
Context: ...n the connected chain. - chainID: The integer ID of the connected chain f...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~151-~151: Loose punctuation mark.
Context: ...-chain call originated. - sender: Reserved for future use (currently empt...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~152-~152: Loose punctuation mark.
Context: ... future use (currently empty). - zrc20: The address of the ZRC-20 token represe...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~154-~154: Loose punctuation mark.
Context: ...sset from the source chain. - amount: The number of tokens transferred. - `me...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~155-~155: Loose punctuation mark.
Context: ...umber of tokens transferred. - message: The encoded data payload. The `onCross...

(UNLIKELY_OPENING_PUNCTUATION)


87-124: New functions call and withdrawAndCall approved with suggestion.

The addition of call and withdrawAndCall functions significantly enhances the contract's cross-chain interaction capabilities. The implementation includes proper error handling and efficient gas fee management.

To improve code readability, consider adding inline comments explaining the purpose of key operations:

 function call(
     bytes memory receiver,
     address zrc20,
     bytes calldata message,
     uint256 gasLimit,
     RevertOptions memory revertOptions
 ) external {
+    // Calculate and transfer gas fee
     (, uint256 gasFee) = IZRC20(zrc20).withdrawGasFeeWithGasLimit(gasLimit);
     IZRC20(zrc20).transferFrom(msg.sender, address(this), gasFee);
     IZRC20(zrc20).approve(address(gateway), gasFee);
+    // Initiate cross-chain call
     gateway.call(receiver, zrc20, message, gasLimit, revertOptions);
 }

Similar inline comments can be added to the withdrawAndCall function to enhance code comprehension.


165-205: New sections on outgoing contract calls and withdrawals approved with suggestion.

The addition of detailed explanations for the call and withdrawAndCall functions significantly enhances the tutorial's comprehensiveness. The step-by-step breakdowns provide valuable insights into the cross-chain interaction process.

To further improve clarity, consider adding a brief example or diagram illustrating the flow of tokens and data in a typical cross-chain interaction scenario. This visual aid would complement the textual explanations and help readers grasp the concepts more easily.


Line range hint 207-243: Updated Echo contract code approved with suggestion.

The modifications to the Echo contract, including the addition of new functions and events, effectively align with the changes made to the Hello contract. These updates enhance the contract's capability to handle cross-chain interactions.

To improve code consistency and readability, consider the following minor adjustment:

 contract Echo {
     GatewayEVM public immutable gateway;

     event RevertEvent(string, RevertContext);
     event HelloEvent(string, string);

     constructor(address payable gatewayAddress) {
         gateway = GatewayEVM(gatewayAddress);
     }

     function hello(string memory message) external payable {
         emit HelloEvent("Hello on EVM", message);
     }

     function onRevert(RevertContext calldata revertContext) external {
-        emit RevertEvent("Revert on EVM", revertContext);
+        emit RevertEvent("Revert on connected chain", revertContext);
     }

     function call(
         address receiver,
         bytes calldata message,
         RevertOptions memory revertOptions
     ) external {
         gateway.call(receiver, message, revertOptions);
     }

     receive() external payable {}

     fallback() external payable {}
 }

This change in the onRevert function makes the event message more generic, accommodating potential future deployments on non-EVM chains.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~146-~146: Loose punctuation mark.
Context: ...h the following parameters: - context: A zContext struct containing: - `or...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~149-~149: Loose punctuation mark.
Context: ...n the connected chain. - chainID: The integer ID of the connected chain f...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~151-~151: Loose punctuation mark.
Context: ...-chain call originated. - sender: Reserved for future use (currently empt...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~152-~152: Loose punctuation mark.
Context: ... future use (currently empty). - zrc20: The address of the ZRC-20 token represe...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~154-~154: Loose punctuation mark.
Context: ...sset from the source chain. - amount: The number of tokens transferred. - `me...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~155-~155: Loose punctuation mark.
Context: ...umber of tokens transferred. - message: The encoded data payload. The `onCross...

(UNLIKELY_OPENING_PUNCTUATION)


248-340: Updated deployment and interaction instructions approved with suggestion.

The revised instructions for deploying and interacting with the contracts provide a clear and comprehensive guide for users. The new commands accurately reflect the changes made to the contracts and offer valuable insights into cross-chain interactions.

To enhance user experience, consider adding a brief troubleshooting section addressing common issues that users might encounter during the deployment and interaction process. This addition would make the tutorial more robust and user-friendly.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~296-~296: Loose punctuation mark.
Context: ...ice ``` Parameters: - --contract: Address of the `Echo` contract on the c...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~297-~297: Loose punctuation mark.
Context: ... the connected EVM chain. - --receiver: Address of the Hello contract on Zeta...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~298-~298: Loose punctuation mark.
Context: ...locontract on ZetaChain. ---network: Network to interact with (localhost` f...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~299-~299: Loose punctuation mark.
Context: ... (localhost for localnet). - --types: ABI types of the message parameters (e....

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~300-~300: Loose punctuation mark.
Context: ...rameters (e.g., ["string"]). - alice: The message to send. Overview: - EVM:...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~337-~337: Loose punctuation mark.
Context: ...2 ``` Parameters: - --revert-address: Address of the `Echo` contract on the s...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~338-~338: Loose punctuation mark.
Context: ...e source EVM chain. - --revert-message: Data to pass to the Echo contract's `...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~339-~339: Loose punctuation mark.
Context: ...onRevertfunction. ---call-on-revert`: Flag indicating that the gateway should...

(UNLIKELY_OPENING_PUNCTUATION)


371-424: New sections on simulating and handling reverts approved with suggestion.

The addition of sections explaining how to simulate and handle reverts significantly enhances the tutorial's completeness. These sections provide valuable insights into error handling in cross-chain interactions, with clear explanations and commands that align well with the contract implementations.

To further improve the educational value of these sections, consider adding a brief explanation of the importance of proper revert handling in production environments. This could include mentions of potential security implications and best practices for robust error management in cross-chain applications.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~396-~396: Loose punctuation mark.
Context: ...2 ``` Parameters: - --revert-address: Address of the `Hello` contract on Zeta...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~397-~397: Loose punctuation mark.
Context: ...tract on ZetaChain. - --revert-message: Data to pass to the Hello contract's ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~399-~399: Loose punctuation mark.
Context: ...Revert function. ---call-on-revert`: Flag indicating that the gateway should...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~418-~418: Possible missing comma found.
Context: ... to manage cross-chain calls and handle reverts you are now equipped to build robust an...

(AI_HYDRA_LEO_MISSING_COMMA)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 16cc608 and 0f7c4b2.

📒 Files selected for processing (2)
  • src/pages/developers/tutorials/_meta.json (1 hunks)
  • src/pages/developers/tutorials/hello.mdx (6 hunks)
🧰 Additional context used
🪛 LanguageTool
src/pages/developers/tutorials/hello.mdx

[uncategorized] ~146-~146: Loose punctuation mark.
Context: ...h the following parameters: - context: A zContext struct containing: - `or...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~149-~149: Loose punctuation mark.
Context: ...n the connected chain. - chainID: The integer ID of the connected chain f...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~151-~151: Loose punctuation mark.
Context: ...-chain call originated. - sender: Reserved for future use (currently empt...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~152-~152: Loose punctuation mark.
Context: ... future use (currently empty). - zrc20: The address of the ZRC-20 token represe...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~154-~154: Loose punctuation mark.
Context: ...sset from the source chain. - amount: The number of tokens transferred. - `me...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~155-~155: Loose punctuation mark.
Context: ...umber of tokens transferred. - message: The encoded data payload. The `onCross...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~296-~296: Loose punctuation mark.
Context: ...ice ``` Parameters: - --contract: Address of the `Echo` contract on the c...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~297-~297: Loose punctuation mark.
Context: ... the connected EVM chain. - --receiver: Address of the Hello contract on Zeta...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~298-~298: Loose punctuation mark.
Context: ...locontract on ZetaChain. ---network: Network to interact with (localhost` f...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~299-~299: Loose punctuation mark.
Context: ... (localhost for localnet). - --types: ABI types of the message parameters (e....

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~300-~300: Loose punctuation mark.
Context: ...rameters (e.g., ["string"]). - alice: The message to send. Overview: - EVM:...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~337-~337: Loose punctuation mark.
Context: ...2 ``` Parameters: - --revert-address: Address of the `Echo` contract on the s...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~338-~338: Loose punctuation mark.
Context: ...e source EVM chain. - --revert-message: Data to pass to the Echo contract's `...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~339-~339: Loose punctuation mark.
Context: ...onRevertfunction. ---call-on-revert`: Flag indicating that the gateway should...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~361-~361: Loose punctuation mark.
Context: ...' alice ``` Parameters: - --contract: Address of the `Hello` contract on Zeta...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~362-~362: Loose punctuation mark.
Context: ...ocontract on ZetaChain. ---receiver: Address of the Echo` contract on the c...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~363-~363: Loose punctuation mark.
Context: ... on the connected EVM chain. - --zrc20: Address of the ZRC-20 token representin...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~365-~365: Loose punctuation mark.
Context: ...es the destination chain. - --function: Function signature to invoke on the `Ec...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~367-~367: Loose punctuation mark.
Context: ....g., "hello(string)"). - --network: Network to interact with (localhost f...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~368-~368: Loose punctuation mark.
Context: ... (localhost for localnet). - --types: ABI types of the message parameters (e....

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~369-~369: Loose punctuation mark.
Context: ...rameters (e.g., ["string"]). - alice: The message to send. ## Simulating a R...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~396-~396: Loose punctuation mark.
Context: ...2 ``` Parameters: - --revert-address: Address of the `Hello` contract on Zeta...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~397-~397: Loose punctuation mark.
Context: ...tract on ZetaChain. - --revert-message: Data to pass to the Hello contract's ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~399-~399: Loose punctuation mark.
Context: ...Revert function. ---call-on-revert`: Flag indicating that the gateway should...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~418-~418: Possible missing comma found.
Context: ... to manage cross-chain calls and handle reverts you are now equipped to build robust an...

(AI_HYDRA_LEO_MISSING_COMMA)

🔇 Additional comments (5)
src/pages/developers/tutorials/_meta.json (1)

9-9: Approved: Read time update for "First Universal App on Localnet" tutorial.

The modification to increase the readTime from "10 min" to "30 min" for the "hello" tutorial appears appropriate, assuming the tutorial content has been substantially expanded or made more comprehensive.

To ensure accuracy, please verify that the new 30-minute estimate aligns with the actual content of the tutorial. Consider the following:

  1. Word count: A typical reading speed is 200-250 words per minute. Verify if the tutorial's word count justifies a 30-minute read time.
  2. Complexity: Factor in any hands-on exercises or code implementations that may extend the time beyond mere reading.
  3. User feedback: If available, consider any user feedback on the time taken to complete the tutorial.
src/pages/developers/tutorials/hello.mdx (4)

7-10: Introduction enhancement approved.

The revised introduction effectively clarifies the universal app's functionality, accurately describing the cross-chain interaction between Ethereum and ZetaChain. This modification enhances the reader's understanding of the tutorial's objectives.


28-31: Prerequisites update approved.

The revised prerequisites section offers a more structured and comprehensive list of requirements. The addition of the "Getting Started with ZetaChain" prerequisite ensures that readers possess the necessary foundational knowledge before proceeding with this tutorial.


46-50: Universal App Contract description enhancement approved.

The expanded description of the Hello contract provides valuable context, particularly by mentioning the implementation of the UniversalContract interface. This addition is crucial for understanding the contract's role in facilitating cross-chain interactions.


129-163: Enhanced Hello contract explanation approved.

The expanded explanation of the Hello contract and its functions significantly improves the tutorial's educational value. The detailed description of the UniversalContract interface and the onCrossChainCall function provides readers with a comprehensive understanding of the contract's role in facilitating cross-chain interactions.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~146-~146: Loose punctuation mark.
Context: ...h the following parameters: - context: A zContext struct containing: - `or...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~149-~149: Loose punctuation mark.
Context: ...n the connected chain. - chainID: The integer ID of the connected chain f...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~151-~151: Loose punctuation mark.
Context: ...-chain call originated. - sender: Reserved for future use (currently empt...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~152-~152: Loose punctuation mark.
Context: ... future use (currently empty). - zrc20: The address of the ZRC-20 token represe...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~154-~154: Loose punctuation mark.
Context: ...sset from the source chain. - amount: The number of tokens transferred. - `me...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~155-~155: Loose punctuation mark.
Context: ...umber of tokens transferred. - message: The encoded data payload. The `onCross...

(UNLIKELY_OPENING_PUNCTUATION)

@fadeev fadeev marked this pull request as ready for review October 8, 2024 09:17
@fadeev fadeev requested review from bbbeeeee, brewmaster012 and a team as code owners October 8, 2024 09:17
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)
src/pages/developers/tutorials/hello.mdx (2)

Line range hint 44-132: Enhanced contract functionality with room for more explanation.

The Hello contract has been significantly improved with the addition of call and withdrawAndCall functions, and the gateway variable is now correctly marked as immutable. These changes enhance the contract's functionality and efficiency.

However, to further improve the tutorial:

Consider adding more detailed explanations for the new call and withdrawAndCall functions. This could include:

  1. The purpose of each function
  2. When and why a developer might use one over the other
  3. Any potential risks or considerations when using these functions

This additional context would help readers better understand the contract's capabilities and make informed decisions when implementing their own universal apps.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~155-~155: Loose punctuation mark.
Context: ...oming data, which includes: - context: A zContext struct containing: - `or...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~158-~158: Loose punctuation mark.
Context: ...n the connected chain. - chainID: The integer ID of the connected chain f...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~160-~160: Loose punctuation mark.
Context: ...-chain call originated. - sender: Reserved for future use (currently empt...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~161-~161: Loose punctuation mark.
Context: ... future use (currently empty). - zrc20: The address of the ZRC-20 token represe...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~163-~163: Loose punctuation mark.
Context: ...sset from the source chain. - amount: The number of tokens transferred. - `me...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~164-~164: Loose punctuation mark.
Context: ...umber of tokens transferred. - message: The encoded data payload. Within `onCr...

(UNLIKELY_OPENING_PUNCTUATION)


262-486: Comprehensive deployment and interaction guide with room for formatting improvement.

The sections covering localnet setup, contract deployment, and interactions provide a thorough guide for users to follow. The addition of revert simulation and handling scenarios enhances the tutorial's practical value.

To improve readability, consider the following formatting suggestions for the long command lines:

  1. Use line breaks with \ for multi-line commands.
  2. Align parameters vertically for easier scanning.

Example:

npx hardhat hello-withdraw-and-call \
  --contract 0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E \
  --receiver 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690 \
  --zrc20    0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c \
  --function "hello(string)" \
  --amount   1 \
  --network  localhost \
  --types    '["string"]' \
  hello

This formatting will make the commands easier to read and understand, especially for newcomers to the ZetaChain ecosystem.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~315-~315: Loose punctuation mark.
Context: ...ice ``` Parameters: - --contract: Address of the `Echo` contract on the c...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~316-~316: Loose punctuation mark.
Context: ... the connected EVM chain. - --receiver: Address of the Hello contract on Zeta...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~317-~317: Loose punctuation mark.
Context: ...locontract on ZetaChain. ---network: Network to interact with (localhost` f...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~318-~318: Loose punctuation mark.
Context: ... (localhost for localnet). - --types: ABI types of the message parameters (e....

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~319-~319: Loose punctuation mark.
Context: ...rameters (e.g., ["string"]). - alice: The message to send. Overview: - ...

(UNLIKELY_OPENING_PUNCTUATION)


[typographical] ~344-~344: If the word ‘What’ starts a question, add a question mark at the end of the sentence.
Context: ...pes '["uint256"]' 42 ``` What Happens: - The Hello contract's `onCrossCha...

(WP_VB_QUESTION_MARK)


[uncategorized] ~369-~369: Loose punctuation mark.
Context: ... **Parameters:** ---revert-address: Address of the Echo` contract on the s...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~370-~370: Loose punctuation mark.
Context: ...e source EVM chain. - --revert-message: Data to pass to the Echo contract's `...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~371-~371: Loose punctuation mark.
Context: ...onRevertfunction. ---call-on-revert`: Flag indicating that the gateway should...

(UNLIKELY_OPENING_PUNCTUATION)


[typographical] ~374-~374: If the word ‘What’ starts a question, add a question mark at the end of the sentence.
Context: ... contract upon revert. What Happens: - When the revert occurs, the gatewa...

(WP_VB_QUESTION_MARK)


[uncategorized] ~399-~399: Loose punctuation mark.
Context: ...ice ``` Parameters: - --contract: Address of the `Hello` contract on Zeta...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~400-~400: Loose punctuation mark.
Context: ...ocontract on ZetaChain. ---receiver: Address of the Echo` contract on the c...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~401-~401: Loose punctuation mark.
Context: ... on the connected EVM chain. - --zrc20: Address of the ZRC-20 token representin...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~401-~401: Possible missing comma found.
Context: ...ain. - --zrc20: Address of the ZRC-20 token representing the gas token of the con...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~403-~403: Loose punctuation mark.
Context: ...es the destination chain. - --function: Function signature to invoke on the `Ec...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~405-~405: Loose punctuation mark.
Context: ....g., "hello(string)"). - --network: Network to interact with (localhost f...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~406-~406: Loose punctuation mark.
Context: ... (localhost for localnet). - --types: ABI types of the message parameters. - ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~407-~407: Loose punctuation mark.
Context: ...pes of the message parameters. - alice: The message to send. ## Simulating a R...

(UNLIKELY_OPENING_PUNCTUATION)


[typographical] ~424-~424: If the word ‘What’ starts a question, add a question mark at the end of the sentence.
Context: ...pes '["uint256"]' 42 ``` What Happens: - The Echo contract expects a `str...

(WP_VB_QUESTION_MARK)


[uncategorized] ~449-~449: Loose punctuation mark.
Context: ... **Parameters:** ---revert-address: Address of the Hello` contract on Zeta...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~450-~450: Loose punctuation mark.
Context: ...tract on ZetaChain. - --revert-message: Data to pass to the Hello contract's ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~452-~452: Loose punctuation mark.
Context: ...Revert function. ---call-on-revert`: Flag indicating that the gateway should...

(UNLIKELY_OPENING_PUNCTUATION)


[typographical] ~455-~455: If the word ‘What’ starts a question, add a question mark at the end of the sentence.
Context: ... contract upon revert. What Happens: - Upon revert, the gateway calls the...

(WP_VB_QUESTION_MARK)


[uncategorized] ~479-~479: Loose punctuation mark.
Context: ...llo ``` Parameters: - --contract: Address of the `Hello` contract on Zeta...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~480-~480: Loose punctuation mark.
Context: ...ocontract on ZetaChain. ---receiver: Address of the Echo` contract on the c...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~481-~481: Loose punctuation mark.
Context: ... on the connected EVM chain. - --zrc20: Address of the ZRC-20 token representin...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~482-~482: Loose punctuation mark.
Context: ...ng the asset to withdraw. - --function: Function signature to invoke on the `Ec...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~483-~483: Loose punctuation mark.
Context: ...oke on the Echo contract. - --amount: Amount of tokens to withdraw. - `--netw...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~483-~483: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...e on the Echo contract. - --amount: Amount of tokens to withdraw. - --network: N...

(AMOUNTOF_TO_NUMBEROF)


[uncategorized] ~484-~484: Loose punctuation mark.
Context: ...unt of tokens to withdraw. - --network: Network to interact with. - --types: ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~485-~485: Loose punctuation mark.
Context: ...: Network to interact with. - --types`: ABI types of the message parameters. - ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~486-~486: Loose punctuation mark.
Context: ...pes of the message parameters. - hello: The message to send. ## Conclusion In...

(UNLIKELY_OPENING_PUNCTUATION)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 0f7c4b2 and c4cf33b.

📒 Files selected for processing (1)
  • src/pages/developers/tutorials/hello.mdx (4 hunks)
🧰 Additional context used
🪛 LanguageTool
src/pages/developers/tutorials/hello.mdx

[uncategorized] ~155-~155: Loose punctuation mark.
Context: ...oming data, which includes: - context: A zContext struct containing: - `or...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~158-~158: Loose punctuation mark.
Context: ...n the connected chain. - chainID: The integer ID of the connected chain f...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~160-~160: Loose punctuation mark.
Context: ...-chain call originated. - sender: Reserved for future use (currently empt...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~161-~161: Loose punctuation mark.
Context: ... future use (currently empty). - zrc20: The address of the ZRC-20 token represe...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~163-~163: Loose punctuation mark.
Context: ...sset from the source chain. - amount: The number of tokens transferred. - `me...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~164-~164: Loose punctuation mark.
Context: ...umber of tokens transferred. - message: The encoded data payload. Within `onCr...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~315-~315: Loose punctuation mark.
Context: ...ice ``` Parameters: - --contract: Address of the `Echo` contract on the c...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~316-~316: Loose punctuation mark.
Context: ... the connected EVM chain. - --receiver: Address of the Hello contract on Zeta...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~317-~317: Loose punctuation mark.
Context: ...locontract on ZetaChain. ---network: Network to interact with (localhost` f...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~318-~318: Loose punctuation mark.
Context: ... (localhost for localnet). - --types: ABI types of the message parameters (e....

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~319-~319: Loose punctuation mark.
Context: ...rameters (e.g., ["string"]). - alice: The message to send. Overview: - ...

(UNLIKELY_OPENING_PUNCTUATION)


[typographical] ~344-~344: If the word ‘What’ starts a question, add a question mark at the end of the sentence.
Context: ...pes '["uint256"]' 42 ``` What Happens: - The Hello contract's `onCrossCha...

(WP_VB_QUESTION_MARK)


[uncategorized] ~369-~369: Loose punctuation mark.
Context: ... **Parameters:** ---revert-address: Address of the Echo` contract on the s...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~370-~370: Loose punctuation mark.
Context: ...e source EVM chain. - --revert-message: Data to pass to the Echo contract's `...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~371-~371: Loose punctuation mark.
Context: ...onRevertfunction. ---call-on-revert`: Flag indicating that the gateway should...

(UNLIKELY_OPENING_PUNCTUATION)


[typographical] ~374-~374: If the word ‘What’ starts a question, add a question mark at the end of the sentence.
Context: ... contract upon revert. What Happens: - When the revert occurs, the gatewa...

(WP_VB_QUESTION_MARK)


[uncategorized] ~399-~399: Loose punctuation mark.
Context: ...ice ``` Parameters: - --contract: Address of the `Hello` contract on Zeta...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~400-~400: Loose punctuation mark.
Context: ...ocontract on ZetaChain. ---receiver: Address of the Echo` contract on the c...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~401-~401: Loose punctuation mark.
Context: ... on the connected EVM chain. - --zrc20: Address of the ZRC-20 token representin...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~401-~401: Possible missing comma found.
Context: ...ain. - --zrc20: Address of the ZRC-20 token representing the gas token of the con...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~403-~403: Loose punctuation mark.
Context: ...es the destination chain. - --function: Function signature to invoke on the `Ec...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~405-~405: Loose punctuation mark.
Context: ....g., "hello(string)"). - --network: Network to interact with (localhost f...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~406-~406: Loose punctuation mark.
Context: ... (localhost for localnet). - --types: ABI types of the message parameters. - ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~407-~407: Loose punctuation mark.
Context: ...pes of the message parameters. - alice: The message to send. ## Simulating a R...

(UNLIKELY_OPENING_PUNCTUATION)


[typographical] ~424-~424: If the word ‘What’ starts a question, add a question mark at the end of the sentence.
Context: ...pes '["uint256"]' 42 ``` What Happens: - The Echo contract expects a `str...

(WP_VB_QUESTION_MARK)


[uncategorized] ~449-~449: Loose punctuation mark.
Context: ... **Parameters:** ---revert-address: Address of the Hello` contract on Zeta...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~450-~450: Loose punctuation mark.
Context: ...tract on ZetaChain. - --revert-message: Data to pass to the Hello contract's ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~452-~452: Loose punctuation mark.
Context: ...Revert function. ---call-on-revert`: Flag indicating that the gateway should...

(UNLIKELY_OPENING_PUNCTUATION)


[typographical] ~455-~455: If the word ‘What’ starts a question, add a question mark at the end of the sentence.
Context: ... contract upon revert. What Happens: - Upon revert, the gateway calls the...

(WP_VB_QUESTION_MARK)


[uncategorized] ~479-~479: Loose punctuation mark.
Context: ...llo ``` Parameters: - --contract: Address of the `Hello` contract on Zeta...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~480-~480: Loose punctuation mark.
Context: ...ocontract on ZetaChain. ---receiver: Address of the Echo` contract on the c...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~481-~481: Loose punctuation mark.
Context: ... on the connected EVM chain. - --zrc20: Address of the ZRC-20 token representin...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~482-~482: Loose punctuation mark.
Context: ...ng the asset to withdraw. - --function: Function signature to invoke on the `Ec...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~483-~483: Loose punctuation mark.
Context: ...oke on the Echo contract. - --amount: Amount of tokens to withdraw. - `--netw...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~483-~483: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...e on the Echo contract. - --amount: Amount of tokens to withdraw. - --network: N...

(AMOUNTOF_TO_NUMBEROF)


[uncategorized] ~484-~484: Loose punctuation mark.
Context: ...unt of tokens to withdraw. - --network: Network to interact with. - --types: ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~485-~485: Loose punctuation mark.
Context: ...: Network to interact with. - --types`: ABI types of the message parameters. - ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~486-~486: Loose punctuation mark.
Context: ...pes of the message parameters. - hello: The message to send. ## Conclusion In...

(UNLIKELY_OPENING_PUNCTUATION)

🔇 Additional comments (5)
src/pages/developers/tutorials/hello.mdx (5)

7-23: Improved introduction and learning objectives.

The revised introduction and learning objectives provide a clearer context for the tutorial and set more specific expectations for the reader. This enhancement will help users better understand the purpose and outcomes of the tutorial.


28-31: Updated prerequisites for better preparation.

The addition of the "Getting Started with ZetaChain" tutorial as a prerequisite ensures that users have the necessary foundational knowledge before beginning this more advanced tutorial. This change will help users be better prepared for the concepts introduced in this tutorial.


35-41: Clear environment setup instructions.

The "Set Up Your Environment" section provides concise and easy-to-follow instructions for cloning the repository and installing dependencies. This clarity ensures a smooth start to the tutorial for users.


Line range hint 215-257: Well-structured EVM Echo Contract example.

The Echo contract serves as an excellent example of how to interact with ZetaChain from an EVM-compatible chain. The explanation is clear and concise, and the contract includes essential functions for handling cross-chain communication. This section provides valuable insights for developers looking to implement cross-chain functionality.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~155-~155: Loose punctuation mark.
Context: ...oming data, which includes: - context: A zContext struct containing: - `or...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~158-~158: Loose punctuation mark.
Context: ...n the connected chain. - chainID: The integer ID of the connected chain f...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~160-~160: Loose punctuation mark.
Context: ...-chain call originated. - sender: Reserved for future use (currently empt...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~161-~161: Loose punctuation mark.
Context: ... future use (currently empty). - zrc20: The address of the ZRC-20 token represe...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~163-~163: Loose punctuation mark.
Context: ...sset from the source chain. - amount: The number of tokens transferred. - `me...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~164-~164: Loose punctuation mark.
Context: ...umber of tokens transferred. - message: The encoded data payload. Within `onCr...

(UNLIKELY_OPENING_PUNCTUATION)


490-506: Effective conclusion and valuable source code reference.

The conclusion succinctly summarizes the key points covered in the tutorial, reinforcing the learning objectives. The inclusion of a link to the source code repository is a valuable addition, allowing users to explore the complete implementation and potentially contribute to the project.

@fadeev
Copy link
Member Author

fadeev commented Oct 8, 2024

@bbbeeeee @zeta-chain/fullstack @brewmaster012 please, review.

Copy link
Member

@hernan-clich hernan-clich left a comment

Choose a reason for hiding this comment

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

Tested ACK

@fadeev fadeev merged commit 0775a2a into main Oct 15, 2024
6 checks passed
@fadeev fadeev deleted the hello-echo-tutorial branch October 15, 2024 16:55
@coderabbitai coderabbitai bot mentioned this pull request Nov 28, 2024
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.

2 participants