2025-03-11 20:16:16 +00:00
|
|
|
// SPDX-License-Identifier: UNLICENSED
|
|
|
|
|
pragma solidity ^0.8.13;
|
|
|
|
|
|
2025-04-11 23:54:20 +00:00
|
|
|
/* solhint-disable func-name-mixedcase */
|
|
|
|
|
|
2025-03-11 20:16:16 +00:00
|
|
|
import {Test, console} from "forge-std/Test.sol";
|
|
|
|
|
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
|
|
|
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
|
2025-10-20 08:20:59 +00:00
|
|
|
import {
|
|
|
|
|
IRewardsCoordinator
|
|
|
|
|
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
|
2025-03-11 20:16:16 +00:00
|
|
|
import {StrategyBase} from "eigenlayer-contracts/src/contracts/strategies/StrategyBase.sol";
|
|
|
|
|
import {
|
|
|
|
|
IAllocationManagerErrors,
|
|
|
|
|
IAllocationManager
|
|
|
|
|
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
|
|
|
|
|
|
|
|
|
|
import {ServiceManagerMock} from "./mocks/ServiceManagerMock.sol";
|
2025-04-16 15:49:35 +00:00
|
|
|
import {AVSDeployer} from "./utils/AVSDeployer.sol";
|
2025-03-11 20:16:16 +00:00
|
|
|
import {IServiceManager} from "../src/interfaces/IServiceManager.sol";
|
|
|
|
|
import {IServiceManagerUI} from "../src/interfaces/IServiceManagerUI.sol";
|
|
|
|
|
import {ServiceManagerBase} from "../src/middleware/ServiceManagerBase.sol";
|
|
|
|
|
|
2025-04-16 15:49:35 +00:00
|
|
|
contract ServiceManagerBaseTest is AVSDeployer {
|
2025-03-11 20:16:16 +00:00
|
|
|
function setUp() public virtual {
|
|
|
|
|
_deployMockEigenLayerAndAVS();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function beforeTestSetup(
|
|
|
|
|
bytes4 testSelector
|
|
|
|
|
) public pure returns (bytes[] memory beforeTestCalldata) {
|
|
|
|
|
if (testSelector == this.test_createOperatorSetsWithEmptyParams.selector) {
|
|
|
|
|
beforeTestCalldata = new bytes[](1);
|
|
|
|
|
beforeTestCalldata[0] = abi.encodePacked(this.test_registerAVS.selector);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_registerAVS() public {
|
|
|
|
|
vm.prank(avsOwner);
|
|
|
|
|
IServiceManagerUI(address(serviceManager)).updateAVSMetadataURI("https://example.com");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_registerAVSRevertsIfNotAVSOwner() public {
|
|
|
|
|
vm.prank(rewardsUpdater);
|
|
|
|
|
vm.expectRevert(bytes("Ownable: caller is not the owner"));
|
|
|
|
|
IServiceManagerUI(address(serviceManager)).updateAVSMetadataURI("https://example.com");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_createOperatorSetsWithEmptyParams() public {
|
|
|
|
|
vm.prank(avsOwner);
|
|
|
|
|
IAllocationManager.CreateSetParams[] memory emptyParams =
|
|
|
|
|
new IAllocationManager.CreateSetParams[](0);
|
|
|
|
|
ServiceManagerBase(address(serviceManager)).createOperatorSets(emptyParams);
|
|
|
|
|
}
|
2025-03-27 15:20:15 +00:00
|
|
|
|
|
|
|
|
function test_returnsAVSAddress() public view {
|
|
|
|
|
assertEq(serviceManager.avs(), address(serviceManager));
|
|
|
|
|
}
|
2025-03-11 20:16:16 +00:00
|
|
|
}
|