// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; /* solhint-disable func-name-mixedcase */ 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"; import { IRewardsCoordinator } from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol"; 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"; import {AVSDeployer} from "./utils/AVSDeployer.sol"; import {IServiceManager} from "../src/interfaces/IServiceManager.sol"; import {IServiceManagerUI} from "../src/interfaces/IServiceManagerUI.sol"; import {ServiceManagerBase} from "../src/middleware/ServiceManagerBase.sol"; contract ServiceManagerBaseTest is AVSDeployer { 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); } function test_returnsAVSAddress() public view { assertEq(serviceManager.avs(), address(serviceManager)); } }