diff --git a/examples/swap/contracts/SwapToAnyToken.sol b/examples/swap/contracts/SwapToAnyToken.sol index ab98c70..4c25b08 100644 --- a/examples/swap/contracts/SwapToAnyToken.sol +++ b/examples/swap/contracts/SwapToAnyToken.sol @@ -92,12 +92,21 @@ contract SwapToAnyToken is UniversalContract { bytes memory recipient, bool withdrawFlag ) public { - IZRC20(inputToken).transferFrom(msg.sender, address(this), amount); + bool success = IZRC20(inputToken).transferFrom( + msg.sender, + address(this), + amount + ); + if (!success) { + revert TransferFailed(); + } + (uint256 out, address gasZRC20, uint256 gasFee) = handleGasAndSwap( inputToken, amount, targetToken ); + withdraw( Params({ target: targetToken,