Skip to content

Commit 28c5bda

Browse files
committed
chore: natspec and other documentation changes
Signed-off-by: Tomás Migone <[email protected]>
1 parent 5a4a550 commit 28c5bda

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+827
-504
lines changed

packages/horizon/contracts/data-service/DataService.sol

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,38 +35,29 @@ abstract contract DataService is GraphDirectory, ProvisionManager, DataServiceV1
3535
*/
3636
constructor(address controller) GraphDirectory(controller) {}
3737

38-
/**
39-
* @notice See {IDataService-getThawingPeriodRange}.
40-
*/
38+
/// @inheritdoc IDataService
4139
function getThawingPeriodRange() external view returns (uint64, uint64) {
4240
return _getThawingPeriodRange();
4341
}
4442

45-
/**
46-
* @notice See {IDataService-getVerifierCutRange}.
47-
*/
43+
/// @inheritdoc IDataService
4844
function getVerifierCutRange() external view returns (uint32, uint32) {
4945
return _getVerifierCutRange();
5046
}
5147

52-
/**
53-
* @notice See {IDataService-getProvisionTokensRange}.
54-
*/
48+
/// @inheritdoc IDataService
5549
function getProvisionTokensRange() external view returns (uint256, uint256) {
5650
return _getProvisionTokensRange();
5751
}
5852

59-
/**
60-
* @notice See {IDataService-getDelegationRatio}.
61-
*/
53+
/// @inheritdoc IDataService
6254
function getDelegationRatio() external view returns (uint32) {
6355
return _getDelegationRatio();
6456
}
6557

6658
/**
6759
* @notice Initializes the contract and any parent contracts.
6860
*/
69-
// solhint-disable-next-line func-name-mixedcase
7061
function __DataService_init() internal onlyInitializing {
7162
__ProvisionManager_init_unchained();
7263
__DataService_init_unchained();
@@ -75,6 +66,5 @@ abstract contract DataService is GraphDirectory, ProvisionManager, DataServiceV1
7566
/**
7667
* @notice Initializes the contract.
7768
*/
78-
// solhint-disable-next-line func-name-mixedcase
7969
function __DataService_init_unchained() internal onlyInitializing {}
8070
}

packages/horizon/contracts/data-service/extensions/DataServiceFees.sol

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ abstract contract DataServiceFees is DataService, DataServiceFeesV1Storage, IDat
2121
using ProvisionTracker for mapping(address => uint256);
2222
using LinkedList for LinkedList.List;
2323

24-
/**
25-
* @notice See {IDataServiceFees-releaseStake}
26-
*/
24+
/// @inheritdoc IDataServiceFees
2725
function releaseStake(uint256 numClaimsToRelease) external virtual override {
2826
_releaseStake(msg.sender, numClaimsToRelease);
2927
}
@@ -42,7 +40,7 @@ abstract contract DataServiceFees is DataService, DataServiceFeesV1Storage, IDat
4240
*/
4341
function _lockStake(address _serviceProvider, uint256 _tokens, uint256 _unlockTimestamp) internal {
4442
require(_tokens != 0, DataServiceFeesZeroTokens());
45-
feesProvisionTracker.lock(_graphStaking(), _serviceProvider, _tokens, delegationRatio);
43+
feesProvisionTracker.lock(_graphStaking(), _serviceProvider, _tokens, _delegationRatio);
4644

4745
LinkedList.List storage claimsList = claimsLists[_serviceProvider];
4846

@@ -61,7 +59,11 @@ abstract contract DataServiceFees is DataService, DataServiceFeesV1Storage, IDat
6159
}
6260

