Skip to content

Commit debf97e

Browse files
committed
docs: natspec
1 parent e164eb3 commit debf97e

File tree

1 file changed

+51
-27
lines changed

1 file changed

+51
-27
lines changed

src/interfaces/ISlasher.sol

Lines changed: 51 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,78 @@ import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy
55
import {IAllocationManager} from
66
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
77

8-
interface ISlasherEvents {
9-
event SlashingRequested(
10-
uint256 indexed requestId,
11-
address indexed operator,
12-
uint32 indexed operatorSetId,
13-
uint256[] wadsToSlash,
14-
string description
15-
);
16-
17-
event SlashingRequestCancelled(uint256 indexed requestId);
18-
19-
event OperatorSlashed(
20-
uint256 indexed slashingRequestId,
21-
address indexed operator,
22-
uint32 indexed operatorSetId,
23-
uint256[] wadsToSlash,
24-
string description
25-
);
26-
}
27-
288
interface ISlasherErrors {
29-
/// @dev Thrown when the caller is not the veto committee
9+
/// @notice Thrown when a caller without veto committee privileges attempts a restricted operation.
3010
error OnlyVetoCommittee();
31-
/// @dev Thrown when the caller is not the slasher
11+
/// @notice Thrown when a caller without slasher privileges attempts a restricted operation.
3212
error OnlySlasher();
33-
/// @dev Thrown when the veto period has passed
13+
/// @notice Thrown when attempting to veto a slashing request after the veto period has expired.
3414
error VetoPeriodPassed();
35-
/// @dev Thrown when the veto period has not passed
15+
/// @notice Thrown when attempting to execute a slashing request before the veto period has ended.
3616
error VetoPeriodNotPassed();
37-
/// @dev Thrown when the slashing request is cancelled
17+
/// @notice Thrown when attempting to interact with a slashing request that has been cancelled.
3818
error SlashingRequestIsCancelled();
39-
/// @dev Thrown when the slashing request was not already requested
19+
/// @notice Thrown when attempting to modify a slashing request that does not exist.
4020
error SlashingRequestNotRequested();
4121
}
4222

4323
interface ISlasherTypes {
24+
/// @notice Represents the current status of a slashing request.
25+
/// @dev The status of a slashing request can be one of the following:
26+
/// - Null: Default state, no request exists.
27+
/// - Requested: Slashing has been requested but not yet executed.
28+
/// - Completed: Slashing has been successfully executed.
29+
/// - Cancelled: Slashing request was cancelled by veto committee.
4430
enum SlashingStatus {
4531
Null,
4632
Requested,
4733
Completed,
4834
Cancelled
4935
}
5036

37+
/// @notice Contains all information related to a slashing request.
38+
/// @param params The slashing parameters from the allocation manager.
39+
/// @param requestTimestamp The timestamp when the slashing request was created.
40+
/// @param status The current status of the slashing request.
5141
struct SlashingRequest {
5242
IAllocationManager.SlashingParams params;
5343
uint256 requestTimestamp;
5444
SlashingStatus status;
5545
}
5646
}
5747

58-
interface ISlasher is ISlasherEvents, ISlasherTypes, ISlasherErrors {}
48+
interface ISlasherEvents is ISlasherTypes {
49+
/// @notice Emitted when a new slashing request is created.
50+
/// @param requestId The unique identifier for the slashing request (indexed).
51+
/// @param operator The address of the operator to be slashed (indexed).
52+
/// @param operatorSetId The ID of the operator set involved (indexed).
53+
/// @param wadsToSlash The amounts to slash from each strategy.
54+
/// @param description A human-readable description of the slashing reason.
55+
event SlashingRequested(
56+
uint256 indexed requestId,
57+
address indexed operator,
58+
uint32 indexed operatorSetId,
59+
uint256[] wadsToSlash,
60+
string description
61+
);
62+
63+
/// @notice Emitted when a slashing request is cancelled by the veto committee.
64+
/// @param requestId The unique identifier of the cancelled request (indexed).
65+
event SlashingRequestCancelled(uint256 indexed requestId);
66+
67+
/// @notice Emitted when an operator is successfully slashed.
68+
/// @param slashingRequestId The ID of the executed slashing request (indexed).
69+
/// @param operator The address of the slashed operator (indexed).
70+
/// @param operatorSetId The ID of the operator set involved (indexed).
71+
/// @param wadsToSlash The amounts slashed from each strategy.
72+
/// @param description A human-readable description of why the operator was slashed.
73+
event OperatorSlashed(
74+
uint256 indexed slashingRequestId,
75+
address indexed operator,
76+
uint32 indexed operatorSetId,
77+
uint256[] wadsToSlash,
78+
string description
79+
);
80+
}
81+
82+
interface ISlasher is ISlasherErrors, ISlasherEvents {}

0 commit comments

Comments
 (0)