Skip to content

Commit 1735d13

Browse files
f: more NatSpec
1 parent f729818 commit 1735d13

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

packages/subgraph-service/contracts/SubgraphService.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ contract SubgraphService is
412412
*
413413
* @dev signedRCA.rca.metadata is an encoding of {IndexingAgreement.AcceptIndexingAgreementMetadata}
414414
*
415-
* Emits {IndexingAgreementAccepted} event
415+
* Emits {IndexingAgreement.IndexingAgreementAccepted} event
416416
*
417417
* @param allocationId The id of the allocation
418418
* @param signedRCA The signed Recurring Collection Agreement

packages/subgraph-service/contracts/libraries/IndexingAgreement.sol

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ library IndexingAgreement {
9090
* @param indexer The address of the indexer
9191
* @param payer The address paying for the indexing fees
9292
* @param agreementId The id of the agreement
93+
* @param allocationId The id of the allocation
94+
* @param subgraphDeploymentId The id of the subgraph deployment
9395
* @param currentEpoch The current epoch
9496
* @param tokensCollected The amount of tokens collected
9597
* @param entities The number of entities indexed
@@ -218,6 +220,24 @@ library IndexingAgreement {
218220
*/
219221
error IndexingAgreementNotAuthorized(bytes16 agreementId, address unauthorizedIndexer);
220222

223+
/**
224+
* @notice Accept an indexing agreement.
225+
*
226+
* Requirements:
227+
* - Allocation must belong to the indexer and be open
228+
* - Agreement must be for this data service
229+
* - Agreement's subgraph deployment must match the allocation's subgraph deployment
230+
* - Agreement must not have been accepted before
231+
* - Allocation must not have an agreement already
232+
*
233+
* @dev signedRCA.rca.metadata is an encoding of {IndexingAgreement.AcceptIndexingAgreementMetadata}
234+
*
235+
* Emits {IndexingAgreementAccepted} event
236+
*
237+
* @param self The indexing agreement storage manager
238+
* @param allocationId The id of the allocation
239+
* @param signedRCA The signed Recurring Collection Agreement
240+
*/
221241
function accept(
222242
StorageManager storage self,
223243
mapping(address allocationId => Allocation.State allocation) storage allocations,
@@ -420,6 +440,25 @@ library IndexingAgreement {
420440
);
421441
}
422442

443+
/**
444+
* @notice Collect Indexing fees
445+
* @dev Uses the {RecurringCollector} to collect payment from Graph Horizon payments protocol.
446+
* Fees are distributed to service provider and delegators by {GraphPayments}
447+
*
448+
* Requirements:
449+
* - Allocation must be open
450+
* - Agreement must be active
451+
* - Agreement must be of version V1
452+
* - The data must be encoded as per {Decoder.decodeCollectIndexingFeeDataV1}
453+
*
454+
* Emits a {IndexingFeesCollectedV1} event.
455+
*
456+
* @param self The indexing agreement storage manager
457+
* @param allocations The mapping of allocation IDs to their states
458+
* @param params The parameters for collecting indexing fees
459+
* @return The address of the service provider that collected the fees
460+
* @return The amount of fees collected
461+
*/
423462
function collect(
424463
StorageManager storage self,
425464
mapping(address allocationId => Allocation.State allocation) storage allocations,
@@ -471,6 +510,13 @@ library IndexingAgreement {
471510
return (wrapper.collectorAgreement.serviceProvider, tokensCollected);
472511
}
473512

513+
/**
514+
* @notice Get the indexing agreement for a given agreement ID.
515+
*
516+
* @param self The indexing agreement storage manager
517+
* @param agreementId The id of the indexing agreement
518+
* @return The indexing agreement wrapper containing the agreement state and collector agreement data
519+
*/
474520
function get(StorageManager storage self, bytes16 agreementId) external view returns (AgreementWrapper memory) {
475521
AgreementWrapper memory wrapper = _get(self, agreementId);
476522
require(wrapper.collectorAgreement.dataService == address(this), IndexingAgreementNotActive(agreementId));

0 commit comments

Comments
 (0)