diff --git a/src/sGydStaker.sol b/src/sGydStaker.sol index 944fcb2..ea7dfd6 100644 --- a/src/sGydStaker.sol +++ b/src/sGydStaker.sol @@ -14,6 +14,13 @@ contract sGydStaker is LiquidityMining, UUPSUpgradeable { + error NotAuthorized(); + + modifier onlyTreasury() { + if (msg.sender != daoTreasury) revert NotAuthorized(); + _; + } + constructor() { _disableInitializers(); } @@ -44,15 +51,11 @@ contract sGydStaker is _unstake(receiver, shares); } - function startMining(address rewardsFrom, uint256 amount, uint256 endTime) - external - override - onlyRole(DEFAULT_ADMIN_ROLE) - { + function startMining(address rewardsFrom, uint256 amount, uint256 endTime) external override onlyTreasury { _startMining(rewardsFrom, amount, endTime); } - function stopMining() external override onlyRole(DEFAULT_ADMIN_ROLE) { + function stopMining() external override onlyTreasury { _stopMining(); } } diff --git a/test/sGydStaker.t.sol b/test/sGydStaker.t.sol index bdad52d..83f4a65 100644 --- a/test/sGydStaker.t.sol +++ b/test/sGydStaker.t.sol @@ -95,7 +95,7 @@ contract sGydStakerTest is UnitTest { sgydStaker.claimRewards(); skip(18 hours); - vm.prank(admin); + vm.prank(treasury); sgydStaker.stopMining(); _startMining(rewardAmount * 2); skip(24 hours); @@ -126,7 +126,7 @@ contract sGydStakerTest is UnitTest { rewardToken.mint(treasury, rewardAmount); vm.prank(treasury); rewardToken.approve(address(sgydStaker), rewardAmount); - vm.prank(admin); + vm.prank(treasury); sgydStaker.startMining(treasury, rewardAmount, block.timestamp + 1 days); } }