|
1 | 1 | import { BigDecimal, BigInt, ethereum, log } from "@graphprotocol/graph-ts" |
2 | 2 | import { AllocationClosed, AllocationCreated, AllocationResized, CurationCutSet, DelegationRatioSet, IndexingRewardsCollected, MaxPOIStalenessSet, ProvisionTokensRangeSet, QueryFeesCollected, RewardsDestinationSet, ServiceProviderRegistered, StakeToFeesRatioSet, ThawingPeriodRangeSet, VerifierCutRangeSet } from "../types/SubgraphService/SubgraphService" |
3 | 3 | import { batchUpdateSubgraphSignalledTokens, calculatePricePerShare, createOrLoadDataService, createOrLoadEpoch, createOrLoadGraphNetwork, createOrLoadIndexerQueryFeePaymentAggregation, createOrLoadPaymentSource, createOrLoadProvision, createOrLoadSubgraphDeployment, joinID, updateDelegationExchangeRate } from "./helpers/helpers" |
4 | | -import { Allocation, GraphAccount, Indexer, PoiSubmission, SubgraphDeployment } from "../types/schema" |
| 4 | +import { Allocation, PublicPoiSubmission, Indexer, PoiSubmission, SubgraphDeployment } from "../types/schema" |
5 | 5 | import { addresses } from "../../config/addresses" |
6 | 6 | import { tuplePrefixBytes } from "./helpers/decoder" |
7 | 7 | import { createOrLoadIndexer } from "./helpers/helpers" |
@@ -260,8 +260,22 @@ export function handleIndexingRewardsCollected(event: IndexingRewardsCollected): |
260 | 260 | poiSubmission.allocation = allocation.id |
261 | 261 | poiSubmission.poi = event.params.poi |
262 | 262 | poiSubmission.submittedAtEpoch = event.params.currentEpoch.toI32() |
| 263 | + poiSubmission.presentedAtTimestamp = event.block.timestamp.toI32() |
263 | 264 | poiSubmission.save() |
264 | 265 |
|
| 266 | + // Create public PoI submission |
| 267 | + let publicPoiSubmission = new PublicPoiSubmission(joinID([event.transaction.hash.toHexString(), event.logIndex.toString()])) |
| 268 | + publicPoiSubmission.allocation = allocation.id |
| 269 | + publicPoiSubmission.publicPoi = event.params.publicPoi |
| 270 | + publicPoiSubmission.submittedAtEpoch = event.params.currentEpoch.toI32() |
| 271 | + publicPoiSubmission.presentedAtTimestamp = event.block.timestamp.toI32() |
| 272 | + publicPoiSubmission.save() |
| 273 | + |
| 274 | + // Update latest POI in allocation |
| 275 | + allocation.poi = event.params.poi |
| 276 | + allocation.latestPoiPresentedAt = event.block.timestamp.toI32() |
| 277 | + allocation.save() |
| 278 | + |
265 | 279 | // Update epoch |
266 | 280 | let epoch = createOrLoadEpoch((addresses.isL1 ? event.block.number : graphNetwork.currentL1BlockNumber!)) |
267 | 281 | epoch.totalRewards = epoch.totalRewards.plus(event.params.tokensRewards) |
|
0 commit comments