@@ -90,6 +90,8 @@ library IndexingAgreement {
90
90
* @param indexer The address of the indexer
91
91
* @param payer The address paying for the indexing fees
92
92
* @param agreementId The id of the agreement
93
+ * @param allocationId The id of the allocation
94
+ * @param subgraphDeploymentId The id of the subgraph deployment
93
95
* @param currentEpoch The current epoch
94
96
* @param tokensCollected The amount of tokens collected
95
97
* @param entities The number of entities indexed
@@ -218,6 +220,24 @@ library IndexingAgreement {
218
220
*/
219
221
error IndexingAgreementNotAuthorized (bytes16 agreementId , address unauthorizedIndexer );
220
222
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
+ */
221
241
function accept (
222
242
StorageManager storage self ,
223
243
mapping (address allocationId = > Allocation.State allocation ) storage allocations ,
@@ -420,6 +440,25 @@ library IndexingAgreement {
420
440
);
421
441
}
422
442
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
+ */
423
462
function collect (
424
463
StorageManager storage self ,
425
464
mapping (address allocationId = > Allocation.State allocation ) storage allocations ,
@@ -471,6 +510,13 @@ library IndexingAgreement {
471
510
return (wrapper.collectorAgreement.serviceProvider, tokensCollected);
472
511
}
473
512
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
+ */
474
520
function get (StorageManager storage self , bytes16 agreementId ) external view returns (AgreementWrapper memory ) {
475
521
AgreementWrapper memory wrapper = _get (self, agreementId);
476
522
require (wrapper.collectorAgreement.dataService == address (this ), IndexingAgreementNotActive (agreementId));
0 commit comments