diff --git a/omnichain/swap/contracts/Swap.sol b/omnichain/swap/contracts/Swap.sol index 00361c49..811564aa 100644 --- a/omnichain/swap/contracts/Swap.sol +++ b/omnichain/swap/contracts/Swap.sol @@ -31,20 +31,20 @@ contract Swap is zContract { bytes calldata message ) external virtual override onlySystem { uint32 targetChainID; - bytes memory recipient; + address recipient; uint256 minAmountOut; if (context.chainID == BITCOIN) { targetChainID = BytesHelperLib.bytesToUint32(message, 0); - recipient = BytesHelperLib.bytesToBech32Bytes(message, 4); + recipient = BytesHelperLib.bytesToAddress(message, 4); } else { ( uint32 targetChainID_, - bytes32 recipient_, + address recipient_, uint256 minAmountOut_ - ) = abi.decode(message, (uint32, bytes32, uint256)); + ) = abi.decode(message, (uint32, address, uint256)); targetChainID = targetChainID_; - recipient = abi.encodePacked(recipient_); + recipient = recipient_; minAmountOut = minAmountOut_; } @@ -69,6 +69,9 @@ contract Swap is zContract { if (gasFee >= outputAmount) revert NotEnoughToPayGasFee(); IZRC20(targetZRC20).approve(targetZRC20, gasFee); - IZRC20(targetZRC20).withdraw(recipient, outputAmount - gasFee); + IZRC20(targetZRC20).withdraw( + abi.encodePacked(recipient), + outputAmount - gasFee + ); } } diff --git a/omnichain/swap/tasks/deploy.ts b/omnichain/swap/tasks/deploy.ts index bdb943b4..a2157abe 100644 --- a/omnichain/swap/tasks/deploy.ts +++ b/omnichain/swap/tasks/deploy.ts @@ -34,7 +34,4 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { } }; -task("deploy", "Deploy the contract", main).addFlag( - "json", - "Output in JSON" -); \ No newline at end of file +task("deploy", "Deploy the contract", main).addFlag("json", "Output in JSON"); diff --git a/omnichain/swap/tasks/interact.ts b/omnichain/swap/tasks/interact.ts index 3db1ba27..7b59b193 100644 --- a/omnichain/swap/tasks/interact.ts +++ b/omnichain/swap/tasks/interact.ts @@ -16,7 +16,7 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { const data = prepareData( args.contract, - ["uint32", "bytes32", "uint256"], + ["uint32", "address", "uint256"], [targetChainID, args.recipient, minAmountOut] ); const to = getAddress("tss", hre.network.name);