@@ -425,6 +425,17 @@ contract SubgraphService is
425
425
return _isOverAllocated (indexer, _delegationRatio);
426
426
}
427
427
428
+ /**
429
+ * @notice Sets the payments destination for an indexer to receive payments
430
+ * @dev Emits a {PaymentsDestinationSet} event
431
+ * @param _indexer The address of the indexer
432
+ * @param _paymentsDestination The address where payments should be sent
433
+ */
434
+ function _setPaymentsDestination (address _indexer , address _paymentsDestination ) internal {
435
+ paymentsDestination[_indexer] = _paymentsDestination;
436
+ emit PaymentsDestinationSet (_indexer, _paymentsDestination);
437
+ }
438
+
428
439
// -- Data service parameter getters --
429
440
/**
430
441
* @notice Getter for the accepted thawing period range for provisions
@@ -470,21 +481,21 @@ contract SubgraphService is
470
481
* Emits a {StakeClaimLocked} event.
471
482
* Emits a {QueryFeesCollected} event.
472
483
*
473
- * @param indexer The address of the indexer
474
- * @param data Encoded data:
484
+ * @param _indexer The address of the indexer
485
+ * @param _data Encoded data:
475
486
* - IGraphTallyCollector.SignedRAV `signedRav`: The signed RAV
476
487
* - uint256 `tokensToCollect`: The amount of tokens to collect. Allows partially collecting a RAV. If 0, the entire RAV will
477
488
* be collected.
478
489
* @return The amount of fees collected
479
490
*/
480
- function _collectQueryFees (address indexer , bytes calldata data ) private returns (uint256 ) {
491
+ function _collectQueryFees (address _indexer , bytes calldata _data ) private returns (uint256 ) {
481
492
(IGraphTallyCollector.SignedRAV memory signedRav , uint256 tokensToCollect ) = abi.decode (
482
- data ,
493
+ _data ,
483
494
(IGraphTallyCollector.SignedRAV, uint256 )
484
495
);
485
496
require (
486
- signedRav.rav.serviceProvider == indexer ,
487
- SubgraphServiceIndexerMismatch (signedRav.rav.serviceProvider, indexer )
497
+ signedRav.rav.serviceProvider == _indexer ,
498
+ SubgraphServiceIndexerMismatch (signedRav.rav.serviceProvider, _indexer )
488
499
);
489
500
490
501
// Check that collectionId (256 bits) is a valid address (160 bits)
@@ -497,11 +508,11 @@ contract SubgraphService is
497
508
Allocation.State memory allocation = _allocations.get (allocationId);
498
509
499
510
// Check RAV is consistent - RAV indexer must match the allocation's indexer
500
- require (allocation.indexer == indexer , SubgraphServiceInvalidRAV (indexer , allocation.indexer));
511
+ require (allocation.indexer == _indexer , SubgraphServiceInvalidRAV (_indexer , allocation.indexer));
501
512
bytes32 subgraphDeploymentId = allocation.subgraphDeploymentId;
502
513
503
514
// release expired stake claims
504
- _releaseStake (indexer , 0 );
515
+ _releaseStake (_indexer , 0 );
505
516
506
517
// Collect from GraphPayments - only curators cut is sent back to the subgraph service
507
518
uint256 tokensCollected;
@@ -523,7 +534,7 @@ contract SubgraphService is
523
534
if (tokensCollected > 0 ) {
524
535
// lock stake as economic security for fees
525
536
_lockStake (
526
- indexer ,
537
+ _indexer ,
527
538
tokensCollected * stakeToFeesRatio,
528
539
block .timestamp + _disputeManager ().getDisputePeriod ()
529
540
);
@@ -539,7 +550,7 @@ contract SubgraphService is
539
550
}
540
551
541
552
emit QueryFeesCollected (
542
- indexer ,
553
+ _indexer ,
543
554
signedRav.rav.payer,
544
555
allocationId,
545
556
subgraphDeploymentId,
@@ -551,31 +562,20 @@ contract SubgraphService is
551
562
552
563
/**
553
564
* @notice Collect indexing rewards
554
- * @param indexer The address of the indexer
555
- * @param data Encoded data:
565
+ * @param _indexer The address of the indexer
566
+ * @param _data Encoded data:
556
567
* - address `allocationId`: The id of the allocation
557
568
* - bytes32 `poi`: The POI being presented
558
569
* - bytes `poiMetadata`: The metadata associated with the POI. See {AllocationManager-_presentPOI} for more details.
559
570
* @return The amount of indexing rewards collected
560
571
*/
561
- function _collectIndexingRewards (address indexer , bytes calldata data ) private returns (uint256 ) {
562
- (address allocationId , bytes32 poi_ , bytes memory poiMetadata_ ) = abi.decode (data , (address , bytes32 , bytes ));
572
+ function _collectIndexingRewards (address _indexer , bytes calldata _data ) private returns (uint256 ) {
573
+ (address allocationId , bytes32 poi_ , bytes memory poiMetadata_ ) = abi.decode (_data , (address , bytes32 , bytes ));
563
574
require (
564
- _allocations.get (allocationId).indexer == indexer ,
565
- SubgraphServiceAllocationNotAuthorized (indexer , allocationId)
575
+ _allocations.get (allocationId).indexer == _indexer ,
576
+ SubgraphServiceAllocationNotAuthorized (_indexer , allocationId)
566
577
);
567
- return _presentPOI (allocationId, poi_, poiMetadata_, _delegationRatio, paymentsDestination[indexer]);
568
- }
569
-
570
- /**
571
- * @notice Sets the payments destination for an indexer to receive payments
572
- * @dev Emits a {PaymentsDestinationSet} event
573
- * @param _indexer The address of the indexer
574
- * @param _paymentsDestination The address where payments should be sent
575
- */
576
- function _setPaymentsDestination (address _indexer , address _paymentsDestination ) internal {
577
- paymentsDestination[_indexer] = _paymentsDestination;
578
- emit PaymentsDestinationSet (_indexer, _paymentsDestination);
578
+ return _presentPOI (allocationId, poi_, poiMetadata_, _delegationRatio, paymentsDestination[_indexer]);
579
579
}
580
580
581
581
/**
@@ -591,14 +591,14 @@ contract SubgraphService is
591
591
/**
592
592
* @notice Encodes the data for the GraphTallyCollector
593
593
* @dev The purpose of this function is just to avoid stack too deep errors
594
- * @param signedRav The signed RAV
595
- * @param curationCut The curation cut
594
+ * @param _signedRav The signed RAV
595
+ * @param _curationCut The curation cut
596
596
* @return The encoded data
597
597
*/
598
598
function _encodeGraphTallyData (
599
- IGraphTallyCollector.SignedRAV memory signedRav ,
600
- uint256 curationCut
599
+ IGraphTallyCollector.SignedRAV memory _signedRav ,
600
+ uint256 _curationCut
601
601
) private view returns (bytes memory ) {
602
- return abi.encode (signedRav, curationCut , paymentsDestination[signedRav .rav.serviceProvider]);
602
+ return abi.encode (_signedRav, _curationCut , paymentsDestination[_signedRav .rav.serviceProvider]);
603
603
}
604
604
}
0 commit comments