|
1 | 1 | import { BigDecimal, BigInt, Bytes, 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 | | -import { batchUpdateSubgraphSignalledTokens, calculatePricePerShare, createOrLoadDataService, createOrLoadGraphNetwork, createOrLoadEpoch,createOrLoadIndexerQueryFeePaymentAggregation, createOrLoadPaymentSource, createOrLoadProvision, createOrLoadSubgraphDeployment, joinID, updateDelegationExchangeRate } from "./helpers/helpers" |
| 3 | +import { batchUpdateSubgraphSignalledTokens, calculatePricePerShare, createOrLoadDataService, createOrLoadGraphNetwork, createOrLoadEpoch,createOrLoadIndexerQueryFeePaymentAggregation, createOrLoadPaymentSource, createOrLoadProvision, createOrLoadSubgraphDeployment, joinID, updateDelegationExchangeRate, calculateCapacities } from "./helpers/helpers" |
4 | 4 | import { Allocation, Indexer, PoiSubmission, SubgraphDeployment } from "../types/schema" |
5 | 5 | import { addresses } from "../../config/addresses" |
6 | 6 | import { tuplePrefixBytes } from "./helpers/decoder" |
@@ -64,6 +64,7 @@ export function handleAllocationCreated(event: AllocationCreated): void { |
64 | 64 | indexer.allocatedTokens = indexer.allocatedTokens.plus(event.params.tokens) |
65 | 65 | indexer.totalAllocationCount = indexer.totalAllocationCount.plus(BigInt.fromI32(1)) |
66 | 66 | indexer.allocationCount = indexer.allocationCount + 1 |
| 67 | + indexer = calculateCapacities(indexer as Indexer) |
67 | 68 | indexer.save() |
68 | 69 |
|
69 | 70 | // update provision |
@@ -140,6 +141,7 @@ export function handleAllocationClosed(event: AllocationClosed): void { |
140 | 141 |
|
141 | 142 | indexer.allocatedTokens = indexer.allocatedTokens.minus(event.params.tokens) |
142 | 143 | indexer.allocationCount = indexer.allocationCount - 1 |
| 144 | + indexer = calculateCapacities(indexer as Indexer) |
143 | 145 | indexer.save() |
144 | 146 |
|
145 | 147 | // update provision |
@@ -189,6 +191,7 @@ export function handleAllocationResized(event: AllocationResized): void { |
189 | 191 | // update indexer |
190 | 192 | let indexer = Indexer.load(indexerID)! |
191 | 193 | indexer.allocatedTokens = indexer.allocatedTokens.plus(diffTokens) |
| 194 | + indexer = calculateCapacities(indexer as Indexer) |
192 | 195 | indexer.save() |
193 | 196 |
|
194 | 197 | // update provision |
|
0 commit comments