Skip to content

Commit

Permalink
chore: organize and add interface
Browse files Browse the repository at this point in the history
  • Loading branch information
stevennevins committed Oct 23, 2024
1 parent 7213174 commit 38dca52
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 33 deletions.
45 changes: 45 additions & 0 deletions src/interfaces/ISlasher.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.12;

import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {IAllocationManager} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";

interface ISlasherEvents {
event SlashingRequested(
uint256 indexed requestId,
address indexed operator,
uint32 indexed operatorSetId,
uint256 wadToSlash,
string description
);

event SlashingRequestCancelled(uint256 indexed requestId);

event OperatorSlashed(
uint256 indexed slashingRequestId,
address indexed operator,
uint32 indexed operatorSetId,
IStrategy[] strategies,
uint256 wadToSlash,
string description
);
}

interface ISlasherTypes {
enum SlashingStatus {
Null,
Requested,
Completed,
Cancelled
}

struct SlashingRequest {
IAllocationManager.SlashingParams params;
uint256 requestTimestamp;
SlashingStatus status;
}

}

interface ISlasher is ISlasherEvents, ISlasherTypes{}
2 changes: 1 addition & 1 deletion src/slashers/InstantSlasher.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ contract InstantSlasher is SlasherBase {
_;
}

function initialize(address _serviceManager, address _slasher) public initializer {
function initialize(address _serviceManager, address _slasher) external initializer {
__SlasherBase_init(_serviceManager);
slasher = _slasher;
}
Expand Down
16 changes: 0 additions & 16 deletions src/slashers/VetoableSlasher.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,12 @@ import {SlasherBase} from "./base/SlasherBase.sol";
import {IAllocationManager} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";

contract VetoableSlashing is SlasherBase {
struct SlashingRequest {
IAllocationManager.SlashingParams params;
uint256 requestTimestamp;
SlashingStatus status;
}

uint256 public constant VETO_PERIOD = 3 days;
address public vetoCommittee;
address public slasher;
uint256 public nextRequestId;
mapping(uint256 => SlashingRequest) public slashingRequests;

event SlashingRequested(
uint256 indexed requestId,
address indexed operator,
uint32 indexed operatorSetId,
uint256 wadToSlash,
string description
);

event SlashingRequestCancelled(uint256 indexed requestId);

modifier onlyVetoCommittee() {
require(msg.sender == vetoCommittee, "VetoableSlashing: caller is not the veto committee");
_;
Expand Down
15 changes: 0 additions & 15 deletions src/slashers/base/SlasherBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,6 @@ import {IAllocationManagerTypes, IAllocationManager} from "eigenlayer-contracts/
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";

abstract contract SlasherBase is Initializable, SlasherStorage {
enum SlashingStatus {
Null,
Requested,
Completed,
Cancelled
}

event OperatorSlashed(
uint256 indexed slashingRequestId,
address indexed operator,
uint32 indexed operatorSetId,
IStrategy[] strategies,
uint256 wadToSlash,
string description
);

function __SlasherBase_init(address _serviceManager) internal onlyInitializing {
serviceManager = _serviceManager;
Expand Down
3 changes: 2 additions & 1 deletion src/slashers/base/SlasherStorage.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.12;

contract SlasherStorage {
import {ISlasher} from "../../interfaces/ISlasher.sol";
contract SlasherStorage is ISlasher {
address public serviceManager;

uint256[49] private __gap;
Expand Down

0 comments on commit 38dca52

Please sign in to comment.