Skip to content

Commit f4b0d57

Browse files
committed
chore: fmt
1 parent db81923 commit f4b0d57

File tree

3 files changed

+186
-194
lines changed

3 files changed

+186
-194
lines changed

src/ServiceManagerBase.sol

Lines changed: 55 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ pragma solidity ^0.8.12;
44
import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol";
55
import {Initializable} from "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";
66
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";
89

910
import {IOperatorSetManager, IStrategy} from "./interfaces/IOperatorSetManager.sol"; // should be later changed to be import from core
1011
import {ServiceManagerBaseStorage} from "./ServiceManagerBaseStorage.sol";
@@ -76,24 +77,18 @@ abstract contract ServiceManagerBase is OwnableUpgradeable, ServiceManagerBaseSt
7677

7778
/// TODO: natspec
7879
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);
8684
}
8785

8886
/// TODO: natspec
8987
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);
9792
}
9893

9994
/// @notice migrates all existing operators and strategies to operator sets
@@ -112,10 +107,7 @@ abstract contract ServiceManagerBase is OwnableUpgradeable, ServiceManagerBaseSt
112107
strategies[j] = strategy;
113108
}
114109

115-
_operatorSetManager.addStrategiesToOperatorSet(
116-
uint32(i),
117-
strategies
118-
);
110+
_operatorSetManager.addStrategiesToOperatorSet(uint32(i), strategies);
119111
}
120112
isStrategiesMigrated = true;
121113
}
@@ -125,19 +117,15 @@ abstract contract ServiceManagerBase is OwnableUpgradeable, ServiceManagerBaseSt
125117
* for. This can be called externally by getOperatorSetIds
126118
*/
127119
function migrateOperatorToOperatorSets(
128-
ISignatureUtils.SignatureWithSaltAndExpiry memory signature
120+
ISignatureUtils.SignatureWithSaltAndExpiry memory signature
129121
) external {
130122
require(
131123
!isOperatorMigrated[msg.sender],
132124
"ServiceManagerBase.migrateOperatorToOperatorSets: already migrated"
133125
);
134126
uint32[] memory operatorSetIds = getOperatorSetIds(msg.sender);
135127

136-
_operatorSetManager.registerOperatorToOperatorSets(
137-
msg.sender,
138-
operatorSetIds,
139-
signature
140-
);
128+
_operatorSetManager.registerOperatorToOperatorSets(msg.sender, operatorSetIds, signature);
141129
}
142130

143131
/**
@@ -160,15 +148,15 @@ abstract contract ServiceManagerBase is OwnableUpgradeable, ServiceManagerBaseSt
160148
* @dev This function will revert if the `rewardsSubmission` is malformed,
161149
* e.g. if the `strategies` and `weights` arrays are of non-equal lengths
162150
*/
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 {
168154
for (uint256 i = 0; i < rewardsSubmissions.length; ++i) {
169155
// transfer token to ServiceManager and approve RewardsCoordinator to transfer again
170156
// 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+
);
172160
uint256 allowance =
173161
rewardsSubmissions[i].token.allowance(address(this), address(_rewardsCoordinator));
174162
rewardsSubmissions[i].token.approve(
@@ -192,53 +180,46 @@ abstract contract ServiceManagerBase is OwnableUpgradeable, ServiceManagerBaseSt
192180
}
193181

194182
/**
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 {
211199
uint32[] memory operatorSetIds = quorumsToOperatorSetIds(quorumNumbers);
212-
_operatorSetManager.registerOperatorToOperatorSets(
213-
operator,
214-
operatorSetIds,
215-
signature
216-
);
200+
_operatorSetManager.registerOperatorToOperatorSets(operator, operatorSetIds, signature);
217201
}
218202

219203
/**
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
229213
* @dev if this removes operator from all operator sets for the msg.sender AVS
230214
* then an OperatorAVSRegistrationStatusUpdated event is emitted with a DEREGISTERED
231215
* status
232-
*/
233-
function deregisterOperatorFromOperatorSets(
234-
address operator,
216+
*/
217+
function deregisterOperatorFromOperatorSets(
218+
address operator,
235219
bytes calldata quorumNumbers
236-
) external onlyRegistryCoordinator {
220+
) external onlyRegistryCoordinator {
237221
uint32[] memory operatorSetIds = quorumsToOperatorSetIds(quorumNumbers);
238-
_operatorSetManager.deregisterOperatorFromOperatorSets(
239-
operator,
240-
operatorSetIds
241-
);
222+
_operatorSetManager.deregisterOperatorFromOperatorSets(operator, operatorSetIds);
242223
}
243224

244225
/**
@@ -328,7 +309,11 @@ abstract contract ServiceManagerBase is OwnableUpgradeable, ServiceManagerBaseSt
328309
}
329310

330311
/// @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+
{
332317
uint256 quorumCount = quorumNumbers.length;
333318
uint32[] memory operatorSetIds = new uint32[](quorumCount);
334319
for (uint256 i = 0; i < quorumCount; i++) {

0 commit comments

Comments
 (0)