Skip to content

Commit 6f43c63

Browse files
feat: inheritdoc (#775)
* feat: inheritdoc * refactor: natspec/interface improvements * feat: inheritdoc * refactor: natspec/interface improvements
1 parent 87daa10 commit 6f43c63

File tree

10 files changed

+145
-356
lines changed

10 files changed

+145
-356
lines changed

src/contracts/core/AVSDirectory.sol

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,7 @@ contract AVSDirectory is
5656
*
5757
*/
5858

59-
/**
60-
* @notice Called by the AVS's service manager contract to register an operator with the avs.
61-
* @param operator The address of the operator to register.
62-
* @param operatorSignature The signature, salt, and expiry of the operator's signature.
63-
*/
59+
/// @inheritdoc IAVSDirectory
6460
function registerOperatorToAVS(
6561
address operator,
6662
ISignatureUtils.SignatureWithSaltAndExpiry memory operatorSignature
@@ -107,10 +103,7 @@ contract AVSDirectory is
107103
emit OperatorAVSRegistrationStatusUpdated(operator, msg.sender, OperatorAVSRegistrationStatus.REGISTERED);
108104
}
109105

110-
/**
111-
* @notice Called by an avs to deregister an operator with the avs.
112-
* @param operator The address of the operator to deregister.
113-
*/
106+
/// @inheritdoc IAVSDirectory
114107
function deregisterOperatorFromAVS(address operator)
115108
external
116109
onlyWhenNotPaused(PAUSED_OPERATOR_REGISTER_DEREGISTER_TO_AVS)
@@ -126,18 +119,12 @@ contract AVSDirectory is
126119
emit OperatorAVSRegistrationStatusUpdated(operator, msg.sender, OperatorAVSRegistrationStatus.UNREGISTERED);
127120
}
128121

129-
/**
130-
* @notice Called by an avs to emit an `AVSMetadataURIUpdated` event indicating the information has updated.
131-
* @param metadataURI The URI for metadata associated with an avs
132-
*/
122+
/// @inheritdoc IAVSDirectory
133123
function updateAVSMetadataURI(string calldata metadataURI) external {
134124
emit AVSMetadataURIUpdated(msg.sender, metadataURI);
135125
}
136126

