diff --git a/contracts/StaderConfig.sol b/contracts/StaderConfig.sol index d9f9b920..dad1dfcc 100644 --- a/contracts/StaderConfig.sol +++ b/contracts/StaderConfig.sol @@ -302,9 +302,9 @@ contract StaderConfig is IStaderConfig, AccessControlUpgradeable { address contractAddress, string calldata functionSig, address accountToPermit - ) external onlyRole(DEFAULT_ADMIN_ROLE) { + ) external onlyRole(MANAGER) { bytes32 role = keccak256(abi.encodePacked(contractAddress, functionSig)); - grantRole(role, accountToPermit); + _grantRole(role, accountToPermit); emit PermissionGranted(accountToPermit, contractAddress, functionSig); } @@ -312,9 +312,9 @@ contract StaderConfig is IStaderConfig, AccessControlUpgradeable { address contractAddress, string calldata functionSig, address accountToRevoke - ) external onlyRole(DEFAULT_ADMIN_ROLE) { + ) external onlyRole(MANAGER) { bytes32 role = keccak256(abi.encodePacked(contractAddress, functionSig)); - revokeRole(role, accountToRevoke); + _revokeRole(role, accountToRevoke); emit PermissionRevoked(accountToRevoke, contractAddress, functionSig); } diff --git a/test/foundry_tests/SDRewardsManager.t.sol b/test/foundry_tests/SDRewardsManager.t.sol index 9de9525d..0cc56b4d 100644 --- a/test/foundry_tests/SDRewardsManager.t.sol +++ b/test/foundry_tests/SDRewardsManager.t.sol @@ -16,6 +16,7 @@ import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC contract SDRewardManagerTest is Test { address staderAdmin; + address staderManager; address user1; address user2; address staderTokenDeployer; @@ -35,6 +36,7 @@ contract SDRewardManagerTest is Test { user2 = vm.addr(102); staderTokenDeployer = vm.addr(103); address ethDepositAddr = vm.addr(104); + staderManager = vm.addr(105); vm.prank(staderTokenDeployer); staderToken = new StaderTokenMock(); @@ -70,7 +72,11 @@ contract SDRewardManagerTest is Test { vm.startPrank(staderAdmin); staderConfig.updateStaderToken(address(staderToken)); + staderConfig.grantRole(staderConfig.MANAGER(), staderManager); staderConfig.updatePermissionlessSocializingPool(address(permissionlessSP)); + vm.stopPrank(); + + vm.startPrank(staderManager); staderConfig.giveCallPermission(address(rewardManager), "addRewardEntry(uint256,uint256)", user1); staderConfig.giveCallPermission(address(rewardManager), "approveEntry(uint256)", user1); vm.stopPrank();