From 9f92f72b6b31a13b8e23252e5373845587ea68ce Mon Sep 17 00:00:00 2001 From: steven <12021290+stevennevins@users.noreply.github.com> Date: Fri, 14 Jun 2024 14:03:30 -0400 Subject: [PATCH] perf: refactor index registry to use internal functions for modifier (#269) * fix: deprecated struct field for earning receiver * perf: move modifier logic to internal function --- src/IndexRegistry.sol | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/IndexRegistry.sol b/src/IndexRegistry.sol index 4e63e78a..8df2c0a1 100644 --- a/src/IndexRegistry.sol +++ b/src/IndexRegistry.sol @@ -12,7 +12,7 @@ contract IndexRegistry is IndexRegistryStorage { /// @notice when applied to a function, only allows the RegistryCoordinator to call it modifier onlyRegistryCoordinator() { - require(msg.sender == address(registryCoordinator), "IndexRegistry.onlyRegistryCoordinator: caller is not the registry coordinator"); + _checkRegistryCoordinator(); _; } @@ -340,4 +340,8 @@ contract IndexRegistry is IndexRegistryStorage { function totalOperatorsForQuorum(uint8 quorumNumber) external view returns (uint32){ return _latestQuorumUpdate(quorumNumber).numOperators; } + + function _checkRegistryCoordinator() internal view { + require(msg.sender == address(registryCoordinator), "IndexRegistry.onlyRegistryCoordinator: caller is not the registry coordinator"); + } }