diff --git a/packages/horizon/contracts/interfaces/internal/IHorizonStakingMain.sol b/packages/horizon/contracts/interfaces/internal/IHorizonStakingMain.sol index a934ac667..1a90f69a1 100644 --- a/packages/horizon/contracts/interfaces/internal/IHorizonStakingMain.sol +++ b/packages/horizon/contracts/interfaces/internal/IHorizonStakingMain.sol @@ -186,12 +186,14 @@ interface IHorizonStakingMain { * @param verifier The address of the verifier * @param delegator The address of the delegator * @param tokens The amount of tokens undelegated + * @param tokens The amount of shares undelegated */ event TokensUndelegated( address indexed serviceProvider, address indexed verifier, address indexed delegator, - uint256 tokens + uint256 tokens, + uint256 shares ); /** diff --git a/packages/horizon/contracts/staking/HorizonStaking.sol b/packages/horizon/contracts/staking/HorizonStaking.sol index 9002bce8c..bd3f0841d 100644 --- a/packages/horizon/contracts/staking/HorizonStaking.sol +++ b/packages/horizon/contracts/staking/HorizonStaking.sol @@ -939,7 +939,7 @@ contract HorizonStaking is HorizonStakingBase, IHorizonStakingMain { pool.thawingNonce ); - emit TokensUndelegated(_serviceProvider, _verifier, msg.sender, tokens); + emit TokensUndelegated(_serviceProvider, _verifier, msg.sender, tokens, _shares); return thawRequestId; } diff --git a/packages/horizon/test/shared/horizon-staking/HorizonStakingShared.t.sol b/packages/horizon/test/shared/horizon-staking/HorizonStakingShared.t.sol index 86817c144..0d84ba708 100644 --- a/packages/horizon/test/shared/horizon-staking/HorizonStakingShared.t.sol +++ b/packages/horizon/test/shared/horizon-staking/HorizonStakingShared.t.sol @@ -1010,7 +1010,7 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest { calcValues.thawRequestId ); vm.expectEmit(); - emit IHorizonStakingMain.TokensUndelegated(serviceProvider, verifier, delegator, calcValues.tokens); + emit IHorizonStakingMain.TokensUndelegated(serviceProvider, verifier, delegator, calcValues.tokens, shares); if (legacy) { staking.undelegate(serviceProvider, shares); } else if (thawRequestType == IHorizonStakingTypes.ThawRequestType.Delegation) { diff --git a/packages/subgraph-service/contracts/SubgraphService.sol b/packages/subgraph-service/contracts/SubgraphService.sol index 3f6b71d0f..4ecfa0c61 100644 --- a/packages/subgraph-service/contracts/SubgraphService.sol +++ b/packages/subgraph-service/contracts/SubgraphService.sol @@ -587,7 +587,14 @@ contract SubgraphService is } } - emit QueryFeesCollected(indexer, _signedRav.rav.payer, tokensCollected, tokensCurators); + emit QueryFeesCollected( + indexer, + _signedRav.rav.payer, + allocationId, + subgraphDeploymentId, + tokensCollected, + tokensCurators + ); return tokensCollected; } diff --git a/packages/subgraph-service/contracts/interfaces/ISubgraphService.sol b/packages/subgraph-service/contracts/interfaces/ISubgraphService.sol index 68639bf8a..5449ca1d3 100644 --- a/packages/subgraph-service/contracts/interfaces/ISubgraphService.sol +++ b/packages/subgraph-service/contracts/interfaces/ISubgraphService.sol @@ -30,10 +30,19 @@ interface ISubgraphService is IDataServiceFees { * @notice Emitted when a subgraph service collects query fees from Graph Payments * @param serviceProvider The address of the service provider * @param payer The address paying for the query fees + * @param allocationId The id of the allocation + * @param subgraphDeploymentId The id of the subgraph deployment * @param tokensCollected The amount of tokens collected * @param tokensCurators The amount of tokens curators receive */ - event QueryFeesCollected(address indexed serviceProvider, address indexed payer, uint256 tokensCollected, uint256 tokensCurators); + event QueryFeesCollected( + address indexed serviceProvider, + address indexed payer, + address indexed allocationId, + bytes32 subgraphDeploymentId, + uint256 tokensCollected, + uint256 tokensCurators + ); /** * @notice Emitted when the stake to fees ratio is set. diff --git a/packages/subgraph-service/test/subgraphService/SubgraphService.t.sol b/packages/subgraph-service/test/subgraphService/SubgraphService.t.sol index 2053083c8..3d8fd1b7d 100644 --- a/packages/subgraph-service/test/subgraphService/SubgraphService.t.sol +++ b/packages/subgraph-service/test/subgraphService/SubgraphService.t.sol @@ -278,9 +278,10 @@ contract SubgraphServiceTest is SubgraphServiceSharedTest { bytes memory _data ) private returns (uint256 paymentCollected) { IGraphTallyCollector.SignedRAV memory signedRav = abi.decode(_data, (IGraphTallyCollector.SignedRAV)); - Allocation.State memory allocation = subgraphService.getAllocation( - address(uint160(uint256(signedRav.rav.collectionId))) - ); + address allocationId = address(uint160(uint256(signedRav.rav.collectionId))); + Allocation.State memory allocation = subgraphService.getAllocation(allocationId); + bytes32 subgraphDeploymentId = allocation.subgraphDeploymentId; + address payer = graphTallyCollector.isAuthorized(signedRav.rav.payer, _recoverRAVSigner(signedRav)) ? signedRav.rav.payer : address(0); @@ -298,7 +299,14 @@ contract SubgraphServiceTest is SubgraphServiceSharedTest { uint256 tokensCurators = (paymentCollected - tokensProtocol).mulPPMRoundUp(queryFeeData.curationCut); vm.expectEmit(address(subgraphService)); - emit ISubgraphService.QueryFeesCollected(_indexer, payer, paymentCollected, tokensCurators); + emit ISubgraphService.QueryFeesCollected( + _indexer, + payer, + allocationId, + subgraphDeploymentId, + paymentCollected, + tokensCurators + ); return paymentCollected; }