-
Notifications
You must be signed in to change notification settings - Fork 148
docs: add Sui commands #553
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
📝 WalkthroughWalkthroughThis pull request updates the tutorial documentation and the Swap contract. In the tutorials (call.mdx and hello.mdx), deployment commands and contract addresses have been updated to reflect a new gateway and consistent contract addresses for the Connected and Universal contracts. The Swap contract (swap.mdx) has been modified to include a new boolean parameter ( Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant S as Swap Contract
U->>S: swap(inputToken, amount, targetToken, recipient, withdrawFlag)
S->>S: Evaluate handleGasAndSwap(inputToken, amount, targetToken, withdrawFlag)
alt withdraw is true
S->>S: Retrieve gas fee and adjust swapAmount
else
S->>S: Process swap without fee adjustment
end
U->>S: onRevert triggers handleGasAndSwap(withdraw=true)
Possibly related PRs
Suggested reviewers
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 (
|
|
@hernan-clich 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: 0
🧹 Nitpick comments (2)
src/pages/developers/tutorials/swap.mdx (2)
253-275: Refined Gas Fee and Swap Logic
The internal logic ofhandleGasAndSwaphas been updated to conditionally calculate the gas fee and adjust the swap amount based on thewithdrawflag. This enhancement ensures that sufficient tokens are reserved to cover gas fees when a withdrawal is intended. Consider adding inline comments or emitting events to facilitate debugging of these computations in a live environment.
667-677: Introduction of SUI-Specific Commands for Solana
New commands for “Swapping SUI for Solana SOL” have been added. Note that the example includes a specific mnemonic (grape subway rack mean march bubble carry avoid muffin consider thing street). Please ensure that this is clearly indicated as a test mnemonic and is not used in production. Additionally, verify that the gateway and module addresses are up-to-date and secure.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/pages/developers/tutorials/call.mdx(6 hunks)src/pages/developers/tutorials/hello.mdx(2 hunks)src/pages/developers/tutorials/swap.mdx(10 hunks)
🔇 Additional comments (15)
src/pages/developers/tutorials/hello.mdx (2)
116-116: Updated Universal Contract Address
The output now shows the Universal contract address as0x8198f5d8F8CfFE8f9C413d98a0A55aEB8ab9FbB7. Please ensure that this new address is consistently reflected across all related documentation and deployment scripts.
127-128: Consistent Gateway and Receiver in evm-call Command
Thenpx hardhat evm-callcommand now uses the updated gateway address (0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0) and receiver address (0x8198f5d8F8CfFE8f9C413d98a0A55aEB8ab9FbB7). Verify that these values correctly match the intended deployment environment and are in sync with the changes made in the other tutorials.src/pages/developers/tutorials/call.mdx (6)
424-427: Updated Deployment Command for Connected Contract
The deployment command now uses the new gateway address (0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0) for the Connected contract. Confirm that this change aligns with the updated infrastructure and that any references in auxiliary documentation or scripts are updated accordingly.
435-436: Revised Universal Contract Deployment Output
The Universal contract’s output now reflects the updated address0x8198f5d8F8CfFE8f9C413d98a0A55aEB8ab9FbB7. This change is consistent with the modifications made in thehello.mdxfile.
439-441: Updated Connected Contract Deployment Output
The Connected contract now deploys with the address0x0355B7B8cb128fA5692729Ab3AAa199C1753f726. Please double-check that this new address is correctly utilized in subsequent command examples and user instructions throughout the documentation.
454-455: Consistent Address Updates in Connected-Call Command
Thenpx hardhat connected-callcommand now references the updated Connected contract address (0x0355B7B8cb128fA5692729Ab3AAa199C1753f726) and the Universal receiver address (0x8198f5d8F8CfFE8f9C413d98a0A55aEB8ab9FbB7). This ensures proper cross-chain interactions.
469-470: Consistent Address Updates in Universal-Call Command
The universal-call command has been updated to use the correct contract address (0x8198f5d8F8CfFE8f9C413d98a0A55aEB8ab9FbB7) and receiver (0x0355B7B8cb128fA5692729Ab3AAa199C1753f726). Please verify that these changes result in seamless cross-chain interactions.
484-485: Address Alignment in Withdraw-and-Call Command
Thewithdraw-and-callcommand now consistently uses the updated Universal contract address (0x8198f5d8F8CfFE8f9C413d98a0A55aEB8ab9FbB7) and the Connected contract address (0x0355B7B8cb128fA5692729Ab3AAa199C1753f726). Ensure that the command parameters align with the new deployment configuration.src/pages/developers/tutorials/swap.mdx (7)
179-181: Updated onCall Parameter Passing in Swap Contract
In theonCallfunction, the call tohandleGasAndSwaphas been updated to passparams.targetandparams.withdrawcorrectly. This modification is critical for ensuring that the swap logic respects the new withdrawal flag. Make sure that the decoding logic continues to extract parameters correctly from the incoming message.
217-219: Consistent Parameter Update in swap Function
Within theswapfunction, thewithdrawFlagparameter is now forwarded tohandleGasAndSwap, aligning function calls with the updated signature. This ensures consistency in how the withdrawal condition is applied during the swap.
248-249: Extended handleGasAndSwap Signature
The signature ofhandleGasAndSwapnow includes thebool withdrawparameter. This change is pivotal for distinguishing between swaps that include a withdrawal operation and those that do not.
502-507: Updated Deployment Command for Swap Contract
The deployment command now includes parameters for--gatewayand--uniswap-router, ensuring that the Swap contract is configured with the correct external dependencies for liquidity and gas fee management. Verify that these addresses are correct for the testnet environment as documented.
682-686: Command for Swapping Solana SOL for SUI
The provided command illustrates how to swap Solana SOL for SUI tokens. Confirm that the flag usage (--receiver,--amount,--types, etc.) matches the CLI specification and that the command functions as intended during cross-chain operations.
695-702: Command for Swapping Solana SPL for SUI
The command for swapping Solana SPL tokens for SUI has been added. Ensure that parameters such as the mint information, sender and recipient addresses, and amounts are correctly formatted and conform to the expected input of the tool.
707-714: Command for Swapping SUI for Solana SPL
This command completes the set by enabling swaps from SUI back to Solana SPL tokens. Validate that the module and gateway addresses, as well as the boolean flag usage, are correctly implemented and that the parameters follow the CLI guidelines.
hernan-clich
left a comment
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