@@ -4,7 +4,8 @@ pragma solidity ^0.8.12;
4
4
import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol " ;
5
5
import {Initializable} from "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol " ;
6
6
import {ISignatureUtils} from "eigenlayer-contracts/src/contracts/interfaces/ISignatureUtils.sol " ;
7
- import {IRewardsCoordinator} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol " ;
7
+ import {IRewardsCoordinator} from
8
+ "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol " ;
8
9
9
10
import {IOperatorSetManager, IStrategy} from "./interfaces/IOperatorSetManager.sol " ; // should be later changed to be import from core
10
11
import {ServiceManagerBaseStorage} from "./ServiceManagerBaseStorage.sol " ;
@@ -76,24 +77,18 @@ abstract contract ServiceManagerBase is OwnableUpgradeable, ServiceManagerBaseSt
76
77
77
78
/// TODO: natspec
78
79
function addStrategiesToOperatorSet (
79
- uint32 operatorSetID ,
80
- IStrategy[] calldata strategies
81
- ) external onlyStakeRegistry {
82
- _operatorSetManager.addStrategiesToOperatorSet (
83
- operatorSetID,
84
- strategies
85
- );
80
+ uint32 operatorSetID ,
81
+ IStrategy[] calldata strategies
82
+ ) external onlyStakeRegistry {
83
+ _operatorSetManager.addStrategiesToOperatorSet (operatorSetID, strategies);
86
84
}
87
85
88
86
/// TODO: natspec
89
87
function removeStrategiesFromOperatorSet (
90
- uint32 operatorSetID ,
91
- IStrategy[] calldata strategies
92
- ) external onlyStakeRegistry {
93
- _operatorSetManager.removeStrategiesFromOperatorSet (
94
- operatorSetID,
95
- strategies
96
- );
88
+ uint32 operatorSetID ,
89
+ IStrategy[] calldata strategies
90
+ ) external onlyStakeRegistry {
91
+ _operatorSetManager.removeStrategiesFromOperatorSet (operatorSetID, strategies);
97
92
}
98
93
99
94
/// @notice migrates all existing operators and strategies to operator sets
@@ -112,10 +107,7 @@ abstract contract ServiceManagerBase is OwnableUpgradeable, ServiceManagerBaseSt
112
107
strategies[j] = strategy;
113
108
}
114
109
115
- _operatorSetManager.addStrategiesToOperatorSet (
116
- uint32 (i),
117
- strategies
118
- );
110
+ _operatorSetManager.addStrategiesToOperatorSet (uint32 (i), strategies);
119
111
}
120
112
isStrategiesMigrated = true ;
121
113
}
@@ -125,19 +117,15 @@ abstract contract ServiceManagerBase is OwnableUpgradeable, ServiceManagerBaseSt
125
117
* for. This can be called externally by getOperatorSetIds
126
118
*/
127
119
function migrateOperatorToOperatorSets (
128
- ISignatureUtils.SignatureWithSaltAndExpiry memory signature
120
+ ISignatureUtils.SignatureWithSaltAndExpiry memory signature
129
121
) external {
130
122
require (
131
123
! isOperatorMigrated[msg .sender ],
132
124
"ServiceManagerBase.migrateOperatorToOperatorSets: already migrated "
133
125
);
134
126
uint32 [] memory operatorSetIds = getOperatorSetIds (msg .sender );
135
127
136
- _operatorSetManager.registerOperatorToOperatorSets (
137
- msg .sender ,
138
- operatorSetIds,
139
- signature
140
- );
128
+ _operatorSetManager.registerOperatorToOperatorSets (msg .sender , operatorSetIds, signature);
141
129
}
142
130
143
131
/**
@@ -160,15 +148,15 @@ abstract contract ServiceManagerBase is OwnableUpgradeable, ServiceManagerBaseSt
160
148
* @dev This function will revert if the `rewardsSubmission` is malformed,
161
149
* e.g. if the `strategies` and `weights` arrays are of non-equal lengths
162
150
*/
163
- function createAVSRewardsSubmission (IRewardsCoordinator.RewardsSubmission[] calldata rewardsSubmissions )
164
- public
165
- virtual
166
- onlyRewardsInitiator
167
- {
151
+ function createAVSRewardsSubmission (
152
+ IRewardsCoordinator.RewardsSubmission[] calldata rewardsSubmissions
153
+ ) public virtual onlyRewardsInitiator {
168
154
for (uint256 i = 0 ; i < rewardsSubmissions.length ; ++ i) {
169
155
// transfer token to ServiceManager and approve RewardsCoordinator to transfer again
170
156
// in createAVSRewardsSubmission() call
171
- rewardsSubmissions[i].token.transferFrom (msg .sender , address (this ), rewardsSubmissions[i].amount);
157
+ rewardsSubmissions[i].token.transferFrom (
158
+ msg .sender , address (this ), rewardsSubmissions[i].amount
159
+ );
172
160
uint256 allowance =
173
161
rewardsSubmissions[i].token.allowance (address (this ), address (_rewardsCoordinator));
174
162
rewardsSubmissions[i].token.approve (
@@ -192,53 +180,46 @@ abstract contract ServiceManagerBase is OwnableUpgradeable, ServiceManagerBaseSt
192
180
}
193
181
194
182
/**
195
- * @notice Called by this AVS's RegistryCoordinator to register an operator for its registering operatorSets
196
- *
197
- * @param operator the address of the operator to be added to the operator set
198
- * @param quorumNumbers quorums/operatorSetIds to add the operator to
199
- * @param signature the signature of the operator on their intent to register
200
- * @dev msg.sender is used as the AVS
201
- * @dev operator must not have a pending a deregistration from the operator set
202
- * @dev if this is the first operator set in the AVS that the operator is
203
- * registering for, a OperatorAVSRegistrationStatusUpdated event is emitted with
204
- * a REGISTERED status
205
- */
206
- function registerOperatorToOperatorSets (
207
- address operator ,
208
- bytes calldata quorumNumbers ,
209
- ISignatureUtils.SignatureWithSaltAndExpiry memory signature
210
- ) external onlyRegistryCoordinator {
183
+ * @notice Called by this AVS's RegistryCoordinator to register an operator for its registering operatorSets
184
+ *
185
+ * @param operator the address of the operator to be added to the operator set
186
+ * @param quorumNumbers quorums/operatorSetIds to add the operator to
187
+ * @param signature the signature of the operator on their intent to register
188
+ * @dev msg.sender is used as the AVS
189
+ * @dev operator must not have a pending a deregistration from the operator set
190
+ * @dev if this is the first operator set in the AVS that the operator is
191
+ * registering for, a OperatorAVSRegistrationStatusUpdated event is emitted with
192
+ * a REGISTERED status
193
+ */
194
+ function registerOperatorToOperatorSets (
195
+ address operator ,
196
+ bytes calldata quorumNumbers ,
197
+ ISignatureUtils.SignatureWithSaltAndExpiry memory signature
198
+ ) external onlyRegistryCoordinator {
211
199
uint32 [] memory operatorSetIds = quorumsToOperatorSetIds (quorumNumbers);
212
- _operatorSetManager.registerOperatorToOperatorSets (
213
- operator,
214
- operatorSetIds,
215
- signature
216
- );
200
+ _operatorSetManager.registerOperatorToOperatorSets (operator, operatorSetIds, signature);
217
201
}
218
202
219
203
/**
220
- * @notice Called by this AVS's RegistryCoordinator to deregister an operator for its operatorSets
221
- *
222
- * @param operator the address of the operator to be removed from the
223
- * operator set
224
- * @param quorumNumbers the quorumNumbers/operatorSetIds to deregister the operator for
225
- *
226
- * @dev msg.sender is used as the AVS
227
- * @dev operator must be registered for msg.sender AVS and the given
228
- * operator set
204
+ * @notice Called by this AVS's RegistryCoordinator to deregister an operator for its operatorSets
205
+ *
206
+ * @param operator the address of the operator to be removed from the
207
+ * operator set
208
+ * @param quorumNumbers the quorumNumbers/operatorSetIds to deregister the operator for
209
+ *
210
+ * @dev msg.sender is used as the AVS
211
+ * @dev operator must be registered for msg.sender AVS and the given
212
+ * operator set
229
213
* @dev if this removes operator from all operator sets for the msg.sender AVS
230
214
* then an OperatorAVSRegistrationStatusUpdated event is emitted with a DEREGISTERED
231
215
* status
232
- */
233
- function deregisterOperatorFromOperatorSets (
234
- address operator ,
216
+ */
217
+ function deregisterOperatorFromOperatorSets (
218
+ address operator ,
235
219
bytes calldata quorumNumbers
236
- ) external onlyRegistryCoordinator {
220
+ ) external onlyRegistryCoordinator {
237
221
uint32 [] memory operatorSetIds = quorumsToOperatorSetIds (quorumNumbers);
238
- _operatorSetManager.deregisterOperatorFromOperatorSets (
239
- operator,
240
- operatorSetIds
241
- );
222
+ _operatorSetManager.deregisterOperatorFromOperatorSets (operator, operatorSetIds);
242
223
}
243
224
244
225
/**
@@ -328,7 +309,11 @@ abstract contract ServiceManagerBase is OwnableUpgradeable, ServiceManagerBaseSt
328
309
}
329
310
330
311
/// @notice converts the quorumNumbers array to operatorSetIds array
331
- function quorumsToOperatorSetIds (bytes memory quorumNumbers ) internal pure returns (uint32 [] memory ) {
312
+ function quorumsToOperatorSetIds (bytes memory quorumNumbers )
313
+ internal
314
+ pure
315
+ returns (uint32 [] memory )
316
+ {
332
317
uint256 quorumCount = quorumNumbers.length ;
333
318
uint32 [] memory operatorSetIds = new uint32 [](quorumCount);
334
319
for (uint256 i = 0 ; i < quorumCount; i++ ) {
0 commit comments