-
Notifications
You must be signed in to change notification settings - Fork 59
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
Update examples to use gateway and localnet #470
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughWalkthroughThe pull request introduces significant enhancements to the swap contract, renaming it from Changes
Possibly related PRsThe changes introduced in this pull request may be related to the following pull requests:
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 (2)
src/pages/developers/tutorials/swap-any.mdx (2)
206-250
: The explanations provide a comprehensive overview of the key differences between theSwap
andSwapToAnyToken
contracts.The explanations clearly articulate the purpose and functionality of the
withdraw
flag and how it impacts theonCrossChainCall
andswapAndWithdraw
functions. They also highlight the benefits of the newswap
function for direct interaction on ZetaChain.To further enhance clarity, consider adding a brief explanation of the
IWETH9
interface and its role in facilitating direct token transfers whenwithdraw
isfalse
.Tools
LanguageTool
[uncategorized] ~230-~230: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ... fee handling and simply swaps the full amount of tokens. Once the tokens are swapped...(AMOUNTOF_TO_NUMBEROF)
283-294
: The instructions for swapping tokens from a connected EVM chain and withdrawing them to the destination chain are well-explained.The provided command and the explanations of the required parameters make it easy for users to understand and execute the swap and withdrawal process.
To further improve clarity, consider adding a brief explanation of the
--types
parameter and its significance in encoding the function arguments.Tools
LanguageTool
[uncategorized] ~292-~292: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...he receiver address (the contract), the amount of tokens to swap, the target token add...(AMOUNTOF_TO_NUMBEROF)
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- src/pages/developers/frontend/bitcoin.mdx (1 hunks)
- src/pages/developers/reference/_meta.json (0 hunks)
- src/pages/developers/reference/transactions.mdx (0 hunks)
- src/pages/developers/tutorials/_meta.json (1 hunks)
- src/pages/developers/tutorials/hello.mdx (2 hunks)
- src/pages/developers/tutorials/swap-any.mdx (4 hunks)
- src/pages/developers/tutorials/swap-tss.mdx (1 hunks)
- src/pages/developers/tutorials/swap.mdx (4 hunks)
Files not reviewed due to no reviewable changes (2)
- src/pages/developers/reference/_meta.json
- src/pages/developers/reference/transactions.mdx
Additional context used
LanguageTool
src/pages/developers/tutorials/swap-any.mdx
[style] ~49-~49: The phrase “a variety of” may be wordy. To make your writing clearer, consider replacing it.
Context: ...y makes the contract more versatile for a variety of use cases. ```solidity // SPDX-License...(A_VARIETY_OF)
[uncategorized] ~230-~230: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ... fee handling and simply swaps the full amount of tokens. Once the tokens are swapped...(AMOUNTOF_TO_NUMBEROF)
[uncategorized] ~292-~292: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...he receiver address (the contract), the amount of tokens to swap, the target token add...(AMOUNTOF_TO_NUMBEROF)
[style] ~318-~318: The phrase “a variety of” may be wordy. To make your writing clearer, consider replacing it.
Context: ...hain, providing greater flexibility for a variety of use cases. ## Source Code You can fin...(A_VARIETY_OF)
src/pages/developers/tutorials/swap-tss.mdx
[typographical] ~7-
7: It appears that a comma is missing./components/shared"; In this tutorial you will create a cross-chain swap cont...
Context: ... } from "(DURING_THAT_TIME_COMMA)
[uncategorized] ~171-~171: Loose punctuation mark.
Context: ...ill hold two values: -address target
: target token ZRC-20 address. - `bytes t...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~172-~172: Loose punctuation mark.
Context: ...arget token ZRC-20 address. -bytes to
: recipient address on the destination ch...(UNLIKELY_OPENING_PUNCTUATION)
[formatting] ~172-~172: If the ‘because’ clause is essential to the meaning, do not use a comma before the clause.
Context: ...e destination chain. We're usingbytes
, because the recipient can be either on EVM (lik...(COMMA_BEFORE_BECAUSE)
[misspelling] ~178-~178: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...chain. For example, on Bitcoin there is a upper limit of 80 bytes, so you might w...(EN_A_VS_AN)
[uncategorized] ~179-~179: Possible missing comma found.
Context: ... in the most efficient way possible. On EVM don't have this limit, so it's fine to ...(AI_HYDRA_LEO_MISSING_COMMA)
[typographical] ~217-~217: It appears that a comma is missing.
Context: ...arget Token to Connected Chain At this point the contract has the requiredgasFee
...(DURING_THAT_TIME_COMMA)
[uncategorized] ~220-~220: Possible missing comma found.
Context: ...ken. To withdraw tokens to a connected chain you will be calling thewithdraw
meth...(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~332-~332: Possible missing comma found.
Context: ...om Sepolia to BNB on BNB chain. To send USDC specify the ERC-20 token contract addre...(AI_HYDRA_LEO_MISSING_COMMA)
src/pages/developers/tutorials/hello.mdx
[uncategorized] ~97-~97: Loose punctuation mark.
Context: ...eives the following inputs: -context
: is a struct of type [zContext
](http...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~102-~102: Loose punctuation mark.
Context: ... on a connected chain. -chainID
: integer ID of the connected chain from ...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~107-~107: Loose punctuation mark.
Context: ...connected chain on ZetaChain. -amount
: the amount of tokens that were sent to ...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~107-~107: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...ted chain on ZetaChain. -amount
: the amount of tokens that were sent to the univers...(AMOUNTOF_TO_NUMBEROF)
[uncategorized] ~189-~189: Loose punctuation mark.
Context: ...' alice ``` Parameters: ---receiver
: The address of the `Hello` contract on ...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~190-~190: Loose punctuation mark.
Context: ...ellocontract on ZetaChain. -
--types`: The ABI types of the message parameters...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~191-~191: Loose punctuation mark.
Context: ...pes of the message parameters. -alice
: The message to send. The EVM gateway p...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~257-~257: Loose punctuation mark.
Context: ...2 ``` Parameters: ---call-on-revert
: Informs the gateway to handle reverts. ...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~258-~258: Loose punctuation mark.
Context: ... to handle reverts. ---revert-address
: The address of theRevert
contract on...(UNLIKELY_OPENING_PUNCTUATION)
src/pages/developers/tutorials/swap.mdx
[uncategorized] ~188-~188: Loose punctuation mark.
Context: ... of information: -address target
: The ZRC-20 address of the target token ...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~189-~189: Loose punctuation mark.
Context: ...get token on ZetaChain. -bytes to
: The recipient's address on the destinat...(UNLIKELY_OPENING_PUNCTUATION)
[style] ~223-~223: Consider placing the discourse marker ‘first’ at the beginning of the sentence for more clarity.
Context: ...maintain. #### Swapping for Gas Token The contract first addresses the gas fee required for the ...(SENT_START_FIRST_PREMIUM)
Gitleaks
src/pages/developers/tutorials/swap-tss.mdx
366-366: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
Additional comments not posted (29)
src/pages/developers/tutorials/_meta.json (4)
8-8
: LGTM!The updated tutorial title provides clarity by specifying that the tutorial targets the local development environment. This change aligns well with the PR objective of updating examples to use localnet.
18-18
: LGTM!The updated tutorial title provides clarity by specifying that the tutorial targets the local development environment. This change aligns well with the PR objective of updating examples to use localnet.
23-23
: LGTM!The updated tutorial title provides clarity by specifying that the tutorial targets the local development environment and focuses on swapping any token. This change aligns well with the PR objective of updating examples to use localnet.
27-30
: LGTM!The updated tutorial description provides a more concise and clear explanation of the tutorial's focus on building and interacting with a universal app in a local development environment. This change aligns well with the PR objective of updating examples to use localnet.
src/pages/developers/frontend/bitcoin.mdx (1)
206-206
: LGTM!The change in the link target from "Staking" to "Swap" tutorial aligns with the PR objective of updating the examples to use the gateway and localnet features. The modification is appropriate and enhances the relevance of the instructions.
src/pages/developers/tutorials/swap-any.mdx (3)
Line range hint
52-202
: The updatedSwapToAnyToken
contract introduces valuable enhancements to support more flexible token swapping.The addition of the
withdraw
flag in theParams
struct and the corresponding updates to theonCrossChainCall
andswapAndWithdraw
functions enable users to choose whether to withdraw the swapped tokens to a connected chain or keep them on ZetaChain. This flexibility expands the contract's usability for various scenarios.Furthermore, the introduction of the
swap
function allows direct interaction with the contract on ZetaChain, eliminating the need for cross-chain calls when tokens are already on ZetaChain.These changes significantly improve the contract's versatility and cater to a wider range of use cases.
253-279
: The instructions for starting localnet and deploying theSwapToAnyToken
contract are clear and comprehensive.The provided commands and expected output make it easy for users to follow the steps and ensure a successful deployment.
298-310
: The instructions for swapping tokens and keeping them on ZetaChain using theswap
function are well-documented.The provided command and the explanations of the required parameters make it easy for users to understand and execute the token swap directly on ZetaChain.
src/pages/developers/tutorials/swap-tss.mdx (4)
85-164
: LGTM!The Solidity contract implementation for the cross-chain swap functionality is well-structured and follows best practices. The contract correctly inherits from the necessary contracts, defines the
Params
struct, and implements theonCrossChainCall
function to handle cross-chain calls. The decoding of the incoming message based on the source chain is handled appropriately, and theswapAndWithdraw
function is called with the correct parameters.
133-163
: LGTM!The
swapAndWithdraw
function implementation is well-structured and follows best practices. The function correctly retrieves the gas fee token address and amount, performs the necessary token swaps using the helper methods, approves the target token ZRC-20 contract to spend the gas fee amount, and calls thewithdraw
method with the appropriate parameters to send the tokens to the recipient on the connected chain.
249-266
: LGTM!The
main
function implementation in theinteract.ts
file is well-structured and follows best practices. The function correctly checks if the recipient is a valid Bitcoin address using thebech32.decode
method and encodes it asbytes
usingutils.solidityPack
if it is. If the recipient is not a valid Bitcoin address, it is assumed to be an EVM address, which is a reasonable assumption. TheprepareData
function call is updated appropriately to use thebytes
type for the recipient.
361-367
: LGTM!The instructions for sending Bitcoin to the TSS address with a memo are clear and concise. The memo format is well-defined, including the necessary information for the cross-chain swap, such as the omnichain contract address on ZetaChain, the target token address, and the recipient address. The target token address provided in the instructions is a valid Ethereum address.
Tools
Gitleaks
366-366: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
src/pages/developers/tutorials/hello.mdx (12)
2-2
: LGTM!The updated title accurately reflects the content of the tutorial.
5-6
: LGTM!The
Alert
component import is valid and likely used to inform users about the availability of the gateway.
10-11
: LGTM!The updated description accurately reflects the behavior of the universal app contract.
15-19
: LGTM!The updated learning objectives are clear, concise, and align with the content of the tutorial.
21-25
: LGTM!The
Alert
component is used effectively to inform users about the availability of the gateway on localnet and testnet. The message is clear and helps set the right expectations for users.
34-154
: LGTM!The instructions for setting up the environment and the explanations of the
Hello
andRevert
contracts are clear, detailed, and easy to follow. The tutorial covers the important aspects of the contracts and their usage in handling cross-chain messages and reverts.Tools
LanguageTool
[uncategorized] ~97-~97: Loose punctuation mark.
Context: ...eives the following inputs: -context
: is a struct of type [zContext
](http...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~102-~102: Loose punctuation mark.
Context: ... on a connected chain. -chainID
: integer ID of the connected chain from ...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~107-~107: Loose punctuation mark.
Context: ...connected chain on ZetaChain. -amount
: the amount of tokens that were sent to ...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~107-~107: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...ted chain on ZetaChain. -amount
: the amount of tokens that were sent to the univers...(AMOUNTOF_TO_NUMBEROF)
156-162
: LGTM!The instructions for starting localnet and deploying the contracts are clear and easy to follow.
164-280
: LGTM!The instructions for interacting with the
Hello
contract and simulating a revert scenario are clear and easy to follow. The tutorial effectively demonstrates the importance of specifying a revert address to handle reverts gracefully.Tools
LanguageTool
[uncategorized] ~189-~189: Loose punctuation mark.
Context: ...' alice ``` Parameters: ---receiver
: The address of the `Hello` contract on ...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~190-~190: Loose punctuation mark.
Context: ...ellocontract on ZetaChain. -
--types`: The ABI types of the message parameters...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~191-~191: Loose punctuation mark.
Context: ...pes of the message parameters. -alice
: The message to send. The EVM gateway p...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~257-~257: Loose punctuation mark.
Context: ...2 ``` Parameters: ---call-on-revert
: Informs the gateway to handle reverts. ...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~258-~258: Loose punctuation mark.
Context: ... to handle reverts. ---revert-address
: The address of theRevert
contract on...(UNLIKELY_OPENING_PUNCTUATION)
282-288
: LGTM!The instructions for handling the revert gracefully by specifying additional parameters to call the
Revert
contract on the source chain are clear and easy to follow. The tutorial effectively demonstrates how to use theRevert
contract to handle reverts gracefully.
289-302
: LGTM!The conclusion effectively summarizes the key learnings from the tutorial and emphasizes the importance of understanding how to manage cross-chain calls and handle reverts for building robust universal applications on ZetaChain.
303-307
: LGTM!Providing a link to the source code for the tutorial in the example contracts repo is helpful for users who want to explore the code further or use it as a reference.
97-258
: Skipping the static analysis hints.The static analysis hints provided by LanguageTool are false positives in this context. The loose punctuation marks are part of the Markdown formatting and do not require any changes. The usage of "amount of" with "tokens" is acceptable, as "tokens" can be considered a mass noun in this context.
Tools
LanguageTool
[uncategorized] ~97-~97: Loose punctuation mark.
Context: ...eives the following inputs: -context
: is a struct of type [zContext
](http...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~102-~102: Loose punctuation mark.
Context: ... on a connected chain. -chainID
: integer ID of the connected chain from ...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~107-~107: Loose punctuation mark.
Context: ...connected chain on ZetaChain. -amount
: the amount of tokens that were sent to ...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~107-~107: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...ted chain on ZetaChain. -amount
: the amount of tokens that were sent to the univers...(AMOUNTOF_TO_NUMBEROF)
[uncategorized] ~189-~189: Loose punctuation mark.
Context: ...' alice ``` Parameters: ---receiver
: The address of the `Hello` contract on ...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~190-~190: Loose punctuation mark.
Context: ...ellocontract on ZetaChain. -
--types`: The ABI types of the message parameters...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~191-~191: Loose punctuation mark.
Context: ...pes of the message parameters. -alice
: The message to send. The EVM gateway p...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~257-~257: Loose punctuation mark.
Context: ...2 ``` Parameters: ---call-on-revert
: Informs the gateway to handle reverts. ...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~258-~258: Loose punctuation mark.
Context: ... to handle reverts. ---revert-address
: The address of theRevert
contract on...(UNLIKELY_OPENING_PUNCTUATION)
src/pages/developers/tutorials/swap.mdx (5)
7-11
: LGTM!The introduction provides a clear and concise overview of the tutorial's objective. The example of swapping USDC from Ethereum to BTC on Bitcoin effectively illustrates the cross-chain swap functionality.
15-18
: LGTM!The learning objectives are well-structured and cover the essential aspects of the tutorial. Deploying the contract to localnet and interacting with it from a connected EVM blockchain will provide developers with a practical understanding of the swap functionality.
43-48
: LGTM!The alert message effectively communicates the tutorial's compatibility limitations and provides a helpful redirection to the "Swap on Testnet" tutorial for users seeking a testnet-compatible version. This information is crucial to set the right expectations and ensure a smooth learning experience.
Line range hint
71-181
: LGTM!The
Swap
contract implementation aligns with the tutorial's description and includes the necessary functionality for handling cross-chain token swaps. TheonCrossChainCall
function correctly decodes the incoming message based on the source chain, and theswapAndWithdraw
function handles the token swaps and withdrawals effectively. The usage of theGatewayZEVM
contract for withdrawing tokens to the connected chain is appropriate.Tools
LanguageTool
[uncategorized] ~188-~188: Loose punctuation mark.
Context: ... of information: -address target
: The ZRC-20 address of the target token ...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~189-~189: Loose punctuation mark.
Context: ...get token on ZetaChain. -bytes to
: The recipient's address on the destinat...(UNLIKELY_OPENING_PUNCTUATION)
[style] ~223-~223: Consider placing the discourse marker ‘first’ at the beginning of the sentence for more clarity.
Context: ...maintain. #### Swapping for Gas Token The contract first addresses the gas fee required for the ...(SENT_START_FIRST_PREMIUM)
258-261
: LGTM!The alert message offers a valuable clarification about the ZRC-20 contract's association with connected chains. It effectively explains that specifying the withdrawal chain is not necessary, as each ZRC-20 contract knows its associated chain. The example of ZRC-20 Ethereum USDC being withdrawable only to Ethereum strengthens the understanding of this concept.
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: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/pages/developers/tutorials/swap-any.mdx (4 hunks)
Additional context used
LanguageTool
src/pages/developers/tutorials/swap-any.mdx
[style] ~49-~49: The phrase “a variety of” may be wordy. To make your writing clearer, consider replacing it.
Context: ...y makes the contract more versatile for a variety of use cases. ```solidity // SPDX-License...(A_VARIETY_OF)
[uncategorized] ~230-~230: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ... fee handling and simply swaps the full amount of tokens. Once the tokens are swapped...(AMOUNTOF_TO_NUMBEROF)
[uncategorized] ~292-~292: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...he receiver address (the contract), the amount of tokens to swap, the target token add...(AMOUNTOF_TO_NUMBEROF)
[style] ~318-~318: The phrase “a variety of” may be wordy. To make your writing clearer, consider replacing it.
Context: ...hain, providing greater flexibility for a variety of use cases. ## Source Code You can fin...(A_VARIETY_OF)
Additional comments not posted (4)
src/pages/developers/tutorials/swap-any.mdx (4)
Line range hint
77-85
: TheParams
struct is well-defined and serves its purpose effectively.The struct provides a clear and organized way to store the necessary parameters for the contract's functionality. The field names are descriptive, and their types align with their intended usage.
133-149
: The conditional handling of gas fees based on thewithdraw
flag is implemented correctly.The code segment logically handles the gas fees depending on whether the tokens will be withdrawn or not. When
withdraw
is true, it calculates and deducts the gas fee as expected. Whenwithdraw
is false, it appropriately skips the gas fee handling and swaps the full token amount.
182-187
: The direct token transfer on ZetaChain whenwithdraw
is false is implemented correctly.The code segment appropriately transfers the swapped tokens directly to the recipient on ZetaChain when
withdraw
is false. Using theIWETH9
interface ensures compatibility with wrapped tokens, and the recipient address is correctly derived from the providedrecipient
bytes.
Line range hint
190-200
: Theswap
function is a valuable addition that allows direct token swaps on ZetaChain.The introduction of the
swap
function provides a convenient way for users to interact with the contract directly on ZetaChain, without the need for cross-chain calls. It takes the necessary parameters, including thewithdraw
flag, to determine the appropriate action after the swap. The function correctly transfers the input tokens from the sender to the contract before invokingswapAndWithdraw
to perform the swap and handle the withdrawal or direct transfer based on thewithdraw
flag.Tools
LanguageTool
[uncategorized] ~230-~230: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ... fee handling and simply swaps the full amount of tokens. Once the tokens are swapped...(AMOUNTOF_TO_NUMBEROF)
[uncategorized] ~292-~292: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...he receiver address (the contract), the amount of tokens to swap, the target token add...(AMOUNTOF_TO_NUMBEROF)
[style] ~318-~318: The phrase “a variety of” may be wordy. To make your writing clearer, consider replacing it.
Context: ...hain, providing greater flexibility for a variety of use cases. ## Source Code You can fin...(A_VARIETY_OF)
@bbbeeeee @andresaiello @zeta-chain/fullstack please, review. |
Depends on zeta-chain/example-contracts#199
Summary by CodeRabbit
Release Notes
New Features
withdraw
option, allowing users to choose whether to withdraw swapped tokens to a connected chain or keep them on ZetaChain.swap
function for direct token swaps on ZetaChain without cross-chain calls.Refactor
onCrossChainCall
andswapAndWithdraw
functions for improved flexibility and gas fee management based on thewithdraw
flag.