diff --git a/src/contracts/core/StakeRootCompendium.sol b/src/contracts/core/StakeRootCompendium.sol index 5f2bb0eb98..14f2a137cf 100644 --- a/src/contracts/core/StakeRootCompendium.sol +++ b/src/contracts/core/StakeRootCompendium.sol @@ -473,6 +473,15 @@ contract StakeRootCompendium is StakeRootCompendiumStorage { return operatorSets.length; } + /// @inheritdoc IStakeRootCompendium + function getOperatorSetIndexAtTimestamp(OperatorSet memory operatorSet, uint32 timestamp) + external + view + returns (uint224) + { + return operatorSetToIndex[operatorSet.avs][operatorSet.operatorSetId].upperLookup(timestamp); + } + /// @inheritdoc IStakeRootCompendium function getStakes( OperatorSet calldata operatorSet, diff --git a/src/contracts/interfaces/IStakeRootCompendium.sol b/src/contracts/interfaces/IStakeRootCompendium.sol index 5c0083b8ea..35588204c7 100644 --- a/src/contracts/interfaces/IStakeRootCompendium.sol +++ b/src/contracts/interfaces/IStakeRootCompendium.sol @@ -119,6 +119,17 @@ interface IStakeRootCompendium { /// @notice the number of stake root submissions function getNumStakeRootSubmissions() external view returns (uint256); + /** + * @notice returns the operatorSet at the given timestamp + * @param operatorSet the operatorSet to get the indec for + * @param timestamp the timestamp to get the index for + * @return index the index of the operatorSet + */ + function getOperatorSetIndexAtTimestamp(OperatorSet memory operatorSet, uint32 timestamp) + external + view + returns (uint224); + /** * @notice returns the delegated and slashable stakes for an operator in an operatorSet * @param operatorSet the operatorSet to get the stakes for