File tree Expand file tree Collapse file tree 4 files changed +34
-2
lines changed
packages/subgraph-service/contracts Expand file tree Collapse file tree 4 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -398,6 +398,13 @@ contract SubgraphService is
398
398
emit CurationCutSet (curationCut);
399
399
}
400
400
401
+ /// @inheritdoc ISubgraphService
402
+ function setIndexingFeesCut (uint256 indexingFeesCut_ ) external override onlyOwner {
403
+ require (PPMMath.isValidPPM (indexingFeesCut_), SubgraphServiceInvalidIndexingFeesCut (indexingFeesCut_));
404
+ indexingFeesCut = indexingFeesCut_;
405
+ emit IndexingFeesCutSet (indexingFeesCut_);
406
+ }
407
+
401
408
/**
402
409
* @inheritdoc ISubgraphService
403
410
* @notice Accept an indexing agreement.
@@ -793,7 +800,8 @@ contract SubgraphService is
793
800
agreementId: _agreementId,
794
801
currentEpoch: _graphEpochManager ().currentEpoch (),
795
802
receiverDestination: _paymentsDestination,
796
- data: _data
803
+ data: _data,
804
+ indexingFeesCut: indexingFeesCut
797
805
})
798
806
);
799
807
Original file line number Diff line number Diff line change @@ -21,4 +21,7 @@ abstract contract SubgraphServiceV1Storage {
21
21
22
22
/// @notice Destination of indexer payments
23
23
mapping (address indexer = > address destination ) public paymentsDestination;
24
+
25
+ /// @notice The cut data service takes from indexing fee payments. In PPM.
26
+ uint256 public indexingFeesCut;
24
27
}
Original file line number Diff line number Diff line change @@ -69,12 +69,24 @@ interface ISubgraphService is IDataServiceFees {
69
69
*/
70
70
event CurationCutSet (uint256 curationCut );
71
71
72
+ /**
73
+ * @notice Emitted when indexing fees cut is set
74
+ * @param indexingFeesCut The indexing fees cut
75
+ */
76
+ event IndexingFeesCutSet (uint256 indexingFeesCut );
77
+
72
78
/**
73
79
* @notice Thrown when trying to set a curation cut that is not a valid PPM value
74
80
* @param curationCut The curation cut value
75
81
*/
76
82
error SubgraphServiceInvalidCurationCut (uint256 curationCut );
77
83
84
+ /**
85
+ * @notice Thrown when trying to set an indexing fees cut that is not a valid PPM value
86
+ * @param indexingFeesCut The indexing fees cut value
87
+ */
88
+ error SubgraphServiceInvalidIndexingFeesCut (uint256 indexingFeesCut );
89
+
78
90
/**
79
91
* @notice Thrown when an indexer tries to register with an empty URL
80
92
*/
@@ -252,6 +264,13 @@ interface ISubgraphService is IDataServiceFees {
252
264
*/
253
265
function setCurationCut (uint256 curationCut ) external ;
254
266
267
+ /**
268
+ * @notice Sets the data service payment cut for indexing fees
269
+ * @dev Emits a {IndexingFeesCutSet} event
270
+ * @param indexingFeesCut The indexing fees cut for the payment type
271
+ */
272
+ function setIndexingFeesCut (uint256 indexingFeesCut ) external ;
273
+
255
274
/**
256
275
* @notice Sets the payments destination for an indexer to receive payments
257
276
* @dev Emits a {PaymentsDestinationSet} event
Original file line number Diff line number Diff line change @@ -80,13 +80,15 @@ library IndexingAgreement {
80
80
* @param currentEpoch The current epoch
81
81
* @param receiverDestination The address where the collected fees should be sent
82
82
* @param data The encoded data containing the number of entities indexed, proof of indexing, and epoch
83
+ * @param indexingFeesCut The indexing fees cut in PPM
83
84
*/
84
85
struct CollectParams {
85
86
address indexer;
86
87
bytes16 agreementId;
87
88
uint256 currentEpoch;
88
89
address receiverDestination;
89
90
bytes data;
91
+ uint256 indexingFeesCut;
90
92
}
91
93
92
94
/**
@@ -577,7 +579,7 @@ library IndexingAgreement {
577
579
agreementId: params.agreementId,
578
580
collectionId: bytes32 (uint256 (uint160 (wrapper.agreement.allocationId))),
579
581
tokens: expectedTokens,
580
- dataServiceCut: 0 ,
582
+ dataServiceCut: params.indexingFeesCut ,
581
583
receiverDestination: params.receiverDestination,
582
584
maxSlippage: data.maxSlippage
583
585
})
You can’t perform that action at this time.
0 commit comments