Skip to content

Commit 66625e0

Browse files
committed
refactor(excubiae): enforce IExcubia contract interface implementation
1 parent 191df30 commit 66625e0

File tree

2 files changed

+19
-25
lines changed

2 files changed

+19
-25
lines changed

packages/excubiae/contracts/Excubia.sol

+4-21
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,19 @@
22
pragma solidity >=0.8.0 <0.9.0;
33

44
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
5+
import {IExcubia} from "./IExcubia.sol";
56

67
/// @title Excubia.
78
/// @notice Abstract base contract which can be extended to implement a specific excubia.
89
/// @dev Inherit from this contract and implement the `_check` method to define the custom gatekeeping logic.
9-
abstract contract Excubia is Ownable(msg.sender) {
10+
abstract contract Excubia is IExcubia, Ownable(msg.sender) {
1011
/// @notice The excubia-protected contract address.
1112
/// @dev The gate can be any contract address that requires a prior `_check`.
1213
/// For example, the gate is a semaphore group that requires the passerby
1314
/// to meet certain criteria before joining.
1415
address public gate;
1516

16-
/// @notice Event emitted when someone passes the `_check` method.
17-
/// @param passerby The address of those who have successfully passed the check.
18-
/// @param gate The address of the excubia-protected contract address.
19-
event GatePassed(address indexed passerby, address indexed gate);
20-
21-
/// @notice Error thrown when the gate address is not set.
22-
error GateNotSet();
23-
24-
/// @notice Error thrown when the gate address has been already set.
25-
error GateAlreadySet();
26-
27-
/// @notice Error thrown when access is denied by the excubia.
28-
error AccessDenied();
29-
30-
/// @notice Sets the gate address.
31-
/// @dev Only the owner can set the destination gate address.
32-
/// @param _gate The address of the contract to be set as the gate.
17+
/// @dev See {IExcubia-setGate}.
3318
function setGate(address _gate) public virtual onlyOwner {
3419
if (gate != address(0)) revert GateAlreadySet();
3520

@@ -42,9 +27,7 @@ abstract contract Excubia is Ownable(msg.sender) {
4227
gate = _gate;
4328
}
4429

45-
/// @notice Initiates the excubia's check and triggers the associated action if the check is passed.
46-
/// @dev Calls `_pass` to handle the logic of checking and passing the gate.
47-
/// @param data Additional data required for the check (e.g., encoded token identifier).
30+
/// @dev See {IExcubia-pass}.
4831
function pass(bytes memory data) public virtual {
4932
_pass(data);
5033
}
+15-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity >=0.8.0 <0.9.0;
33

4-
/// @title IExcubia
5-
/// @notice Interface for the excubia contract.
4+
/// @title IExcubia.
5+
/// @notice Excubia contract interface.
66
interface IExcubia {
77
/// @notice Event emitted when someone passes the `_check` method.
88
/// @param passerby The address of those who have successfully passed the check.
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 the gate address is not set.
13+
error GateNotSet();
14+
15+
/// @notice Error thrown when the gate address has been already set.
16+
error GateAlreadySet();
17+
18+
/// @notice Error thrown when access is denied by the excubia.
19+
error AccessDenied();
20+
1221
/// @notice Sets the gate address.
22+
/// @dev Only the owner can set the destination gate address.
1323
/// @param _gate The address of the contract to be set as the gate.
1424
function setGate(address _gate) external;
1525

1626
/// @notice Initiates the excubia's check and triggers the associated action if the check is passed.
17-
/// @param data Additional data required for the check.
18-
function open(bytes calldata data) external;
27+
/// @dev Calls `_pass` to handle the logic of checking and passing the gate.
28+
/// @param data Additional data required for the check (e.g., encoded token identifier).
29+
function pass(bytes memory data) external;
1930
}

0 commit comments

Comments
 (0)