From fa4ead6b7fcddc6472251b5c42d6bed854c194c2 Mon Sep 17 00:00:00 2001 From: Miguel de Elias Date: Tue, 17 Sep 2024 18:01:29 -0300 Subject: [PATCH] fix(SubgraphService): use correct payment type for collect indexing rewards --- .../contracts/utilities/AllocationManager.sol | 2 +- .../test/subgraphService/SubgraphService.t.sol | 3 +-- .../test/subgraphService/collect/indexing/indexing.t.sol | 9 +++------ 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/subgraph-service/contracts/utilities/AllocationManager.sol b/packages/subgraph-service/contracts/utilities/AllocationManager.sol index 39428f2bb..e68003f4b 100644 --- a/packages/subgraph-service/contracts/utilities/AllocationManager.sol +++ b/packages/subgraph-service/contracts/utilities/AllocationManager.sol @@ -288,7 +288,7 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca uint256 delegatorCut = _graphStaking().getDelegationFeeCut( allocation.indexer, address(this), - IGraphPayments.PaymentTypes.IndexingFee + IGraphPayments.PaymentTypes.IndexingRewards ); IHorizonStakingTypes.DelegationPool memory delegationPool = _graphStaking().getDelegationPool( allocation.indexer, diff --git a/packages/subgraph-service/test/subgraphService/SubgraphService.t.sol b/packages/subgraph-service/test/subgraphService/SubgraphService.t.sol index 845a7b7fb..b5b7f744e 100644 --- a/packages/subgraph-service/test/subgraphService/SubgraphService.t.sol +++ b/packages/subgraph-service/test/subgraphService/SubgraphService.t.sol @@ -253,8 +253,7 @@ contract SubgraphServiceTest is SubgraphServiceSharedTest { uint256 delegatorCut = staking.getDelegationFeeCut( allocation.indexer, address(subgraphService), - // TODO: this should be fixed in AllocationManager, it should be IndexingRewards instead - IGraphPayments.PaymentTypes.IndexingFee + IGraphPayments.PaymentTypes.IndexingRewards ); IHorizonStakingTypes.DelegationPool memory delegationPool = staking.getDelegationPool(allocation.indexer, address(subgraphService)); indexingRewardsData.tokensDelegationRewards = delegationPool.shares > 0 ? paymentCollected.mulPPM(delegatorCut) : 0; diff --git a/packages/subgraph-service/test/subgraphService/collect/indexing/indexing.t.sol b/packages/subgraph-service/test/subgraphService/collect/indexing/indexing.t.sol index ae2a085ed..bff35f574 100644 --- a/packages/subgraph-service/test/subgraphService/collect/indexing/indexing.t.sol +++ b/packages/subgraph-service/test/subgraphService/collect/indexing/indexing.t.sol @@ -32,8 +32,7 @@ contract SubgraphServiceCollectIndexingTest is SubgraphServiceTest { _setDelegationFeeCut( users.indexer, address(subgraphService), - // TODO: this should be fixed in AllocationManager, it should be IndexingRewards instead - IGraphPayments.PaymentTypes.IndexingFee, + IGraphPayments.PaymentTypes.IndexingRewards, delegationFeeCut ); IGraphPayments.PaymentTypes paymentType = IGraphPayments.PaymentTypes.IndexingRewards; @@ -51,8 +50,7 @@ contract SubgraphServiceCollectIndexingTest is SubgraphServiceTest { _setDelegationFeeCut( users.indexer, address(subgraphService), - // TODO: this should be fixed in AllocationManager, it should be IndexingRewards instead - IGraphPayments.PaymentTypes.IndexingFee, + IGraphPayments.PaymentTypes.IndexingRewards, delegationFeeCut ); // Undelegate @@ -97,8 +95,7 @@ contract SubgraphServiceCollectIndexingTest is SubgraphServiceTest { _setDelegationFeeCut( users.indexer, address(subgraphService), - // TODO: this should be fixed in AllocationManager, it should be IndexingRewards instead - IGraphPayments.PaymentTypes.IndexingFee, + IGraphPayments.PaymentTypes.IndexingRewards, delegationFeeCut );