Skip to content

Commit 08f3531

Browse files
committed
refactor: commission to split terminology
1 parent 3d99748 commit 08f3531

File tree

5 files changed

+63
-60
lines changed

5 files changed

+63
-60
lines changed

lib/eigenlayer-contracts

Submodule eigenlayer-contracts updated 86 files

src/ServiceManagerBase.sol

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,53 +114,58 @@ abstract contract ServiceManagerBase is ServiceManagerBaseStorage {
114114
}
115115

116116
/**
117-
* @notice Creates a new performance-based rewards submission, to be split amongst the operators and
117+
* @notice Creates a new operator-directed rewards submission, to be split amongst the operators and
118118
* set of stakers delegated to operators who are registered to this `avs`.
119-
* @param performanceRewardsSubmissions The performance rewards submissions being created.
119+
* @param operatorDirectedRewardsSubmissions The operator-directed rewards submissions being created.
120120
* @dev Only callabe by the permissioned rewardsInitiator address
121121
* @dev The duration of the `rewardsSubmission` cannot exceed `MAX_REWARDS_DURATION`
122122
* @dev The tokens are sent to the `RewardsCoordinator` contract
123-
* @dev This contract needs a token approval of sum of all `operatorRewards` in the `performanceRewardsSubmissions`, before calling this function.
123+
* @dev This contract needs a token approval of sum of all `operatorRewards` in the `operatorDirectedRewardsSubmissions`, before calling this function.
124124
* @dev Strategies must be in ascending order of addresses to check for duplicates
125125
* @dev Operators must be in ascending order of addresses to check for duplicates.
126-
* @dev This function will revert if the `performanceRewardsSubmissions` is malformed.
126+
* @dev This function will revert if the `operatorDirectedRewardsSubmissions` is malformed.
127127
*/
128-
function createAVSPerformanceRewardsSubmission(
129-
IRewardsCoordinator.PerformanceRewardsSubmission[]
130-
calldata performanceRewardsSubmissions
128+
function createOperatorDirectedAVSRewardsSubmission(
129+
IRewardsCoordinator.OperatorDirectedRewardsSubmission[]
130+
calldata operatorDirectedRewardsSubmissions
131131
) public virtual onlyRewardsInitiator {
132-
for (uint256 i = 0; i < performanceRewardsSubmissions.length; ++i) {
132+
for (
133+
uint256 i = 0;
134+
i < operatorDirectedRewardsSubmissions.length;
135+
++i
136+
) {
133137
// Calculate total amount of token to transfer
134138
uint256 totalAmount = 0;
135139
for (
136140
uint256 j = 0;
137-
j < performanceRewardsSubmissions[i].operatorRewards.length;
141+
j <
142+
operatorDirectedRewardsSubmissions[i].operatorRewards.length;
138143
++j
139144
) {
140-
totalAmount += performanceRewardsSubmissions[i]
145+
totalAmount += operatorDirectedRewardsSubmissions[i]
141146
.operatorRewards[j]
142147
.amount;
143148
}
144149

145150
// Transfer token to ServiceManager and approve RewardsCoordinator to transfer again
146151
// in createAVSPerformanceRewardsSubmission() call
147-
performanceRewardsSubmissions[i].token.transferFrom(
152+
operatorDirectedRewardsSubmissions[i].token.transferFrom(
148153
msg.sender,
149154
address(this),
150155
totalAmount
151156
);
152-
uint256 allowance = performanceRewardsSubmissions[i]
157+
uint256 allowance = operatorDirectedRewardsSubmissions[i]
153158
.token
154159
.allowance(address(this), address(_rewardsCoordinator));
155-
performanceRewardsSubmissions[i].token.approve(
160+
operatorDirectedRewardsSubmissions[i].token.approve(
156161
address(_rewardsCoordinator),
157162
totalAmount + allowance
158163
);
159164
}
160165

161-
_rewardsCoordinator.createAVSPerformanceRewardsSubmission(
166+
_rewardsCoordinator.createOperatorDirectedAVSRewardsSubmission(
162167
address(this),
163-
performanceRewardsSubmissions
168+
operatorDirectedRewardsSubmissions
164169
);
165170
}
166171

src/interfaces/IServiceManager.sol

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@ interface IServiceManager is IServiceManagerUI {
2525
) external;
2626

2727
/**
28-
* @notice Creates a new performance-based rewards submission on behalf of an AVS, to be split amongst the operators and
28+
* @notice Creates a new operator-directed rewards submission on behalf of an AVS, to be split amongst the operators and
2929
* set of stakers delegated to operators who are registered to the `avs`.
30-
* @param performanceRewardsSubmissions The performance rewards submissions being created
30+
* @param operatorDirectedRewardsSubmissions The operator-directed rewards submissions being created
3131
* @dev Only callabe by the permissioned rewardsInitiator address
3232
* @dev The duration of the `rewardsSubmission` cannot exceed `MAX_REWARDS_DURATION`
3333
* @dev The tokens are sent to the `RewardsCoordinator` contract
34-
* @dev This contract needs a token approval of sum of all `operatorRewards` in the `performanceRewardsSubmissions`, before calling this function.
34+
* @dev This contract needs a token approval of sum of all `operatorRewards` in the `operatorDirectedRewardsSubmissions`, before calling this function.
3535
* @dev Strategies must be in ascending order of addresses to check for duplicates
3636
* @dev Operators must be in ascending order of addresses to check for duplicates.
37-
* @dev This function will revert if the `performanceRewardsSubmissions` is malformed.
37+
* @dev This function will revert if the `operatorDirectedRewardsSubmissions` is malformed.
3838
*/
39-
function createAVSPerformanceRewardsSubmission(
40-
IRewardsCoordinator.PerformanceRewardsSubmission[]
41-
calldata performanceRewardsSubmissions
39+
function createOperatorDirectedAVSRewardsSubmission(
40+
IRewardsCoordinator.OperatorDirectedRewardsSubmission[]
41+
calldata operatorDirectedRewardsSubmissions
4242
) external;
4343

4444
/**

src/unaudited/ECDSAServiceManagerBase.sol

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,13 @@ abstract contract ECDSAServiceManagerBase is
107107
}
108108

109109
/// @inheritdoc IServiceManager
110-
function createAVSPerformanceRewardsSubmission(
111-
IRewardsCoordinator.PerformanceRewardsSubmission[]
112-
calldata performanceRewardsSubmissions
110+
function createOperatorDirectedAVSRewardsSubmission(
111+
IRewardsCoordinator.OperatorDirectedRewardsSubmission[]
112+
calldata operatorDirectedRewardsSubmissions
113113
) external virtual onlyRewardsInitiator {
114-
_createAVSPerformanceRewardsSubmission(performanceRewardsSubmissions);
114+
_createOperatorDirectedAVSRewardsSubmission(
115+
operatorDirectedRewardsSubmissions
116+
);
115117
}
116118

117119
/// @inheritdoc IServiceManager
@@ -217,47 +219,52 @@ abstract contract ECDSAServiceManagerBase is
217219
}
218220

219221
/**
220-
* @notice Creates a new performance-based rewards submission, to be split amongst the operators and
222+
* @notice Creates a new operator-directed rewards submission, to be split amongst the operators and
221223
* set of stakers delegated to operators who are registered to this `avs`.
222-
* @param performanceRewardsSubmissions The performance rewards submissions being created.
224+
* @param operatorDirectedRewardsSubmissions The operator-directed rewards submissions being created.
223225
*/
224-
function _createAVSPerformanceRewardsSubmission(
225-
IRewardsCoordinator.PerformanceRewardsSubmission[]
226-
calldata performanceRewardsSubmissions
226+
function _createOperatorDirectedAVSRewardsSubmission(
227+
IRewardsCoordinator.OperatorDirectedRewardsSubmission[]
228+
calldata operatorDirectedRewardsSubmissions
227229
) internal virtual {
228-
for (uint256 i = 0; i < performanceRewardsSubmissions.length; ++i) {
230+
for (
231+
uint256 i = 0;
232+
i < operatorDirectedRewardsSubmissions.length;
233+
++i
234+
) {
229235
// Calculate total amount of token to transfer
230236
uint256 totalAmount = 0;
231237
for (
232238
uint256 j = 0;
233-
j < performanceRewardsSubmissions[i].operatorRewards.length;
239+
j <
240+
operatorDirectedRewardsSubmissions[i].operatorRewards.length;
234241
++j
235242
) {
236-
totalAmount += performanceRewardsSubmissions[i]
243+
totalAmount += operatorDirectedRewardsSubmissions[i]
237244
.operatorRewards[j]
238245
.amount;
239246
}
240247

241248
// Transfer token to ServiceManager and approve RewardsCoordinator to transfer again
242-
// in createAVSPerformanceRewardsSubmission() call
243-
performanceRewardsSubmissions[i].token.transferFrom(
249+
// in createOperatorDirectedAVSRewardsSubmission() call
250+
operatorDirectedRewardsSubmissions[i].token.transferFrom(
244251
msg.sender,
245252
address(this),
246253
totalAmount
247254
);
248-
uint256 allowance = performanceRewardsSubmissions[i]
255+
uint256 allowance = operatorDirectedRewardsSubmissions[i]
249256
.token
250257
.allowance(address(this), rewardsCoordinator);
251-
performanceRewardsSubmissions[i].token.approve(
258+
operatorDirectedRewardsSubmissions[i].token.approve(
252259
rewardsCoordinator,
253260
totalAmount + allowance
254261
);
255262
}
256263

257264
IRewardsCoordinator(rewardsCoordinator)
258-
.createAVSPerformanceRewardsSubmission(
265+
.createOperatorDirectedAVSRewardsSubmission(
259266
address(this),
260-
performanceRewardsSubmissions
267+
operatorDirectedRewardsSubmissions
261268
);
262269
}
263270

test/mocks/RewardsCoordinatorMock.sol

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,7 @@ contract RewardsCoordinatorMock is IRewardsCoordinator {
2727
IERC20 token
2828
) external view returns (uint256) {}
2929

30-
function globalOperatorCommissionBips() external view returns (uint16) {}
31-
32-
function operatorCommissionBips(
33-
address operator,
34-
address avs
35-
) external view returns (uint16) {}
30+
function defaultOperatorSplitBips() external view returns (uint16) {}
3631

3732
function calculateEarnerLeafHash(
3833
EarnerTreeMerkleLeaf calldata leaf
@@ -76,12 +71,12 @@ contract RewardsCoordinatorMock is IRewardsCoordinator {
7671

7772
function domainSeparator() external view returns (bytes32) {}
7873

79-
function getOperatorAVSCommission(
74+
function getOperatorAVSSplit(
8075
address operator,
8176
address avs
8277
) external view returns (uint16) {}
8378

84-
function getOperatorPICommission(
79+
function getOperatorPISplit(
8580
address operator
8681
) external view returns (uint16) {}
8782

@@ -97,9 +92,10 @@ contract RewardsCoordinatorMock is IRewardsCoordinator {
9792
RewardsSubmission[] calldata rewardsSubmissions
9893
) external {}
9994

100-
function createAVSPerformanceRewardsSubmission(
95+
function createOperatorDirectedAVSRewardsSubmission(
10196
address avs,
102-
PerformanceRewardsSubmission[] calldata performanceRewardsSubmissions
97+
OperatorDirectedRewardsSubmission[]
98+
calldata operatorDirectedRewardsSubmissions
10399
) external {}
104100

105101
function processClaim(
@@ -123,9 +119,7 @@ contract RewardsCoordinatorMock is IRewardsCoordinator {
123119

124120
function setActivationDelay(uint32 _activationDelay) external {}
125121

126-
function setGlobalOperatorCommission(
127-
uint16 _globalCommissionBips
128-
) external {}
122+
function setDefaultOperatorSplit(uint16 split) external {}
129123

130124
function setRewardsUpdater(address _rewardsUpdater) external {}
131125

@@ -134,14 +128,11 @@ contract RewardsCoordinatorMock is IRewardsCoordinator {
134128
bool _newValue
135129
) external {}
136130

137-
function setOperatorAVSCommission(
131+
function setOperatorAVSSplit(
138132
address operator,
139133
address avs,
140-
uint16 commission
134+
uint16 split
141135
) external {}
142136

143-
function setOperatorPICommission(
144-
address operator,
145-
uint16 commission
146-
) external {}
137+
function setOperatorPISplit(address operator, uint16 split) external {}
147138
}

0 commit comments

Comments
 (0)