From 4abd088a64b82d553119db1f098b3aea4da8a514 Mon Sep 17 00:00:00 2001 From: arigatodl <99845398+dulguun-staderlabs@users.noreply.github.com> Date: Fri, 5 Jan 2024 11:21:21 +0800 Subject: [PATCH] Only manager role for certain functions --- contracts/SDIncentiveController.sol | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/contracts/SDIncentiveController.sol b/contracts/SDIncentiveController.sol index ea6986f2..02dff2d0 100644 --- a/contracts/SDIncentiveController.sol +++ b/contracts/SDIncentiveController.sol @@ -84,16 +84,22 @@ contract SDIncentiveController is ISDIncentiveController, AccessControlUpgradeab } /// @notice Updates the emission rate of the reward tokens per block. + /// @dev only `MANAGER` role can call /// @param newEmissionRate The new emission rate per block. - function updateEmissionRate(uint256 newEmissionRate) external override onlyRole(DEFAULT_ADMIN_ROLE) { + function updateEmissionRate(uint256 newEmissionRate) external override { + UtilLib.onlyManagerRole(msg.sender, staderConfig); + if (newEmissionRate == 0) revert InvalidEmissionRate(); emissionPerBlock = newEmissionRate; emit EmissionRateUpdated(newEmissionRate); } /// @notice Updates the end block of the reward period. + /// @dev only `MANAGER` role can call /// @param _newEndBlock The new end block. - function updateEndBlock(uint256 _newEndBlock) external override onlyRole(DEFAULT_ADMIN_ROLE) { + function updateEndBlock(uint256 _newEndBlock) external override { + UtilLib.onlyManagerRole(msg.sender, staderConfig); + if (_newEndBlock <= block.number) revert InvalidEndBlock(); rewardEndBlock = _newEndBlock; emit RewardEndBlockUpdated(_newEndBlock);