diff --git a/examples/call/contracts/Connected.sol b/examples/call/contracts/Connected.sol index 5cd333c..17d6350 100644 --- a/examples/call/contracts/Connected.sol +++ b/examples/call/contracts/Connected.sol @@ -14,6 +14,7 @@ contract Connected { event HelloEvent(string, string); error Unauthorized(); + error ApprovalFailed(); modifier onlyGateway() { if (msg.sender != address(gateway)) revert Unauthorized(); @@ -46,7 +47,9 @@ contract Connected { RevertOptions memory revertOptions ) external { IERC20(asset).safeTransferFrom(msg.sender, address(this), amount); - IERC20(asset).approve(address(gateway), amount); + if (!IERC20(asset).approve(address(gateway), amount)) { + revert ApprovalFailed(); + } gateway.deposit(receiver, amount, asset, revertOptions); }