137-
/**
138-
* @notice Called by an operator to cancel a salt that has been used to register with an AVS.
139-
* @param salt A unique and single use value associated with the approver signature.
140-
*/
127+
/// @inheritdoc IAVSDirectory
141128
function cancelSalt(bytes32 salt) external {
142129
require(!operatorSaltIsSpent[msg.sender][salt], "AVSDirectory.cancelSalt: cannot cancel spent salt");
143130
operatorSaltIsSpent[msg.sender][salt] = true;
@@ -149,13 +136,7 @@ contract AVSDirectory is
149136
*
150137
*/
151138

152-
/**
153-
* @notice Calculates the digest hash to be signed by an operator to register with an AVS
154-
* @param operator The account registering as an operator
155-
* @param avs The address of the service manager contract for the AVS that the operator is registering to
156-
* @param salt A unique and single use value associated with the approver signature.
157-
* @param expiry Time after which the approver's signature becomes invalid
158-
*/
139+
/// @inheritdoc IAVSDirectory
159140
function calculateOperatorAVSRegistrationDigestHash(
160141
address operator,
161142
address avs,
@@ -169,10 +150,7 @@ contract AVSDirectory is
169150
return digestHash;
170151
}
171152

172-
/**
173-
* @notice Getter function for the current EIP-712 domain separator for this contract.
174-
* @dev The domain separator will change in the event of a fork that changes the ChainID.
175-
*/
153+
/// @inheritdoc IAVSDirectory
176154
function domainSeparator() public view returns (bytes32) {
177155
if (block.chainid == ORIGINAL_CHAIN_ID) {
178156
return _DOMAIN_SEPARATOR;

src/contracts/core/DelegationManager.sol

Lines changed: 26 additions & 167 deletions
Large diffs are not rendered by default.

src/contracts/core/RewardsCoordinator.sol

Lines changed: 21 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,7 @@ contract RewardsCoordinator is
117117
*
118118
*/
119119

120-
/**
121-
* @notice Creates a new rewards submission on behalf of an AVS, to be split amongst the
122-
* set of stakers delegated to operators who are registered to the `avs`
123-
* @param rewardsSubmissions The rewards submissions being created
124-
* @dev Expected to be called by the ServiceManager of the AVS on behalf of which the submission is being made
125-
* @dev The duration of the `rewardsSubmission` cannot exceed `MAX_REWARDS_DURATION`
126-
* @dev The tokens are sent to the `RewardsCoordinator` contract
127-
* @dev Strategies must be in ascending order of addresses to check for duplicates
128-
* @dev This function will revert if the `rewardsSubmission` is malformed,
129-
* e.g. if the `strategies` and `weights` arrays are of non-equal lengths
130-
*/
120+
/// @inheritdoc IRewardsCoordinator
131121
function createAVSRewardsSubmission(RewardsSubmission[] calldata rewardsSubmissions)
132122
external
133123
onlyWhenNotPaused(PAUSED_AVS_REWARDS_SUBMISSION)
@@ -148,12 +138,7 @@ contract RewardsCoordinator is
148138
}
149139
}
150140

151-
/**
152-
* @notice similar to `createAVSRewardsSubmission` except the rewards are split amongst *all* stakers
153-
* rather than just those delegated to operators who are registered to a single avs and is
154-
* a permissioned call based on isRewardsForAllSubmitter mapping.
155-
* @param rewardsSubmissions The rewards submissions being created
156-
*/
141+
/// @inheritdoc IRewardsCoordinator
157142
function createRewardsForAllSubmission(RewardsSubmission[] calldata rewardsSubmissions)
158143
external
159144
onlyWhenNotPaused(PAUSED_REWARDS_FOR_ALL_SUBMISSION)
@@ -175,13 +160,7 @@ contract RewardsCoordinator is
175160
}
176161
}
177162

178-
/**
179-
* @notice Creates a new rewards submission for all earners across all AVSs.
180-
* Earners in this case indicating all operators and their delegated stakers. Undelegated stake
181-
* is not rewarded from this RewardsSubmission. This interface is only callable
182-
* by the token hopper contract from the Eigen Foundation
183-
* @param rewardsSubmissions The rewards submissions being created
184-
*/
163+
/// @inheritdoc IRewardsCoordinator
185164
function createRewardsForAllEarners(RewardsSubmission[] calldata rewardsSubmissions)
186165
external
187166
onlyWhenNotPaused(PAUSED_REWARD_ALL_STAKERS_AND_OPERATORS)
@@ -205,18 +184,7 @@ contract RewardsCoordinator is
205184
}
206185
}
207186

208-
/**
209-
* @notice Claim rewards against a given root (read from _distributionRoots[claim.rootIndex]).
210-
* Earnings are cumulative so earners don't have to claim against all distribution roots they have earnings for,
211-
* they can simply claim against the latest root and the contract will calculate the difference between
212-
* their cumulativeEarnings and cumulativeClaimed. This difference is then transferred to recipient address.
213-
* @param claim The RewardsMerkleClaim to be processed.
214-
* Contains the root index, earner, token leaves, and required proofs
215-
* @param recipient The address recipient that receives the ERC20 rewards
216-
* @dev only callable by the valid claimer, that is
217-
* if claimerFor[claim.earner] is address(0) then only the earner can claim, otherwise only
218-
* claimerFor[claim.earner] can claim the rewards.
219-
*/
187+
/// @inheritdoc IRewardsCoordinator
220188
function processClaim(
221189
RewardsMerkleClaim calldata claim,
222190
address recipient
@@ -248,12 +216,7 @@ contract RewardsCoordinator is
248216
}
249217
}
250218

