Skip to content

Commit

Permalink
throw error
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev committed Nov 22, 2024
1 parent a279ac1 commit e111f44
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion examples/swap/contracts/SwapToAnyToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e111f44

Please sign in to comment.