Skip to content

Commit

Permalink
require authorization for updateRewards
Browse files Browse the repository at this point in the history
  • Loading branch information
BkChoy committed Jan 23, 2024
1 parent 2ad7533 commit 0f3dea3
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions contracts/core/RebaseController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ contract RebaseController is Ownable {
ISDLPoolCCIPControllerPrimary public sdlPoolCCIPController;
IInsurancePool public insurancePool;

address public rebaseLossBot;
address public rebaseBot;
uint256 public maxRebaseLossBP;

error NoStrategiesToUpdate();
Expand All @@ -35,20 +35,20 @@ contract RebaseController is Ownable {
address _priorityPool,
address _sdlPoolCCIPController,
address _insurancePool,
address _rebaseLossBot,
address _rebaseBot,
uint256 _maxRebaseLossBP
) {
stakingPool = IStakingPool(_stakingPool);
priorityPool = IPriorityPool(_priorityPool);
sdlPoolCCIPController = ISDLPoolCCIPControllerPrimary(_sdlPoolCCIPController);
insurancePool = IInsurancePool(_insurancePool);
rebaseLossBot = _rebaseLossBot;
rebaseBot = _rebaseBot;
if (_maxRebaseLossBP > 9000) revert InvalidMaxRebaseLoss();
maxRebaseLossBP = _maxRebaseLossBP;
}

modifier onlyRebaseLossBot() {
if (msg.sender != rebaseLossBot) revert SenderNotAuthorized();
modifier onlyRebaseBot() {
if (msg.sender != rebaseBot) revert SenderNotAuthorized();
_;
}

Expand All @@ -57,7 +57,7 @@ contract RebaseController is Ownable {
* @param _strategyIdxs indexes of strategies to update rewards for
* @param _data encoded data to be passed to each strategy
**/
function updateRewards(uint256[] calldata _strategyIdxs, bytes calldata _data) external {
function updateRewards(uint256[] calldata _strategyIdxs, bytes calldata _data) external onlyRebaseBot {
if (priorityPool.poolStatus() == IPriorityPool.PoolStatus.CLOSED) revert PoolClosed();

stakingPool.updateStrategyRewards(_strategyIdxs, _data);
Expand Down Expand Up @@ -111,7 +111,7 @@ contract RebaseController is Ownable {
* @dev should be called by a custom bot (not CL automation)
* @param _performData abi encoded list of strategy indexes to update and their total deposit change
*/
function performUpkeep(bytes calldata _performData) external onlyRebaseLossBot {
function performUpkeep(bytes calldata _performData) external onlyRebaseBot {
if (priorityPool.poolStatus() == IPriorityPool.PoolStatus.CLOSED) revert PoolClosed();

(uint256[] memory strategiesToUpdate, uint256 totalDepositChange) = abi.decode(_performData, (uint256[], uint256));
Expand Down Expand Up @@ -140,11 +140,11 @@ contract RebaseController is Ownable {
}

/**
* @notice sets the rebase loss bot
* @param _rebaseLossBot address of rebase loss bot
* @notice sets the rebase bot
* @param _rebaseBot address of rebase bot
*/
function setRebaseLossBot(address _rebaseLossBot) external onlyOwner {
rebaseLossBot = _rebaseLossBot;
function setRebaseLossBot(address _rebaseBot) external onlyOwner {
rebaseBot = _rebaseBot;
}

/**
Expand Down

0 comments on commit 0f3dea3

Please sign in to comment.