@@ -74,6 +74,12 @@ library IndexingAgreement {
74
74
uint256 tokensPerEntityPerSecond;
75
75
}
76
76
77
+ struct CollectParams {
78
+ bytes16 agreementId;
79
+ uint256 currentEpoch;
80
+ bytes data;
81
+ }
82
+
77
83
bytes32 private constant INDEXING_AGREEMENT_MANAGER_STORAGE_V1_SLOT = keccak256 ("v1.manager.indexing-agreement " );
78
84
79
85
/**
@@ -323,32 +329,31 @@ library IndexingAgreement {
323
329
function collect (
324
330
Manager storage self ,
325
331
mapping (address allocationId = > Allocation.State allocation ) storage allocations ,
326
- bytes16 agreementId ,
327
- bytes memory data
332
+ CollectParams memory params
328
333
) external returns (address , uint256 ) {
329
- AgreementWrapper memory wrapper = _get (self, agreementId);
334
+ AgreementWrapper memory wrapper = _get (self, params. agreementId);
330
335
Allocation.State memory allocation = allocations.requireValidAllocation (
331
336
wrapper.agreement.allocationId,
332
337
wrapper.collectorAgreement.serviceProvider
333
338
);
334
- require (_isActive (wrapper), IndexingAgreementNotActive (agreementId));
339
+ require (_isActive (wrapper), IndexingAgreementNotActive (params. agreementId));
335
340
336
341
require (
337
342
wrapper.agreement.version == IndexingAgreementVersion.V1,
338
343
InvalidIndexingAgreementVersion (wrapper.agreement.version)
339
344
);
340
345
341
- (uint256 entities , bytes32 poi , uint256 poiEpoch ) = Decoder.decodeCollectIndexingFeeDataV1 (data);
346
+ (uint256 entities , bytes32 poi , uint256 poiEpoch ) = Decoder.decodeCollectIndexingFeeDataV1 (params. data);
342
347
343
348
uint256 expectedTokens = (entities == 0 && poi == bytes32 (0 ))
344
349
? 0
345
- : _tokensToCollect (self, agreementId, wrapper.collectorAgreement, entities);
350
+ : _tokensToCollect (self, params. agreementId, wrapper.collectorAgreement, entities);
346
351
347
352
uint256 tokensCollected = _directory ().recurringCollector ().collect (
348
353
IGraphPayments.PaymentTypes.IndexingFee,
349
354
abi.encode (
350
355
IRecurringCollector.CollectParams ({
351
- agreementId: agreementId,
356
+ agreementId: params. agreementId,
352
357
collectionId: bytes32 (uint256 (uint160 (wrapper.agreement.allocationId))),
353
358
tokens: expectedTokens,
354
359
dataServiceCut: 0
@@ -359,10 +364,10 @@ library IndexingAgreement {
359
364
emit IndexingFeesCollectedV1 (
360
365
wrapper.collectorAgreement.serviceProvider,
361
366
wrapper.collectorAgreement.payer,
362
- agreementId,
367
+ params. agreementId,
363
368
wrapper.agreement.allocationId,
364
369
allocation.subgraphDeploymentId,
365
- _graphDirectory (). graphEpochManager (). currentEpoch () ,
370
+ params. currentEpoch,
366
371
tokensCollected,
367
372
entities,
368
373
poi,
0 commit comments