Skip to content

Commit 20e2c67

Browse files
committed
fix(excubiae): missing and wrong checks for addresses
1 parent c65e16d commit 20e2c67

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/excubiae/contracts/Excubia.sol

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ abstract contract Excubia is IExcubia, Ownable(msg.sender) {
1717

1818
/// @dev Modifier to restrict function calls to only from the gate address.
1919
modifier onlyGate() {
20-
if (msg.sender == gate) revert GateOnly();
20+
if (msg.sender != gate) revert GateOnly();
2121
_;
2222
}
2323

2424
/// @inheritdoc IExcubia
2525
function setGate(address _gate) public virtual onlyOwner {
26+
if (_gate == address(0)) revert ZeroAddress();
2627
if (gate != address(0)) revert GateAlreadySet();
2728

2829
_setGate(_gate);

packages/excubiae/contracts/IExcubia.sol

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ interface IExcubia {
99
/// @param gate The address of the excubia-protected contract address.
1010
event GatePassed(address indexed passerby, address indexed gate);
1111

12+
/// @notice Error thrown when an address is zero.
13+
error ZeroAddress();
14+
1215
/// @notice Error thrown when the gate address is not set.
1316
error GateNotSet();
1417

0 commit comments

Comments
 (0)