251-
/**
252-
* @notice Creates a new distribution root. activatedAt is set to block.timestamp + activationDelay
253-
* @param root The merkle root of the distribution
254-
* @param rewardsCalculationEndTimestamp The timestamp until which rewards have been calculated
255-
* @dev Only callable by the rewardsUpdater
256-
*/
219+
/// @inheritdoc IRewardsCoordinator
257220
function submitRoot(
258221
bytes32 root,
259222
uint32 rewardsCalculationEndTimestamp
@@ -280,10 +243,7 @@ contract RewardsCoordinator is
280243
emit DistributionRootSubmitted(rootIndex, root, rewardsCalculationEndTimestamp, activatedAt);
281244
}
282245

283-
/**
284-
* @notice allow the rewardsUpdater to disable/cancel a pending root submission in case of an error
285-
* @param rootIndex The index of the root to be disabled
286-
*/
246+
/// @inheritdoc IRewardsCoordinator
287247
function disableRoot(uint32 rootIndex) external onlyWhenNotPaused(PAUSED_SUBMIT_DISABLE_ROOTS) onlyRewardsUpdater {
288248
require(rootIndex < _distributionRoots.length, "RewardsCoordinator.disableRoot: invalid rootIndex");
289249
DistributionRoot storage root = _distributionRoots[rootIndex];
@@ -293,51 +253,30 @@ contract RewardsCoordinator is
293253
emit DistributionRootDisabled(rootIndex);
294254
}
295255

296-
/**
297-
* @notice Sets the address of the entity that can call `processClaim` on behalf of the earner (msg.sender)
298-
* @param claimer The address of the entity that can call `processClaim` on behalf of the earner
299-
* @dev Only callable by the `earner`
300-
*/
256+
/// @inheritdoc IRewardsCoordinator
301257
function setClaimerFor(address claimer) external {
302258
address earner = msg.sender;
303259
address prevClaimer = claimerFor[earner];
304260
claimerFor[earner] = claimer;
305261
emit ClaimerForSet(earner, prevClaimer, claimer);
306262
}
307263

308-
/**
309-
* @notice Sets the delay in timestamp before a posted root can be claimed against
310-
* @dev Only callable by the contract owner
311-
* @param _activationDelay The new value for activationDelay
312-
*/
264+
/// @inheritdoc IRewardsCoordinator
313265
function setActivationDelay(uint32 _activationDelay) external onlyOwner {
314266
_setActivationDelay(_activationDelay);
315267
}
316268

317-
/**
318-
* @notice Sets the global commission for all operators across all avss
319-
* @dev Only callable by the contract owner
320-
* @param _globalCommissionBips The commission for all operators across all avss
321-
*/
269+
/// @inheritdoc IRewardsCoordinator
322270
function setGlobalOperatorCommission(uint16 _globalCommissionBips) external onlyOwner {
323271
_setGlobalOperatorCommission(_globalCommissionBips);
324272
}
325273

326-
/**
327-
* @notice Sets the permissioned `rewardsUpdater` address which can post new roots
328-
* @dev Only callable by the contract owner
329-
* @param _rewardsUpdater The address of the new rewardsUpdater
330-
*/
274+
/// @inheritdoc IRewardsCoordinator
331275
function setRewardsUpdater(address _rewardsUpdater) external onlyOwner {
332276
_setRewardsUpdater(_rewardsUpdater);
333277
}
334278

