diff --git a/src/pages/developers/tutorials/call.mdx b/src/pages/developers/tutorials/call.mdx index d397ded4..0c86a51a 100644 --- a/src/pages/developers/tutorials/call.mdx +++ b/src/pages/developers/tutorials/call.mdx @@ -395,7 +395,7 @@ With localnet running, open a new terminal window to compile and deploy the ```bash npx hardhat compile --force npx hardhat deploy --name Universal --network localhost --gateway 0x5FC8d32690cc91D4c39d9d3abcBD16989F875707 -npx hardhat deploy --name Connected --json --network localhost --gateway 0x610178dA211FEF7D417bC0e6FeD39F05609AD788 +npx hardhat deploy --name Connected --network localhost --gateway 0x610178dA211FEF7D417bC0e6FeD39F05609AD788 ``` You should see output indicating the successful deployment of the contracts: @@ -404,12 +404,12 @@ You should see output indicating the successful deployment of the contracts: 🔑 Using account: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 🚀 Successfully deployed "Universal" contract on localhost. -📜 Contract address: 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB +📜 Contract address: 0xc351628EB244ec633d5f21fBD6621e1a683B1181 🔑 Using account: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 -🚀 Successfully deployed "Conntected" contract on localhost. -📜 Contract address: 0x9E545E3C0baAB3E08CdfD552C960A1050f373042 +🚀 Successfully deployed "Connected" contract on localhost. +📜 Contract address: 0xFD471836031dc5108809D173A067e8486B9047A3 ``` **Note**: The deployed contract addresses may differ in your environment. @@ -423,8 +423,8 @@ deployment: ```bash npx hardhat connected-call \ - --contract 0x9E545E3C0baAB3E08CdfD552C960A1050f373042 \ - --receiver 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB \ + --contract 0xFD471836031dc5108809D173A067e8486B9047A3 \ + --receiver 0xc351628EB244ec633d5f21fBD6621e1a683B1181 \ --network localhost \ --types '["string"]' alice ``` @@ -438,8 +438,8 @@ from your deployment: ```bash npx hardhat universal-call \ - --contract 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB \ - --receiver 0x9E545E3C0baAB3E08CdfD552C960A1050f373042 \ + --contract 0xc351628EB244ec633d5f21fBD6621e1a683B1181 \ + --receiver 0xFD471836031dc5108809D173A067e8486B9047A3 \ --zrc20 0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe \ --function "hello(string)" \ --network localhost \ @@ -453,11 +453,12 @@ app, run the following command: ```bash npx hardhat universal-withdraw-and-call \ - --contract 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB \ - --receiver 0x9E545E3C0baAB3E08CdfD552C960A1050f373042 \ - --zrc20 0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c \ + --contract 0xc351628EB244ec633d5f21fBD6621e1a683B1181 \ + --receiver 0xFD471836031dc5108809D173A067e8486B9047A3 \ + --zrc20 0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe \ --function "hello(string)" \ --amount 1 \ + --call-options-is-arbitrary-call \ --network localhost \ --types '["string"]' hello ``` diff --git a/src/pages/developers/tutorials/swap-any.mdx b/src/pages/developers/tutorials/swap-any.mdx index 9d36aecd..e4c1869e 100644 --- a/src/pages/developers/tutorials/swap-any.mdx +++ b/src/pages/developers/tutorials/swap-any.mdx @@ -338,7 +338,11 @@ Once your environment is set up, compile the contract and deploy it to localnet using the following command: ``` -yarn deploy-any:localnet +npx hardhat deploy \ + --name SwapToAnyToken \ + --network localhost \ + --gateway 0x5FC8d32690cc91D4c39d9d3abcBD16989F875707 \ + --uniswap-router 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0 ``` After deployment, you should see an output similar to this: @@ -347,7 +351,7 @@ After deployment, you should see an output similar to this: 🔑 Using account: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 🚀 Successfully deployed contract on localhost. -📜 Contract address: 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB +📜 Contract address: 0xc351628EB244ec633d5f21fBD6621e1a683B1181 ``` ## Swap and Withdraw Tokens to Connected Chain @@ -356,7 +360,13 @@ To swap tokens from a connected EVM chain and withdraw them to the destination chain, use the following command: ``` -npx hardhat swap-from-evm --network localhost --receiver 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB --amount 1 --target 0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c --recipient 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --withdraw true +npx hardhat swap-from-evm \ + --network localhost \ + --receiver 0xc351628EB244ec633d5f21fBD6621e1a683B1181 \ + --amount 1 \ + --target 0x05BA149A7bd6dC1F937fA9046A9e05C05f3b18b0 \ + --recipient 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \ + --withdraw true ``` - EVM gateway is called with 1 native gas token (ETH) and a message that @@ -376,7 +386,13 @@ If you want to swap tokens and keep them on ZetaChain rather than withdrawing them, set the `withdraw` flag. ``` -npx hardhat swap-from-evm --network localhost --receiver 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB --amount 1 --target 0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c --recipient 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --withdraw false +npx hardhat swap-from-evm \ + --network localhost \ + --receiver 0xc351628EB244ec633d5f21fBD6621e1a683B1181 \ + --amount 1 \ + --target 0x05BA149A7bd6dC1F937fA9046A9e05C05f3b18b0 \ + --recipient 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \ + --withdraw false ``` In the command above the `withdraw` is `false`, so the target ZRC-20 token will @@ -388,7 +404,14 @@ To swap a ZRC-20 token for another ZRC-20 on ZetaChain and withdraw to a connected chain, run: ``` -npx hardhat swap-from-zetachain --network localhost --contract 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB --amount 1 --target 0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe --recipient 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --zrc20 0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c --withdraw true +npx hardhat swap-from-zetachain \ + --network localhost \ + --contract 0xc351628EB244ec633d5f21fBD6621e1a683B1181 \ + --amount 1 \ + --target 0x65a45c57636f9BcCeD4fe193A602008578BcA90b \ + --recipient 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \ + --zrc20 0x05BA149A7bd6dC1F937fA9046A9e05C05f3b18b0 \ + --withdraw true ``` ## Swap on ZetaChain Without Withdrawing @@ -397,7 +420,14 @@ To swap a ZRC-20 token for another ZRC-20 on ZetaChain and transfer it to a recipient on ZetaChain, run: ``` -npx hardhat swap-from-zetachain --network localhost --contract 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB --amount 1 --target 0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe --recipient 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --zrc20 0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c --withdraw false +npx hardhat swap-from-zetachain \ + --network localhost \ + --contract 0xc351628EB244ec633d5f21fBD6621e1a683B1181 \ + --amount 1 \ + --target 0x65a45c57636f9BcCeD4fe193A602008578BcA90b \ + --recipient 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \ + --zrc20 0x05BA149A7bd6dC1F937fA9046A9e05C05f3b18b0 \ + --withdraw false ``` ## Conclusion @@ -413,4 +443,4 @@ on ZetaChain, providing greater flexibility for a variety of use cases. You can find the source code for this tutorial in the example contracts repository: -https://github.com/zeta-chain/example-contracts/tree/main/examples/swap] +https://github.com/zeta-chain/example-contracts/tree/main/examples/swap diff --git a/src/pages/developers/tutorials/swap.mdx b/src/pages/developers/tutorials/swap.mdx index b552478f..9004c158 100644 --- a/src/pages/developers/tutorials/swap.mdx +++ b/src/pages/developers/tutorials/swap.mdx @@ -329,7 +329,11 @@ their native chain, whether it's an EVM chain or Bitcoin. ``` npx hardhat compile --force -npx hardhat deploy --gateway 0x6c533f7fe93fae114d0954697069df33c9b74fd7 --network zeta_testnet +  +npx hardhat deploy \ + --gateway 0x6c533f7fe93fae114d0954697069df33c9b74fd7 \ + --uniswap-router 0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe \ + --network zeta_testnet ``` ``` @@ -342,7 +346,7 @@ npx hardhat deploy --gateway 0x6c533f7fe93fae114d0954697069df33c9b74fd7 --networ ## Swap from Base Sepolia to Polygon Amoy ``` -npx hardhat evm-deposit-and-call +npx hardhat evm-deposit-and-call \ --receiver 0x162CefCe314726698ac1Ee5895a6c392ba8e20d3 \ --amount 0.001 \ --network base_sepolia \ @@ -363,7 +367,11 @@ npx hardhat localnet Compile the contract and deploy it to localnet by running: ``` -yarn deploy:localnet +npx hardhat deploy \ + --name Swap \ + --network localhost \ + --gateway 0x5FC8d32690cc91D4c39d9d3abcBD16989F875707 \ + --uniswap-router 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0 ``` You should see output similar to: @@ -372,7 +380,7 @@ You should see output similar to: 🔑 Using account: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 🚀 Successfully deployed contract on localhost. -📜 Contract address: 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB +📜 Contract address: 0xc351628EB244ec633d5f21fBD6621e1a683B1181 ``` ## Swapping Gas Tokens for ERC-20 Tokens @@ -380,7 +388,12 @@ You should see output similar to: To swap gas tokens for ERC-20 tokens, run the following command: ``` -npx hardhat swap-from-evm --network localhost --receiver 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB --amount 1 --target 0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c --recipient 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 +npx hardhat swap-from-evm \ + --network localhost \ + --receiver 0xc351628EB244ec633d5f21fBD6621e1a683B1181 \ + --amount 1 \ + --target 0x05BA149A7bd6dC1F937fA9046A9e05C05f3b18b0 \ + --recipient 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 ``` This script deposits tokens into the gateway on a connected EVM chain and sends @@ -410,7 +423,13 @@ To swap ERC-20 tokens for gas tokens, adjust the command by specifying the ERC-20 token you're swapping from using the `--erc20` parameter: ``` -npx hardhat swap-from-evm --network localhost --receiver 0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB --amount 1 --target 0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe --recipient 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --erc20 0x0B306BF915C4d645ff596e518fAf3F9669b97016 +npx hardhat swap-from-evm \ + --network localhost \ + --receiver 0xc351628EB244ec633d5f21fBD6621e1a683B1181 \ + --amount 1 \ + --target 0x05BA149A7bd6dC1F937fA9046A9e05C05f3b18b0 \ + --recipient 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \ + --erc20 0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E ``` Here, the `--erc20` option specifies the ERC-20 token address you're swapping @@ -443,4 +462,4 @@ token approvals in cross-chain swaps. You can find the source code for the tutorial in the example contracts repository: -[https://github.com/zeta-chain/example-contracts/tree/main/examples/swap](https://github.com/zeta-chain/example-contracts/tree/main/examples/swap) +https://github.com/zeta-chain/example-contracts/tree/main/examples/swap