Skip to content

Commit

Permalink
feat: setOperatorAVSCommission
Browse files Browse the repository at this point in the history
  • Loading branch information
0xrajath committed Oct 18, 2024
1 parent 179aa1f commit d4db04d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/contracts/core/RewardsCoordinator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,18 @@ contract RewardsCoordinator is
_setGlobalOperatorCommission(_globalCommissionBips);
}

/// @inheritdoc IRewardsCoordinator
function setOperatorAVSCommission(address operator, address avs, uint16 commission) external {
require(msg.sender == operator, "RewardsCoordinator.setOperatorAVSCommission: caller is not the operator");
//TODO: Add a check to ensure that the operator is registered to the AVS

OperatorAVSCommission storage operatorAVSCommission = operatorAVSCommissionBips[operator][avs];

emit OperatorAVSCommissionBipsSet(operator, avs, operatorAVSCommission.commissionBips, commission);
operatorAVSCommission.initialized = true;
operatorAVSCommission.commissionBips = commission;
}

/// @inheritdoc IRewardsCoordinator
function setRewardsUpdater(address _rewardsUpdater) external onlyOwner {
_setRewardsUpdater(_rewardsUpdater);
Expand Down
15 changes: 15 additions & 0 deletions src/contracts/interfaces/IRewardsCoordinator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ interface IRewardsCoordinator {
);
event ActivationDelaySet(uint32 oldActivationDelay, uint32 newActivationDelay);
event GlobalCommissionBipsSet(uint16 oldGlobalCommissionBips, uint16 newGlobalCommissionBips);
event OperatorAVSCommissionBipsSet(
address indexed operator,
address indexed avs,
uint16 oldOperatorAVSCommissionBips,
uint16 newOperatorAVSCommissionBips
);
event ClaimerForSet(address indexed earner, address indexed oldClaimer, address indexed claimer);
/// @notice rootIndex is the specific array index of the newly created root in the storage array
event DistributionRootSubmitted(
Expand Down Expand Up @@ -428,6 +434,15 @@ interface IRewardsCoordinator {
*/
function setGlobalOperatorCommission(uint16 _globalCommissionBips) external;

/**
* @notice Sets the commission for a specific operator for a specific avs
* @param operator The operator who is setting the commission
* @param avs The avs for which the commission is being set by the operator
* @param commission The commission for the operator for the specific avs
* @dev Only callable by the operator
*/
function setOperatorAVSCommission(address operator, address avs, uint16 commission) external;

/**
* @notice Sets the permissioned `rewardsUpdater` address which can post new roots
* @dev Only callable by the contract owner
Expand Down

0 comments on commit d4db04d

Please sign in to comment.