335-
/**
336-
* @notice Sets the permissioned `rewardsForAllSubmitter` address which can submit createRewardsForAllSubmission
337-
* @dev Only callable by the contract owner
338-
* @param _submitter The address of the rewardsForAllSubmitter
339-
* @param _newValue The new value for isRewardsForAllSubmitter
340-
*/
279+
/// @inheritdoc IRewardsCoordinator
341280
function setRewardsForAllSubmitter(address _submitter, bool _newValue) external onlyOwner {
342281
bool prevValue = isRewardsForAllSubmitter[_submitter];
343282
emit RewardsForAllSubmitterSet(_submitter, prevValue, _newValue);
@@ -521,44 +460,43 @@ contract RewardsCoordinator is
521460
*
522461
*/
523462

524-
/// @notice return the hash of the earner's leaf
463+
/// @inheritdoc IRewardsCoordinator
525464
function calculateEarnerLeafHash(EarnerTreeMerkleLeaf calldata leaf) public pure returns (bytes32) {
526465
return keccak256(abi.encodePacked(EARNER_LEAF_SALT, leaf.earner, leaf.earnerTokenRoot));
527466
}
528467

529-
/// @notice returns the hash of the earner's token leaf
468+
/// @inheritdoc IRewardsCoordinator
530469
function calculateTokenLeafHash(TokenTreeMerkleLeaf calldata leaf) public pure returns (bytes32) {
531470
return keccak256(abi.encodePacked(TOKEN_LEAF_SALT, leaf.token, leaf.cumulativeEarnings));
532471
}
533472

534-
/// @notice returns 'true' if the claim would currently pass the check in `processClaims`
535-
/// but will revert if not valid
473+
/// @inheritdoc IRewardsCoordinator
536474
function checkClaim(RewardsMerkleClaim calldata claim) public view returns (bool) {
537475
_checkClaim(claim, _distributionRoots[claim.rootIndex]);
538476
return true;
539477
}
540478

541-
/// @notice the commission for a specific operator for a specific avs
542-
/// NOTE: Currently unused and simply returns the globalOperatorCommissionBips value but will be used in future release
479+
/// @inheritdoc IRewardsCoordinator
543480
function operatorCommissionBips(address operator, address avs) external view returns (uint16) {
544481
return globalOperatorCommissionBips;
545482
}
546483

484+
/// @inheritdoc IRewardsCoordinator
547485
function getDistributionRootsLength() public view returns (uint256) {
548486
return _distributionRoots.length;
549487
}
550488

489+
/// @inheritdoc IRewardsCoordinator
551490
function getDistributionRootAtIndex(uint256 index) external view returns (DistributionRoot memory) {
552491
return _distributionRoots[index];
553492
}
554493

555-
/// @notice loop through the distribution roots from reverse and get latest root that is not disabled
494+
/// @inheritdoc IRewardsCoordinator
556495
function getCurrentDistributionRoot() external view returns (DistributionRoot memory) {
557496
return _distributionRoots[_distributionRoots.length - 1];
558497
}
559498

560-
/// @notice loop through the distribution roots from reverse and get latest root that is not disabled and activated
561-
/// i.e. a root that can be claimed against
499+
/// @inheritdoc IRewardsCoordinator
562500
function getCurrentClaimableDistributionRoot() external view returns (DistributionRoot memory) {
563501
for (uint256 i = _distributionRoots.length; i > 0; i--) {
564502
DistributionRoot memory root = _distributionRoots[i - 1];
@@ -568,7 +506,7 @@ contract RewardsCoordinator is
568506
}
569507
}
570508

571-
/// @notice loop through distribution roots from reverse and return hash
509+
/// @inheritdoc IRewardsCoordinator
572510
function getRootIndexFromHash(bytes32 rootHash) public view returns (uint32) {
573511
for (uint32 i = uint32(_distributionRoots.length); i > 0; i--) {
574512
if (_distributionRoots[i - 1].root == rootHash) {
@@ -578,13 +516,7 @@ contract RewardsCoordinator is
578516
revert("RewardsCoordinator.getRootIndexFromHash: root not found");
579517
}
580518

581-
/**
582-
* @notice Getter function for the current EIP-712 domain separator for this contract.
583-
*
584-
* @dev The domain separator will change in the event of a fork that changes the ChainID.
585-
* @dev By introducing a domain separator the DApp developers are guaranteed that there can be no signature collision.
586-
* for more detailed information please read EIP-712.
587-
*/
519+
/// @inheritdoc IRewardsCoordinator
588520
function domainSeparator() public view returns (bytes32) {
589521
if (block.chainid == ORIGINAL_CHAIN_ID) {
590522
return _DOMAIN_SEPARATOR;

0 commit comments

Comments
 (0)