@@ -76,6 +76,7 @@ library AllocationHandler {
76
76
IHorizonStaking graphStaking;
77
77
IRewardsManager graphRewardsManager;
78
78
IGraphToken graphToken;
79
+ address dataService;
79
80
address _allocationId;
80
81
bytes32 _poi;
81
82
bytes _poiMetadata;
@@ -314,26 +315,30 @@ library AllocationHandler {
314
315
// Distribute rewards to delegators
315
316
uint256 delegatorCut = params.graphStaking.getDelegationFeeCut (
316
317
allocation.indexer,
317
- address ( this ) ,
318
+ params.dataService ,
318
319
IGraphPayments.PaymentTypes.IndexingRewards
319
320
);
320
321
IHorizonStakingTypes.DelegationPool memory delegationPool = params.graphStaking.getDelegationPool (
321
322
allocation.indexer,
322
- address ( this )
323
+ params.dataService
323
324
);
324
325
// If delegation pool has no shares then we don't need to distribute rewards to delegators
325
326
tokensDelegationRewards = delegationPool.shares > 0 ? tokensRewards.mulPPM (delegatorCut) : 0 ;
326
327
if (tokensDelegationRewards > 0 ) {
327
328
params.graphToken.approve (address (params.graphStaking), tokensDelegationRewards);
328
- params.graphStaking.addToDelegationPool (allocation.indexer, address (this ), tokensDelegationRewards);
329
+ params.graphStaking.addToDelegationPool (
330
+ allocation.indexer,
331
+ params.dataService,
332
+ tokensDelegationRewards
333
+ );
329
334
}
330
335
331
336
// Distribute rewards to indexer
332
337
tokensIndexerRewards = tokensRewards - tokensDelegationRewards;
333
338
if (tokensIndexerRewards > 0 ) {
334
339
if (params._paymentsDestination == address (0 )) {
335
340
params.graphToken.approve (address (params.graphStaking), tokensIndexerRewards);
336
- params.graphStaking.stakeToProvision (allocation.indexer, address ( this ) , tokensIndexerRewards);
341
+ params.graphStaking.stakeToProvision (allocation.indexer, params.dataService , tokensIndexerRewards);
337
342
} else {
338
343
params.graphToken.pushTokens (params._paymentsDestination, tokensIndexerRewards);
339
344
}
0 commit comments