Skip to content

Commit

Permalink
gateway revert
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev committed Nov 20, 2024
1 parent c89c6da commit 786d629
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion examples/call/contracts/Universal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
_;
}

Expand Down
3 changes: 2 additions & 1 deletion examples/hello/contracts/Universal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
_;
}

Expand Down
3 changes: 2 additions & 1 deletion examples/swap/contracts/Swap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
_;
}

Expand Down
4 changes: 3 additions & 1 deletion examples/swap/contracts/SwapToAnyToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
_;
}

Expand Down

0 comments on commit 786d629

Please sign in to comment.