Skip to content

Commit

Permalink
fix(excubiae): missing and wrong checks for addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
0xjei committed Jun 13, 2024
1 parent c65e16d commit 20e2c67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/excubiae/contracts/Excubia.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions packages/excubiae/contracts/IExcubia.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 20e2c67

Please sign in to comment.