diff --git a/contracts/lib/eigenlayer-contracts b/contracts/lib/eigenlayer-contracts index 722f3cbe..d6c229b6 160000 --- a/contracts/lib/eigenlayer-contracts +++ b/contracts/lib/eigenlayer-contracts @@ -1 +1 @@ -Subproject commit 722f3cbeb7721431f1a2a4a73582f7981212e23d +Subproject commit d6c229b6a81b3ae2c5ef7788c328bcb6da37cb36 diff --git a/contracts/lib/forge-std b/contracts/lib/forge-std index 3b20d60d..6abf6698 160000 --- a/contracts/lib/forge-std +++ b/contracts/lib/forge-std @@ -1 +1 @@ -Subproject commit 3b20d60d14b343ee4f908cb8079495c07f5e8981 +Subproject commit 6abf66980050ab03a35b52bdab814f55001d6929 diff --git a/contracts/lib/snowbridge b/contracts/lib/snowbridge index e3487132..80398fe9 160000 --- a/contracts/lib/snowbridge +++ b/contracts/lib/snowbridge @@ -1 +1 @@ -Subproject commit e348713249d9a4367d5148bb5b7010f92d1abd59 +Subproject commit 80398fe988359da1ba6866618bd27126b38972e4 diff --git a/contracts/src/interfaces/IDataHavenServiceManager.sol b/contracts/src/interfaces/IDataHavenServiceManager.sol index 08c9cd61..ec1c8a8e 100644 --- a/contracts/src/interfaces/IDataHavenServiceManager.sol +++ b/contracts/src/interfaces/IDataHavenServiceManager.sol @@ -5,9 +5,6 @@ pragma solidity ^0.8.27; import {IAVSRegistrar} from "eigenlayer-contracts/src/contracts/interfaces/IAVSRegistrar.sol"; import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol"; -// Snowbridge imports -import {IGatewayV2} from "snowbridge/src/v2/IGateway.sol"; - /** * @title DataHaven Service Manager Errors Interface * @notice Contains all error definitions used by the DataHaven Service Manager diff --git a/contracts/test/mocks/DelegationMock.sol b/contracts/test/mocks/DelegationMock.sol deleted file mode 100644 index c0962927..00000000 --- a/contracts/test/mocks/DelegationMock.sol +++ /dev/null @@ -1,307 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -pragma solidity ^0.8.27; - -import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import {console2 as console} from "forge-std/Test.sol"; - -import {IDelegationManager} from - "eigenlayer-contracts/src/contracts/interfaces/IDelegationManager.sol"; -import {IStrategyManager} from "eigenlayer-contracts/src/contracts/interfaces/IStrategyManager.sol"; -import {StrategyManager} from "eigenlayer-contracts/src/contracts/core/StrategyManager.sol"; -import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol"; -import {IPauserRegistry} from "eigenlayer-contracts/src/contracts/interfaces/IPauserRegistry.sol"; -import {SlashingLib} from "eigenlayer-contracts/src/contracts/libraries/SlashingLib.sol"; - -contract DelegationIntermediate is IDelegationManager { - function initialize(address initialOwner, uint256 initialPausedStatus) external virtual {} - - function registerAsOperator( - OperatorDetails calldata registeringOperatorDetails, - uint32 allocationDelay, - string calldata metadataURI - ) external virtual {} - - function modifyOperatorDetails( - OperatorDetails calldata newOperatorDetails - ) external virtual {} - - function updateOperatorMetadataURI( - string calldata metadataURI - ) external virtual {} - - function delegateTo( - address operator, - SignatureWithExpiry memory approverSignatureAndExpiry, - bytes32 approverSalt - ) external virtual {} - - function undelegate( - address staker - ) external virtual returns (bytes32[] memory withdrawalRoots) {} - - function queueWithdrawals( - QueuedWithdrawalParams[] calldata params - ) external virtual returns (bytes32[] memory) {} - - function completeQueuedWithdrawals( - IERC20[][] calldata tokens, - bool[] calldata receiveAsTokens, - uint256 numToComplete - ) external virtual {} - - function completeQueuedWithdrawal( - Withdrawal calldata withdrawal, - IERC20[] calldata tokens, - bool receiveAsTokens - ) external virtual {} - - function completeQueuedWithdrawals( - Withdrawal[] calldata withdrawals, - IERC20[][] calldata tokens, - bool[] calldata receiveAsTokens - ) external virtual {} - - function increaseDelegatedShares( - address staker, - IStrategy strategy, - uint256 existingDepositShares, - uint256 addedShares - ) external virtual {} - - function decreaseBeaconChainScalingFactor( - address staker, - uint256 existingShares, - uint64 proportionOfOldBalance - ) external virtual {} - - function burnOperatorShares( - address operator, - IStrategy strategy, - uint64 prevMaxMagnitude, - uint64 newMaxMagnitude - ) external virtual {} - - function completeQueuedWithdrawal( - Withdrawal calldata withdrawal, - IERC20[] calldata tokens, - uint256 middlewareTimesIndex, - bool receiveAsTokens - ) external virtual {} - - function completeQueuedWithdrawals( - Withdrawal[] calldata withdrawals, - IERC20[][] calldata tokens, - uint256[] calldata middlewareTimesIndexes, - bool[] calldata receiveAsTokens - ) external virtual {} - - function delegatedTo( - address staker - ) external view virtual returns (address) {} - - function delegationApproverSaltIsSpent( - address _delegationApprover, - bytes32 salt - ) external view virtual returns (bool) {} - - function cumulativeWithdrawalsQueued( - address staker - ) external view virtual returns (uint256) {} - - function isDelegated( - address staker - ) external view virtual returns (bool) {} - - function isOperator( - address operator - ) external view virtual returns (bool) {} - - function operatorDetails( - address operator - ) external view virtual returns (OperatorDetails memory) {} - - function delegationApprover( - address operator - ) external view virtual returns (address) {} - - function getOperatorShares( - address operator, - IStrategy[] memory strategies - ) external view virtual returns (uint256[] memory) {} - - function getOperatorsShares( - address[] memory operators, - IStrategy[] memory strategies - ) external view virtual returns (uint256[][] memory) {} - - function getSlashableSharesInQueue( - address operator, - IStrategy strategy - ) external view virtual returns (uint256) {} - - function getWithdrawableShares( - address staker, - IStrategy[] memory strategies - ) - external - view - virtual - override - returns (uint256[] memory withdrawableShares, uint256[] memory depositShares) - {} - - function getDepositedShares( - address staker - ) external view virtual returns (IStrategy[] memory, uint256[] memory) {} - - function depositScalingFactor( - address staker, - IStrategy strategy - ) external view virtual returns (uint256) {} - - function getBeaconChainSlashingFactor( - address staker - ) external view virtual returns (uint64) {} - - function getQueuedWithdrawals( - address staker - ) - external - view - virtual - override - returns (Withdrawal[] memory withdrawals, uint256[][] memory shares) - {} - - function calculateWithdrawalRoot( - Withdrawal memory withdrawal - ) external pure virtual returns (bytes32) {} - - function calculateDelegationApprovalDigestHash( - address staker, - address operator, - address _delegationApprover, - bytes32 approverSalt, - uint256 expiry - ) external view virtual returns (bytes32) {} - - function beaconChainETHStrategy() external view virtual override returns (IStrategy) {} - - function DELEGATION_APPROVAL_TYPEHASH() external view virtual override returns (bytes32) {} - - function registerAsOperator( - address initDelegationApprover, - uint32 allocationDelay, - string calldata metadataURI - ) external virtual {} - - function modifyOperatorDetails( - address operator, - address newDelegationApprover - ) external virtual {} - - function updateOperatorMetadataURI( - address operator, - string calldata metadataURI - ) external virtual {} - - function redelegate( - address newOperator, - SignatureWithExpiry memory newOperatorApproverSig, - bytes32 approverSalt - ) external virtual returns (bytes32[] memory withdrawalRoots) {} - - function decreaseDelegatedShares( - address staker, - uint256 curDepositShares, - uint64 prevBeaconChainSlashingFactor, - uint256 wadSlashed - ) external virtual {} - - function decreaseDelegatedShares( - address staker, - uint256 curDepositShares, - uint64 beaconChainSlashingFactorDecrease - ) external virtual {} - - function minWithdrawalDelayBlocks() external view virtual override returns (uint32) {} - - function slashOperatorShares( - address operator, - IStrategy strategy, - uint64 prevMaxMagnitude, - uint64 newMaxMagnitude - ) external {} - - function getQueuedWithdrawalRoots( - address staker - ) external view override returns (bytes32[] memory) {} - - function convertToDepositShares( - address staker, - IStrategy[] memory strategies, - uint256[] memory withdrawableShares - ) external view override returns (uint256[] memory) {} - - function getQueuedWithdrawal( - bytes32 withdrawalRoot - ) external view override returns (Withdrawal memory withdrawal, uint256[] memory shares) {} - - function domainSeparator() external view returns (bytes32) {} - - function version() external pure returns (string memory) { - return "v-mock"; - } -} - -contract DelegationMock is DelegationIntermediate { - mapping(address => bool) internal _isOperator; - mapping(address => mapping(IStrategy => uint256)) internal _weightOf; - - function setOperatorShares( - address operator, - IStrategy strategy, - uint256 actualWeight - ) external { - _weightOf[operator][strategy] = actualWeight; - } - - function setIsOperator(address operator, bool isOperatorValue) external { - _isOperator[operator] = isOperatorValue; - } - - function isOperator( - address operator - ) external view override returns (bool) { - return _isOperator[operator]; - } - - function getOperatorShares( - address operator, - IStrategy[] calldata strategies - ) external view override returns (uint256[] memory) { - uint256[] memory shares = new uint256[](strategies.length); - for (uint256 i = 0; i < strategies.length; i++) { - shares[i] = _weightOf[operator][strategies[i]]; - } - return shares; - } - - function getOperatorsShares( - address[] memory operators, - IStrategy[] memory strategies - ) external view override returns (uint256[][] memory) { - uint256[][] memory operatorSharesArray = new uint256[][](operators.length); - for (uint256 i = 0; i < operators.length; i++) { - operatorSharesArray[i] = new uint256[](strategies.length); - for (uint256 j = 0; j < strategies.length; j++) { - operatorSharesArray[i][j] = _weightOf[operators[i]][strategies[j]]; - } - } - return operatorSharesArray; - } - - function minWithdrawalDelayBlocks() external pure override returns (uint32) { - return 10000; - } -} diff --git a/contracts/test/mocks/EigenPodManagerMock.sol b/contracts/test/mocks/EigenPodManagerMock.sol deleted file mode 100644 index fca027a1..00000000 --- a/contracts/test/mocks/EigenPodManagerMock.sol +++ /dev/null @@ -1,121 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -pragma solidity ^0.8.9; - -import "forge-std/Test.sol"; -import "eigenlayer-contracts/src/contracts/permissions/Pausable.sol"; -import "eigenlayer-contracts/src/contracts/interfaces/IEigenPodManager.sol"; - -contract EigenPodManagerMock is Test, Pausable, IEigenPodManager { - receive() external payable {} - - fallback() external payable {} - - mapping(address => int256) public podShares; - - constructor( - IPauserRegistry _pauserRegistry - ) Pausable(_pauserRegistry) { - _setPausedStatus(0); - } - - function podOwnerShares( - address podOwner - ) external view returns (int256) { - return podShares[podOwner]; - } - - function setPodOwnerShares(address podOwner, int256 shares) external { - podShares[podOwner] = shares; - } - - function denebForkTimestamp() external pure returns (uint64) { - return type(uint64).max; - } - - function createPod() external returns (address) {} - - function stake( - bytes calldata pubkey, - bytes calldata signature, - bytes32 depositDataRoot - ) external payable {} - - function recordBeaconChainETHBalanceUpdate( - address podOwner, - int256 sharesDelta, - uint64 proportionPodBalanceDecrease - ) external {} - - function ownerToPod( - address podOwner - ) external view returns (IEigenPod) {} - - function getPod( - address podOwner - ) external view returns (IEigenPod) {} - - function ethPOS() external view returns (IETHPOSDeposit) {} - - function eigenPodBeacon() external view returns (IBeacon) {} - - function strategyManager() external view returns (IStrategyManager) {} - - function hasPod( - address podOwner - ) external view returns (bool) {} - - function numPods() external view returns (uint256) {} - - function podOwnerDepositShares( - address podOwner - ) external view returns (int256) {} - - function beaconChainETHStrategy() external view returns (IStrategy) {} - - function stakerDepositShares( - address user, - IStrategy strategy - ) external view returns (uint256 depositShares) {} - - function withdrawSharesAsTokens( - address staker, - IStrategy strategy, - IERC20 token, - uint256 shares - ) external {} - - function addShares( - address staker, - IStrategy strategy, - IERC20 token, - uint256 shares - ) external returns (uint256, uint256) {} - - function beaconChainSlashingFactor( - address staker - ) external view returns (uint64) {} - - function recordBeaconChainETHBalanceUpdate( - address podOwner, - uint256 prevRestakedBalanceWei, - int256 balanceDeltaWei - ) external {} - - function burnableETHShares() external view returns (uint256) {} - - function increaseBurnableShares(IStrategy strategy, uint256 addedSharesToBurn) external {} - - function addShares( - address staker, - IStrategy strategy, - uint256 shares - ) external override returns (uint256, uint256) {} - - function version() external view override returns (string memory) {} - - function removeDepositShares( - address staker, - IStrategy strategy, - uint256 depositSharesToRemove - ) external override returns (uint256) {} -} diff --git a/contracts/test/utils/AVSDeployer.sol b/contracts/test/utils/AVSDeployer.sol index df245a2e..c12b261a 100644 --- a/contracts/test/utils/AVSDeployer.sol +++ b/contracts/test/utils/AVSDeployer.sol @@ -22,7 +22,9 @@ import { } from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol"; import {EmptyContract} from "eigenlayer-contracts/src/test/mocks/EmptyContract.sol"; import {StrategyBase} from "eigenlayer-contracts/src/contracts/strategies/StrategyBase.sol"; - +import {EigenPodManagerMock} from "eigenlayer-contracts/src/test/mocks/EigenPodManagerMock.sol"; +import {StrategyManager} from "eigenlayer-contracts/src/contracts/core/StrategyManager.sol"; +import {IEigenPodManager} from "eigenlayer-contracts/src/contracts/interfaces/IEigenPodManager.sol"; import {ERC20FixedSupply} from "./ERC20FixedSupply.sol"; import {IServiceManager} from "../../src/interfaces/IServiceManager.sol"; import {VetoableSlasher} from "../../src/middleware/VetoableSlasher.sol"; @@ -30,10 +32,8 @@ import {IVetoableSlasher} from "../../src/interfaces/IVetoableSlasher.sol"; import {RewardsRegistry} from "../../src/middleware/RewardsRegistry.sol"; import {DataHavenServiceManager} from "../../src/DataHavenServiceManager.sol"; // Mocks -import {StrategyManager} from "eigenlayer-contracts/src/contracts/core/StrategyManager.sol"; import {RewardsCoordinatorMock} from "../mocks/RewardsCoordinatorMock.sol"; import {PermissionControllerMock} from "../mocks/PermissionControllerMock.sol"; -import {EigenPodManagerMock} from "../mocks/EigenPodManagerMock.sol"; import {AllocationManagerMock} from "../mocks/AllocationManagerMock.sol"; import {DelegationManager} from "eigenlayer-contracts/src/contracts/core/DelegationManager.sol"; @@ -144,7 +144,7 @@ contract AVSDeployer is Test { cheats.prank(regularDeployer); delegationManagerImplementation = new DelegationManager( strategyManager, - eigenPodManagerMock, + IEigenPodManager(address(eigenPodManagerMock)), allocationManager, pauserRegistry, permissionControllerMock,