diff --git a/bolt-contracts/src/contracts/BoltRegistry.sol b/bolt-contracts/src/contracts/BoltRegistry.sol index 8989f38b..4d20c981 100644 --- a/bolt-contracts/src/contracts/BoltRegistry.sol +++ b/bolt-contracts/src/contracts/BoltRegistry.sol @@ -13,6 +13,9 @@ contract BoltRegistry is IBoltRegistry { // Mapping to hold the registrants mapping(address => Registrant) public registrants; + // Array to hold operator addresses + address[] public operators; + // Mapping that holds the relationship between validator index and operator address mapping(uint64 => address) public delegations; @@ -106,7 +109,7 @@ contract BoltRegistry is IBoltRegistry { /// @notice Check if an address is a based proposer opted into the protocol /// @param _operator The address to check /// @return True if the address is an active based proposer, false otherwise - function isActiveOperator(address _operator) external view returns (bool) { + function isActiveOperator(address _operator) public view returns (bool) { return registrants[_operator].status == Status.ACTIVE; } @@ -129,4 +132,16 @@ contract BoltRegistry is IBoltRegistry { revert NotFound(); } + + function getAllRegistrants() external view returns (Registrant[] memory) { + Registrant[] memory _registrants = new Registrant[](operators.length); + + for (uint256 i = 0; i < operators.length; i++) { + if (isActiveOperator(operators[i])) { + _registrants[i] = registrants[operators[i]]; + } + } + + return _registrants; + } }