Skip to content

Commit c8a8e16

Browse files
committed
feat: implement a slasher permission and forward call to AllocationManager
1 parent dad3d4d commit c8a8e16

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

src/ServiceManagerBase.sol

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,10 @@ abstract contract ServiceManagerBase is ServiceManagerBaseStorage {
3939
_;
4040
}
4141

42-
function _checkRewardsInitiator() internal view {
43-
require(
44-
msg.sender == rewardsInitiator,
45-
"ServiceManagerBase.onlyRewardsInitiator: caller is not the rewards initiator"
46-
);
42+
/// @notice only slasher can call functions with this modifier
43+
modifier onlySlasher() {
44+
_checkSlasher();
45+
_;
4746
}
4847

4948
/// @notice Sets the (immutable) `_registryCoordinator` address
@@ -84,6 +83,10 @@ abstract contract ServiceManagerBase is ServiceManagerBaseStorage {
8483
_avsDirectory.updateAVSMetadataURI(_metadataURI);
8584
}
8685

86+
function slashOperator(IAllocationManager.SlashingParams memory params) external onlySlasher {
87+
_allocationManager.slashOperator(params);
88+
}
89+
8790
/**
8891
* @notice Creates a new rewards submission to the EigenLayer RewardsCoordinator contract, to be split amongst the
8992
* set of stakers delegated to operators who are registered to this `avs`
@@ -421,4 +424,19 @@ abstract contract ServiceManagerBase is ServiceManagerBaseStorage {
421424
function avsDirectory() external view override returns (address) {
422425
return address(_avsDirectory);
423426
}
427+
428+
function _checkRewardsInitiator() internal view {
429+
require(
430+
msg.sender == rewardsInitiator,
431+
"ServiceManagerBase.onlyRewardsInitiator: caller is not the rewards initiator"
432+
);
433+
}
434+
435+
436+
function _checkSlasher() internal view {
437+
require(
438+
msg.sender == slasher,
439+
"ServiceManagerBase.onlySlasher: caller is not the slasher"
440+
);
441+
}
424442
}

0 commit comments

Comments
 (0)