@@ -6,6 +6,7 @@ import {ISignatureUtils} from "eigenlayer-contracts/src/contracts/interfaces/ISi
66import {IAVSDirectory} from "eigenlayer-contracts/src/contracts/interfaces/IAVSDirectory.sol " ;
77import {IRewardsCoordinator} from
88 "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol " ;
9+ import {IAllocationManager} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol " ;
910
1011import {ServiceManagerBaseStorage} from "./ServiceManagerBaseStorage.sol " ;
1112import {IServiceManager} from "./interfaces/IServiceManager.sol " ;
@@ -38,36 +39,39 @@ abstract contract ServiceManagerBase is ServiceManagerBaseStorage {
3839 _;
3940 }
4041
41- function _checkRewardsInitiator () internal view {
42- require (
43- msg .sender == rewardsInitiator,
44- "ServiceManagerBase.onlyRewardsInitiator: caller is not the rewards initiator "
45- );
42+ /// @notice only slasher can call functions with this modifier
43+ modifier onlySlasher () {
44+ _checkSlasher ();
45+ _;
4646 }
4747
4848 /// @notice Sets the (immutable) `_registryCoordinator` address
4949 constructor (
5050 IAVSDirectory __avsDirectory ,
5151 IRewardsCoordinator __rewardsCoordinator ,
5252 IRegistryCoordinator __registryCoordinator ,
53- IStakeRegistry __stakeRegistry
53+ IStakeRegistry __stakeRegistry ,
54+ IAllocationManager __allocationManager
5455 )
5556 ServiceManagerBaseStorage (
5657 __avsDirectory,
5758 __rewardsCoordinator,
5859 __registryCoordinator,
59- __stakeRegistry
60+ __stakeRegistry,
61+ __allocationManager
6062 )
6163 {
6264 _disableInitializers ();
6365 }
6466
6567 function __ServiceManagerBase_init (
6668 address initialOwner ,
67- address _rewardsInitiator
69+ address _rewardsInitiator ,
70+ address _slasher
6871 ) internal virtual onlyInitializing {
6972 _transferOwnership (initialOwner);
7073 _setRewardsInitiator (_rewardsInitiator);
74+ _setSlasher (_slasher);
7175 }
7276
7377 /**
@@ -79,6 +83,10 @@ abstract contract ServiceManagerBase is ServiceManagerBaseStorage {
7983 _avsDirectory.updateAVSMetadataURI (_metadataURI);
8084 }
8185
86+ function slashOperator (IAllocationManager.SlashingParams memory params ) external onlySlasher {
87+ _allocationManager.slashOperator (params);
88+ }
89+
8290 /**
8391 * @notice Creates a new rewards submission to the EigenLayer RewardsCoordinator contract, to be split amongst the
8492 * set of stakers delegated to operators who are registered to this `avs`
@@ -168,6 +176,15 @@ abstract contract ServiceManagerBase is ServiceManagerBaseStorage {
168176 _setRewardsInitiator (newRewardsInitiator);
169177 }
170178
179+ /**
180+ * @notice Sets the slasher address
181+ * @param newSlasher The new slasher address
182+ * @dev only callable by the owner
183+ */
184+ function setSlasher (address newSlasher ) external onlyOwner {
185+ _setSlasher (newSlasher);
186+ }
187+
171188 /**
172189 * @notice Migrates the AVS to use operator sets and creates new operator set IDs.
173190 * @param operatorSetsToCreate An array of operator set IDs to create.
@@ -325,6 +342,11 @@ abstract contract ServiceManagerBase is ServiceManagerBaseStorage {
325342 rewardsInitiator = newRewardsInitiator;
326343 }
327344
345+ function _setSlasher (address newSlasher ) internal {
346+ emit SlasherUpdated (slasher, newSlasher);
347+ slasher = newSlasher;
348+ }
349+
328350 /**
329351 * @notice Returns the list of strategies that the AVS supports for restaking
330352 * @dev This function is intended to be called off-chain
@@ -402,4 +424,19 @@ abstract contract ServiceManagerBase is ServiceManagerBaseStorage {
402424 function avsDirectory () external view override returns (address ) {
403425 return address (_avsDirectory);
404426 }
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+ }
405442}
0 commit comments