diff --git a/examples/swap/.gitignore b/examples/swap/.gitignore index 34db758f..6b0b33c5 100644 --- a/examples/swap/.gitignore +++ b/examples/swap/.gitignore @@ -17,3 +17,5 @@ cache_forge access_token localnet.json + +test-ledger \ No newline at end of file diff --git a/examples/swap/scripts/localnet.sh b/examples/swap/scripts/localnet.sh index af5259b7..6d43f499 100755 --- a/examples/swap/scripts/localnet.sh +++ b/examples/swap/scripts/localnet.sh @@ -39,54 +39,54 @@ npx hardhat localnet:solana-deposit-and-call \ npx hardhat localnet-check -# npx hardhat companion-swap \ -# --network localhost \ -# --contract "$COMPANION" \ -# --universal-contract "$CONTRACT_SWAP" \ -# --amount 1 \ -# --target "$ZRC20_BNB" \ -# --recipient "$SENDER" - -# npx hardhat localnet-check - -# npx hardhat companion-swap \ -# --network localhost \ -# --contract "$COMPANION" \ -# --universal-contract "$CONTRACT_SWAP" \ -# --amount 1 \ -# --erc20 "$USDC_ETHEREUM" \ -# --target "$ZRC20_BNB" \ -# --recipient "$SENDER" - -# npx hardhat localnet-check - -# npx hardhat evm-swap \ -# --network localhost \ -# --receiver "$CONTRACT_SWAP" \ -# --amount 1 \ -# --target "$ZRC20_BNB" \ -# --recipient "$SENDER" - -# npx hardhat localnet-check - -# npx hardhat evm-swap \ -# --network localhost \ -# --receiver "$CONTRACT_SWAP" \ -# --amount 1 \ -# --target "$ZRC20_BNB" \ -# --recipient "$SENDER" \ -# --withdraw false - -# npx hardhat localnet-check - -# npx hardhat zetachain-swap \ -# --network localhost \ -# --contract "$CONTRACT_SWAP" \ -# --amount 1 \ -# --zrc20 "$ZRC20_BNB" \ -# --target "$ZRC20_ETHEREUM" \ -# --recipient "$SENDER" - -# npx hardhat localnet-check +npx hardhat companion-swap \ + --network localhost \ + --contract "$COMPANION" \ + --universal-contract "$CONTRACT_SWAP" \ + --amount 1 \ + --target "$ZRC20_BNB" \ + --recipient "$SENDER" + +npx hardhat localnet-check + +npx hardhat companion-swap \ + --network localhost \ + --contract "$COMPANION" \ + --universal-contract "$CONTRACT_SWAP" \ + --amount 1 \ + --erc20 "$USDC_ETHEREUM" \ + --target "$ZRC20_BNB" \ + --recipient "$SENDER" + +npx hardhat localnet-check + +npx hardhat evm-swap \ + --network localhost \ + --receiver "$CONTRACT_SWAP" \ + --amount 1 \ + --target "$ZRC20_BNB" \ + --recipient "$SENDER" + +npx hardhat localnet-check + +npx hardhat evm-swap \ + --network localhost \ + --receiver "$CONTRACT_SWAP" \ + --amount 1 \ + --target "$ZRC20_BNB" \ + --recipient "$SENDER" \ + --withdraw false + +npx hardhat localnet-check + +npx hardhat zetachain-swap \ + --network localhost \ + --contract "$CONTRACT_SWAP" \ + --amount 1 \ + --zrc20 "$ZRC20_BNB" \ + --target "$ZRC20_ETHEREUM" \ + --recipient "$SENDER" + +npx hardhat localnet-check if [ "$1" = "start" ]; then npx hardhat localnet-stop; fi \ No newline at end of file diff --git a/examples/swap/tasks/companionSwap.ts b/examples/swap/tasks/companionSwap.ts index 07e35482..34c165c5 100644 --- a/examples/swap/tasks/companionSwap.ts +++ b/examples/swap/tasks/companionSwap.ts @@ -8,7 +8,9 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { const factory = (await hre.ethers.getContractFactory("SwapCompanion")) as any; const contract = factory.attach(args.contract).connect(signer); - const recipient = hre.ethers.utils.toUtf8Bytes(args.recipient); + const recipient = hre.ethers.utils.isAddress(args.recipient) + ? args.recipient + : hre.ethers.utils.toUtf8Bytes(args.recipient); let tx; if (args.erc20) { const erc20Contract = new ethers.Contract(