Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 82 additions & 5 deletions test/mocks/AllocationManagerMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {IPauserRegistry} from "eigenlayer-contracts/src/contracts/interfaces/IPa
import {ISemVerMixin} from "eigenlayer-contracts/src/contracts/interfaces/ISemVerMixin.sol";

contract AllocationManagerIntermediate is IAllocationManager {
mapping(address avs => address avsRegistrar) internal _avsRegistrar;

function initialize(address initialOwner, uint256 initialPausedStatus) external virtual {}

function slashOperator(
Expand Down Expand Up @@ -40,7 +42,15 @@ contract AllocationManagerIntermediate is IAllocationManager {

function setAllocationDelay(address operator, uint32 delay) external virtual {}

function setAVSRegistrar(address avs, IAVSRegistrar registrar) external virtual {}
function setAVSRegistrar(address avs, IAVSRegistrar avsRegistrar) external {
_avsRegistrar[avs] = address(avsRegistrar);
}

function getAVSRegistrar(
address avs
) external view override returns (IAVSRegistrar) {
return IAVSRegistrar(_avsRegistrar[avs]);
}

function updateAVSMetadataURI(address avs, string calldata metadataURI) external virtual {}

Expand Down Expand Up @@ -134,10 +144,6 @@ contract AllocationManagerIntermediate is IAllocationManager {
OperatorSet memory operatorSet
) external view virtual returns (uint256) {}

function getAVSRegistrar(
address avs
) external view virtual returns (IAVSRegistrar) {}

function getStrategiesInOperatorSet(
OperatorSet memory operatorSet
) external view virtual returns (IStrategy[] memory strategies) {}
Expand Down Expand Up @@ -219,6 +225,15 @@ contract AllocationManagerIntermediate is IAllocationManager {
contract AllocationManagerMock is AllocationManagerIntermediate {
uint32 internal constant _DEALLOCATION_DELAY = 86400;

mapping(bytes32 operatorSetKey => address[] members) internal _members;
mapping(bytes32 operatorSetKey => IStrategy[] strategies) internal _strategies;
mapping(
bytes32 operatorSetKey
=> mapping(
address operator => mapping(IStrategy strategy => uint256 minimumSlashableStake)
)
) internal _minimumSlashableStake;

function DEALLOCATION_DELAY() external pure override returns (uint32) {
return _DEALLOCATION_DELAY;
}
Expand Down Expand Up @@ -263,4 +278,66 @@ contract AllocationManagerMock is AllocationManagerIntermediate {
) external pure returns (uint256) {
return 0;
}

function getMembers(
OperatorSet memory operatorSet
) external view override returns (address[] memory) {
return _members[operatorSet.key()];
}

function setMembersInOperatorSet(
OperatorSet memory operatorSet,
address[] memory members
) external {
_members[operatorSet.key()] = members;
}

function setStrategiesInOperatorSet(
OperatorSet memory operatorSet,
IStrategy[] memory strategies
) external {
_strategies[operatorSet.key()] = strategies;
}

function getStrategiesInOperatorSet(
OperatorSet memory operatorSet
) external view override returns (IStrategy[] memory) {
return _strategies[operatorSet.key()];
}

function setMinimumSlashableStake(
OperatorSet memory operatorSet,
address[] memory operators,
IStrategy[] memory strategies,
uint256[][] memory minimumSlashableStake
) external {
for (uint256 i = 0; i < operators.length; ++i) {
for (uint256 j = 0; j < strategies.length; ++j) {
_minimumSlashableStake[operatorSet.key()][operators[i]][strategies[j]] =
minimumSlashableStake[i][j];
}
}
}

function getMinimumSlashableStake(
OperatorSet memory operatorSet,
address[] memory operators,
IStrategy[] memory strategies,
uint32 /* futureBlock */
) external view override returns (uint256[][] memory) {
uint256[][] memory minimumSlashableStake = new uint256[][](operators.length);

for (uint256 i = 0; i < operators.length; ++i) {
minimumSlashableStake[i] = new uint256[](strategies.length);
}

for (uint256 i = 0; i < operators.length; ++i) {
for (uint256 j = 0; j < strategies.length; ++j) {
minimumSlashableStake[i][j] =
_minimumSlashableStake[operatorSet.key()][operators[i]][strategies[j]];
}
}

return minimumSlashableStake;
}
}
Loading
Loading