Skip to content

Commit 7187543

Browse files
committed
chore: change some events for easier indexing
Signed-off-by: Tomás Migone <[email protected]>
1 parent 26d5caa commit 7187543

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

Diff for: packages/contracts/contracts/rewards/RewardsManager.sol

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ contract RewardsManager is RewardsManagerV5Storage, GraphUpgradeable, IRewardsMa
3838

3939
/**
4040
* @dev Emitted when rewards are assigned to an indexer.
41+
* @dev We use the Horizon prefix to change the event signature which makes network subgraph development much easier
4142
*/
42-
event RewardsAssigned(address indexed indexer, address indexed allocationID, uint256 amount);
43+
event HorizonRewardsAssigned(address indexed indexer, address indexed allocationID, uint256 amount);
4344

4445
/**
4546
* @dev Emitted when rewards are denied to an indexer.
@@ -412,7 +413,7 @@ contract RewardsManager is RewardsManagerV5Storage, GraphUpgradeable, IRewardsMa
412413
graphToken().mint(rewardsIssuer, rewards);
413414
}
414415

415-
emit RewardsAssigned(indexer, _allocationID, rewards);
416+
emit HorizonRewardsAssigned(indexer, _allocationID, rewards);
416417

417418
return rewards;
418419
}

Diff for: packages/contracts/test/unit/rewards/rewards.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ describe('Rewards', () => {
675675
// Close allocation. At this point rewards should be collected for that indexer
676676
const tx = staking.connect(indexer1).closeAllocation(allocationID1, randomHexBytes())
677677
await expect(tx)
678-
.emit(rewardsManager, 'RewardsAssigned')
678+
.emit(rewardsManager, 'HorizonRewardsAssigned')
679679
.withArgs(indexer1.address, allocationID1, toBN(0))
680680
})
681681

@@ -693,7 +693,7 @@ describe('Rewards', () => {
693693
// Close allocation. At this point rewards should be collected for that indexer
694694
const tx = staking.connect(indexer1).closeAllocation(allocationID1, randomHexBytes())
695695
await expect(tx)
696-
.emit(rewardsManager, 'RewardsAssigned')
696+
.emit(rewardsManager, 'HorizonRewardsAssigned')
697697
.withArgs(indexer1.address, allocationID1, toBN(0))
698698
})
699699

@@ -710,7 +710,7 @@ describe('Rewards', () => {
710710
const tx = staking.connect(indexer1).closeAllocation(allocationID1, randomHexBytes())
711711

712712
await expect(tx)
713-
.emit(rewardsManager, 'RewardsAssigned')
713+
.emit(rewardsManager, 'HorizonRewardsAssigned')
714714
.withArgs(indexer1.address, allocationID1, toBN(0))
715715
})
716716

Diff for: packages/contracts/test/unit/staking/allocation.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ describe('Staking:Allocation', () => {
895895
poi,
896896
false,
897897
)
898-
await expect(tx).not.to.emit(rewardsManager, 'RewardsAssigned')
898+
await expect(tx).not.to.emit(rewardsManager, 'HorizonRewardsAssigned')
899899
})
900900

901901
it('reject close if not the owner of allocation', async function () {

Diff for: packages/subgraph-service/contracts/SubgraphService.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ contract SubgraphService is
587587
}
588588
}
589589

590-
emit QueryFeesCollected(indexer, tokensCollected, tokensCurators);
590+
emit QueryFeesCollected(indexer, _signedRav.rav.payer, tokensCollected, tokensCurators);
591591
return tokensCollected;
592592
}
593593

Diff for: packages/subgraph-service/contracts/interfaces/ISubgraphService.sol

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ interface ISubgraphService is IDataServiceFees {
2929
/**
3030
* @notice Emitted when a subgraph service collects query fees from Graph Payments
3131
* @param serviceProvider The address of the service provider
32+
* @param payer The address paying for the query fees
3233
* @param tokensCollected The amount of tokens collected
3334
* @param tokensCurators The amount of tokens curators receive
3435
*/
35-
event QueryFeesCollected(address indexed serviceProvider, uint256 tokensCollected, uint256 tokensCurators);
36+
event QueryFeesCollected(address indexed serviceProvider, address indexed payer, uint256 tokensCollected, uint256 tokensCurators);
3637

3738
/**
3839
* @notice Emitted when the stake to fees ratio is set.

Diff for: packages/subgraph-service/test/subgraphService/SubgraphService.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ contract SubgraphServiceTest is SubgraphServiceSharedTest {
298298
uint256 tokensCurators = (paymentCollected - tokensProtocol).mulPPMRoundUp(queryFeeData.curationCut);
299299

300300
vm.expectEmit(address(subgraphService));
301-
emit ISubgraphService.QueryFeesCollected(_indexer, paymentCollected, tokensCurators);
301+
emit ISubgraphService.QueryFeesCollected(_indexer, payer, paymentCollected, tokensCurators);
302302

303303
return paymentCollected;
304304
}

0 commit comments

Comments
 (0)