diff --git a/examples/call/contracts/Universal.sol b/examples/call/contracts/Universal.sol index 5b9f6c05..df362796 100644 --- a/examples/call/contracts/Universal.sol +++ b/examples/call/contracts/Universal.sol @@ -11,10 +11,12 @@ contract Universal is UniversalContract { event HelloEvent(string, string); event RevertEvent(string, RevertContext); + error TransferFailed(); + error Unauthorized(); modifier onlyGateway() { - require(msg.sender == address(gateway), "Caller is not the gateway"); + if (msg.sender != address(gateway)) revert Unauthorized(); _; } diff --git a/examples/hello/contracts/Universal.sol b/examples/hello/contracts/Universal.sol index b83fc684..fa4920e9 100644 --- a/examples/hello/contracts/Universal.sol +++ b/examples/hello/contracts/Universal.sol @@ -7,9 +7,10 @@ contract Universal is UniversalContract { GatewayZEVM public immutable gateway; event HelloEvent(string, string); + error Unauthorized(); modifier onlyGateway() { - require(msg.sender == address(gateway), "Caller is not the gateway"); + if (msg.sender != address(gateway)) revert Unauthorized(); _; } diff --git a/examples/swap/contracts/Swap.sol b/examples/swap/contracts/Swap.sol index f8c1ebf5..d6c8ade1 100644 --- a/examples/swap/contracts/Swap.sol +++ b/examples/swap/contracts/Swap.sol @@ -17,9 +17,10 @@ contract Swap is UniversalContract { uint256 constant BITCOIN = 18332; error InvalidAddress(); + error Unauthorized(); modifier onlyGateway() { - require(msg.sender == address(gateway), "Caller is not the gateway"); + if (msg.sender != address(gateway)) revert Unauthorized(); _; } diff --git a/examples/swap/contracts/SwapToAnyToken.sol b/examples/swap/contracts/SwapToAnyToken.sol index 9642687b..d3022c99 100644 --- a/examples/swap/contracts/SwapToAnyToken.sol +++ b/examples/swap/contracts/SwapToAnyToken.sol @@ -16,10 +16,12 @@ contract SwapToAnyToken is UniversalContract { address public immutable uniswapRouter; GatewayZEVM public gateway; uint256 constant BITCOIN = 18332; + error InvalidAddress(); + error Unauthorized(); modifier onlyGateway() { - require(msg.sender == address(gateway), "Caller is not the gateway"); + if (msg.sender != address(gateway)) revert Unauthorized(); _; }