Skip to content

Commit

Permalink
add view func
Browse files Browse the repository at this point in the history
  • Loading branch information
gpsanant authored and ypatil12 committed Sep 24, 2024
1 parent 9be27cc commit 5c1120e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/contracts/core/StakeRootCompendium.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 11 additions & 0 deletions src/contracts/interfaces/IStakeRootCompendium.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5c1120e

Please sign in to comment.