-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d3d0b6
commit 3b7a8bd
Showing
2 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.25; | ||
|
||
import {IPreconfServiceManager} from "../interfaces/IPreconfServiceManager.sol"; | ||
import {IPreconfTaskManager} from "../interfaces/IPreconfTaskManager.sol"; | ||
import {ISlasher} from "../interfaces/eigenlayer-mvp/ISlasher.sol"; | ||
import { | ||
IAVSDirectory, | ||
IRegistryCoordinator, | ||
IRewardsCoordinator, | ||
IStakeRegistry, | ||
ServiceManagerBase | ||
} from "eigenlayer-middleware/ServiceManagerBase.sol"; | ||
|
||
contract PreconfServiceManager is ServiceManagerBase, IPreconfServiceManager { | ||
IPreconfTaskManager internal immutable preconfTaskManager; | ||
ISlasher internal immutable slasher; | ||
|
||
mapping(address operator => uint256 timestamp) public stakeLockedUntil; | ||
|
||
constructor( | ||
IAVSDirectory _avsDirectory, | ||
IRewardsCoordinator _rewardsCoordinator, | ||
IRegistryCoordinator _registryCoordinator, | ||
IStakeRegistry _stakeRegistry, | ||
IPreconfTaskManager _taskManager, | ||
ISlasher _slasher | ||
) ServiceManagerBase(_avsDirectory, _rewardsCoordinator, _registryCoordinator, _stakeRegistry) { | ||
preconfTaskManager = _taskManager; | ||
slasher = _slasher; | ||
} | ||
|
||
modifier onlyPreconfTaskManager() { | ||
if (msg.sender != address(preconfTaskManager)) { | ||
revert IPreconfServiceManager.SenderIsNotPreconfTaskManager(msg.sender); | ||
} | ||
_; | ||
} | ||
|
||
function lockStakeUntil(address operator, uint256 timestamp) external onlyPreconfTaskManager { | ||
stakeLockedUntil[operator] = timestamp; | ||
emit StakeLockedUntil(operator, timestamp); | ||
} | ||
|
||
function slashOperator(address operator) external onlyPreconfTaskManager { | ||
if (slasher.isOperatorSlashed(operator)) { | ||
revert IPreconfServiceManager.OperatorAlreadySlashed(operator); | ||
} | ||
slasher.slashOperator(operator); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters