diff --git a/packages/excubiae/contracts/Excubia.sol b/packages/excubiae/contracts/Excubia.sol index 47e728d..9c70cf0 100644 --- a/packages/excubiae/contracts/Excubia.sol +++ b/packages/excubiae/contracts/Excubia.sol @@ -17,12 +17,13 @@ abstract contract Excubia is IExcubia, Ownable(msg.sender) { /// @dev Modifier to restrict function calls to only from the gate address. modifier onlyGate() { - if (msg.sender == gate) revert GateOnly(); + if (msg.sender != gate) revert GateOnly(); _; } /// @inheritdoc IExcubia function setGate(address _gate) public virtual onlyOwner { + if (_gate == address(0)) revert ZeroAddress(); if (gate != address(0)) revert GateAlreadySet(); _setGate(_gate); diff --git a/packages/excubiae/contracts/IExcubia.sol b/packages/excubiae/contracts/IExcubia.sol index 0e31164..4c1f3e9 100644 --- a/packages/excubiae/contracts/IExcubia.sol +++ b/packages/excubiae/contracts/IExcubia.sol @@ -9,6 +9,9 @@ interface IExcubia { /// @param gate The address of the excubia-protected contract address. event GatePassed(address indexed passerby, address indexed gate); + /// @notice Error thrown when an address is zero. + error ZeroAddress(); + /// @notice Error thrown when the gate address is not set. error GateNotSet();