-
Notifications
You must be signed in to change notification settings - Fork 61
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
Fix Call example on localnet #510
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
📝 Walkthrough📝 WalkthroughWalkthroughThis pull request introduces modifications to the tutorials for deploying contracts for cross-chain interactions using ZetaChain. Key updates include corrections to typos in deployment commands, accurate contract addresses for the Changes
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🔇 Additional comments (4)src/pages/developers/tutorials/swap-any.mdx (4)
The command is clear, properly formatted, and includes all necessary parameters for local deployment.
The example output clearly shows the deployed contract address format.
The commands are functionally correct but could benefit from consistent formatting. Consider using the multi-line format with line continuations for all commands to improve readability. Example format: npx hardhat swap-from-evm \
--network localhost \
--receiver 0xc351628EB244ec633d5f21fBD6621e1a683B1181 \
--amount 1 \
--target 0x05BA149A7bd6dC1F937fA9046A9e05C05f3b18b0 \
--recipient 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \
--withdraw true Also applies to: 321-327, 339-346, 355-362
The source code URL points to the main branch, which may change over time. Consider referencing a specific commit hash or release tag to ensure users access the correct version of the code. 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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 (1)
src/pages/developers/tutorials/call.mdx (1)
461-461
: Document the purpose of the arbitrary call flag.The
--call-options-is-arbitrary-call
flag has been added, but its purpose and implications aren't explained in the tutorial. Consider adding a brief explanation of when and why this flag should be used.Here's a suggested addition to the documentation:
--network localhost \ + # The --call-options-is-arbitrary-call flag indicates that this is an arbitrary cross-chain call + # rather than an authenticated call. This is required when calling specific functions on the target contract. --call-options-is-arbitrary-call \ --types '["string"]' hello
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
src/pages/developers/tutorials/call.mdx
(5 hunks)
🔇 Additional comments (2)
src/pages/developers/tutorials/call.mdx (2)
398-398
: LGTM: Contract deployment commands and addresses are accurate.
The gateway addresses and deployment commands are correctly configured for the localnet environment.
Also applies to: 407-407, 411-412
426-427
: LGTM: Contract interaction commands are properly structured.
The contract addresses are consistent with the deployment output, and the commands include all necessary parameters.
Also applies to: 441-442, 456-458
@bbbeeeee @brewmaster012 @zeta-chain/fullstack please, review. |
There was a problem hiding this 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
🧹 Outside diff range and nitpick comments (2)
src/pages/developers/tutorials/swap-any.mdx (1)
291-297
: Enhance example commands with varied scenariosThe example commands use identical addresses for the recipient across all scenarios. Consider:
- Using different recipient addresses to better illustrate real-world usage
- Adding comments explaining the expected token flows
- Including examples with different token amounts
Also applies to: 317-323, 335-342, 351-358
src/pages/developers/tutorials/swap.mdx (1)
326-331
: Enhance command documentation with token detailsThe swap commands have been updated with new contract and token addresses. To improve clarity, consider:
- Adding comments to explain what each token address represents (e.g., which token is 0x05BA149A7bd6dC1F937fA9046A9e05C05f3b18b0)
- Including expected output or transaction results
- Adding error handling scenarios
Add a table or code comments in this format:
| Parameter | Value | Description | |-----------|-------|-------------| | --target | 0x05BA... | ZRC-20 USDC token on ZetaChain | | --erc20 | 0xE6E3... | USDC token on the source chain |Also applies to: 361-367
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
src/pages/developers/tutorials/swap-any.mdx
(7 hunks)src/pages/developers/tutorials/swap.mdx
(6 hunks)
🔇 Additional comments (1)
src/pages/developers/tutorials/swap-any.mdx (1)
273-274
: Verify gateway and router addresses for localnet deployment
The deployment command uses hardcoded addresses. While these may be correct for localnet, it's important to ensure they are properly validated.
✅ Verification successful
The gateway and router addresses are correctly documented for localnet deployment
The addresses used in the deployment command are consistent with the documented contract addresses in the localnet environment:
- The Gateway EVM address (0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0) is documented in localnet.mdx
- These addresses are consistently used across multiple tutorial files (swap.mdx, swap-any.mdx, hello.mdx, call.mdx)
- The deployment command follows the established pattern used in other tutorial examples
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify if the gateway and router addresses are valid contract addresses on localnet
# Check if the addresses contain contract code
for addr in "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707" "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0"; do
rg -l "address.*${addr}" || echo "Address ${addr} not found in codebase"
done
Length of output: 641
Script:
#!/bin/bash
# Let's search for any mentions of these addresses in the tutorial file and related files
rg -l "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707|0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0"
# Let's also check if there are any other deployment examples or address patterns in tutorials
fd . src/pages/developers/tutorials -t f -e mdx --exec rg -l "npx hardhat deploy.*--network localhost"
# Check if there's any documentation about these addresses
fd . -t f -e md -e mdx --exec rg -l "localnet.*address|localhost.*address"
Length of output: 697
Script:
#!/bin/bash
# Let's check the content of localnet.mdx to see if these addresses are documented
rg -A 5 -B 5 "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707|0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0" src/pages/developers/tutorials/localnet.mdx
# Also check the context in other tutorial files
rg -A 5 -B 5 "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707|0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0" src/pages/developers/tutorials/*.mdx
# Check if there's any explanation about default addresses
rg "default.*address.*local|localhost.*default.*address" src/pages/developers/tutorials/*.mdx
Length of output: 6050
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested ACK
Summary by CodeRabbit
New Features
Connected
contract, with improved examples for withdrawing tokens and making calls.swap
function in theSwapToAnyToken
contract for direct token swaps on ZetaChain.SwapToAnyToken
contract, allowing users to choose between withdrawing swapped tokens or retaining them on ZetaChain.Bug Fixes