6361
/**
64-
* @notice See {IDataServiceFees-releaseStake}
62+
* @notice Releases expired stake claims for a service provider.
63+
* @dev This function can be overriden and/or disabled.
64+
* @dev Emits a {StakeClaimsReleased} event, and a {StakeClaimReleased} event for each claim released.
65+
* @param _serviceProvider The address of the service provider
66+
* @param _numClaimsToRelease Amount of stake claims to process. If 0, all stake claims are processed.
6567
*/
6668
function _releaseStake(address _serviceProvider, uint256 _numClaimsToRelease) internal {
6769
LinkedList.List storage claimsList = claimsLists[_serviceProvider];
@@ -116,6 +118,7 @@ abstract contract DataServiceFees is DataService, DataServiceFeesV1Storage, IDat
116118
/**
117119
* @notice Gets the details of a stake claim
118120
* @param _claimId The ID of the stake claim
121+
* @return The stake claim details
119122
*/
120123
function _getStakeClaim(bytes32 _claimId) private view returns (StakeClaim memory) {
121124
StakeClaim memory claim = claims[_claimId];
@@ -127,6 +130,7 @@ abstract contract DataServiceFees is DataService, DataServiceFeesV1Storage, IDat
127130
* @notice Gets the next stake claim in the linked list
128131
* @dev This function is used as a callback in the stake claims linked list traversal.
129132
* @param _claimId The ID of the stake claim
133+
* @return The next stake claim ID
130134
*/
131135
function _getNextStakeClaim(bytes32 _claimId) private view returns (bytes32) {
132136
return claims[_claimId].nextClaim;
@@ -136,6 +140,7 @@ abstract contract DataServiceFees is DataService, DataServiceFeesV1Storage, IDat
136140
* @notice Builds a stake claim ID
137141
* @param _serviceProvider The address of the service provider
138142
* @param _nonce A nonce of the stake claim
143+
* @return The stake claim ID
139144
*/
140145
function _buildStakeClaimId(address _serviceProvider, uint256 _nonce) private view returns (bytes32) {
141146
return keccak256(abi.encodePacked(address(this), _serviceProvider, _nonce));

packages/horizon/contracts/data-service/extensions/DataServicePausable.sol

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,19 @@ abstract contract DataServicePausable is Pausable, DataService, IDataServicePaus
2929
_;
3030
}
3131

32-
/**
33-
* @notice See {IDataServicePausable-pause}
34-
*/
32+
/// @inheritdoc IDataServicePausable
3533
function pause() external override onlyPauseGuardian whenNotPaused {
3634
_pause();
3735
}
3836

39-
/**
40-
* @notice See {IDataServicePausable-pause}
41-
*/
37+
/// @inheritdoc IDataServicePausable
4238
function unpause() external override onlyPauseGuardian whenPaused {
4339
_unpause();
4440
}
4541

4642
/**
4743
* @notice Sets a pause guardian.
4844
* @dev Internal function to be used by the derived contract to set pause guardians.
49-
*
50-
* Emits a {PauseGuardianSet} event.
51-
*
5245
* @param _pauseGuardian The address of the pause guardian
5346
* @param _allowed The allowed status of the pause guardian
5447
*/

packages/horizon/contracts/data-service/extensions/DataServicePausableUpgradeable.sol

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,19 @@ abstract contract DataServicePausableUpgradeable is PausableUpgradeable, DataSer
2828
_;
2929
}
3030

31-
/**
32-
* @notice See {IDataServicePausable-pause}
33-
*/
31+
/// @inheritdoc IDataServicePausable
3432
function pause() external override onlyPauseGuardian whenNotPaused {
3533
_pause();
3634
}
3735

38-
/**
39-
* @notice See {IDataServicePausable-pause}
40-
*/
36+
/// @inheritdoc IDataServicePausable
4137
function unpause() external override onlyPauseGuardian whenPaused {
4238
_unpause();
4339
}
4440

4541
/**
4642
* @notice Initializes the contract and parent contracts
4743
*/
48-
// solhint-disable-next-line func-name-mixedcase
4944
function __DataServicePausable_init() internal onlyInitializing {
5045
__Pausable_init_unchained();
5146
__DataServicePausable_init_unchained();
@@ -54,7 +49,6 @@ abstract contract DataServicePausableUpgradeable is PausableUpgradeable, DataSer
5449
/**
5550
* @notice Initializes the contract
5651
*/
57-
// solhint-disable-next-line func-name-mixedcase
5852
function __DataServicePausable_init_unchained() internal onlyInitializing {}
5953

6054
/**

packages/horizon/contracts/data-service/extensions/DataServiceRescuable.sol

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,12 @@ abstract contract DataServiceRescuable is DataService, IDataServiceRescuable {
3636
_;
3737
}
3838

39-
/**
40-
* @notice See {IDataServiceRescuable-rescueGRT}
41-
*/
39+
/// @inheritdoc IDataServiceRescuable
4240
function rescueGRT(address to, uint256 tokens) external virtual onlyRescuer {
4341
_rescueTokens(to, address(_graphToken()), tokens);
4442
}
4543

46-
/**
47-
* @notice See {IDataServiceRescuable-rescueETH}
48-
*/
44+
/// @inheritdoc IDataServiceRescuable
4945
function rescueETH(address payable to, uint256 tokens) external virtual onlyRescuer {
5046
_rescueTokens(to, Denominations.NATIVE_TOKEN, tokens);
5147
}

packages/horizon/contracts/data-service/interfaces/IDataService.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ interface IDataService {
110110
* @notice Collects payment earnt by the service provider.
111111
* @dev The implementation of this function is expected to interact with {GraphPayments}
112112
* to collect payment from the service payer, which is done via {IGraphPayments-collect}.
113-
* @param serviceProvider The address of the service provider.
114113
*
115114
* Emits a {ServicePaymentCollected} event.
116115
*

packages/horizon/contracts/data-service/interfaces/IDataServiceFees.sol

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ interface IDataServiceFees is IDataService {
2525
* to be released to a service provider.
2626
* @dev StakeClaims are stored in linked lists by service provider, ordered by
2727
* creation timestamp.
28+
* @param tokens The amount of tokens to be locked in the claim
29+
* @param createdAt The timestamp when the claim was created
30+
* @param releasableAt The timestamp when the tokens can be released
31+
* @param nextClaim The next claim in the linked list
2832
*/
2933
struct StakeClaim {
30-
// The amount of tokens to be locked in the claim
3134
uint256 tokens;
32-
// Timestamp when the claim was created
3335
uint256 createdAt;
34-
// Timestamp when the claim will expire and tokens can be released
3536
uint256 releasableAt;
36-
// Next claim in the linked list
3737
bytes32 nextClaim;
3838
}
3939

@@ -75,6 +75,7 @@ interface IDataServiceFees is IDataService {
7575

7676
/**
7777
* @notice Thrown when attempting to get a stake claim that does not exist.
78+
* @param claimId The id of the stake claim
7879
*/
7980
error DataServiceFeesClaimNotFound(bytes32 claimId);
8081

packages/horizon/contracts/data-service/interfaces/IDataServiceRescuable.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ interface IDataServiceRescuable is IDataService {
2020

2121
/**
2222
* @notice Emitted when a rescuer is set.
23+
* @param account The address of the rescuer
24+
* @param allowed Whether the rescuer is allowed to rescue tokens
2325
*/
2426
event RescuerSet(address indexed account, bool allowed);
2527

@@ -30,6 +32,7 @@ interface IDataServiceRescuable is IDataService {
3032

3133
/**
3234
* @notice Thrown when the caller is not a rescuer.
35+
* @param account The address of the account that attempted the rescue
3336
*/
3437
error DataServiceRescuableNotRescuer(address account);
3538

packages/horizon/contracts/data-service/libraries/ProvisionTracker.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import { IHorizonStaking } from "../../interfaces/IHorizonStaking.sol";
1414
library ProvisionTracker {
1515
/**
1616
* @notice Thrown when trying to lock more tokens than available
17+
* @param tokensAvailable The amount of tokens available
18+
* @param tokensRequired The amount of tokens required
1719
*/
1820
error ProvisionTrackerInsufficientTokens(uint256 tokensAvailable, uint256 tokensRequired);
1921

@@ -62,6 +64,7 @@ library ProvisionTracker {
6264
* @param graphStaking The HorizonStaking contract
6365
* @param serviceProvider The service provider address
6466
* @param delegationRatio A delegation ratio to limit the amount of delegation that's usable
67+
* @return true if the service provider has enough tokens available to lock, false otherwise
6568
*/
6669
function check(
6770
mapping(address => uint256) storage self,

0 commit comments

Comments
 (0)