Skip to content

Commit 04529ed

Browse files
committed
feat: add more missing events
Signed-off-by: Tomás Migone <[email protected]>
1 parent 631e966 commit 04529ed

File tree

4 files changed

+74
-3
lines changed

4 files changed

+74
-3
lines changed

schema.graphql

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,15 +250,35 @@ type DataService @entity {
250250
"Total GRT currently in allocations for this DataService"
251251
totalTokensAllocated: BigInt!
252252

253+
"Minimum provision tokens for this DataService"
254+
minimumProvisionTokens: BigInt!
255+
"Maximum provision tokens for this DataService"
256+
maximumProvisionTokens: BigInt!
257+
258+
"Minimum verifier cut for this DataService"
259+
minimumVerifierCut: BigInt!
260+
"Maximum verifier cut for this DataService"
261+
maximumVerifierCut: BigInt!
262+
263+
"Minimum thawing period for this DataService"
264+
minimumThawingPeriod: BigInt!
265+
"Maximum thawing period for this DataService"
266+
maximumThawingPeriod: BigInt!
267+
253268
"Ratio of max staked delegation tokens to indexers stake that earns rewards"
254269
delegationRatio: Int
255-
"Curation cut for this DataService"
256-
curationCut: BigInt!
257270

258271
provisions: [Provision!]! @derivedFrom(field: "dataService")
259272

260273
"True if allowed for usage with token lock wallets"
261274
allowedWithTokenLockWallets: Boolean!
275+
276+
"[SubgraphService] Curation cut for this DataService"
277+
curationCut: BigInt!
278+
"[SubgraphService] Max POI staleness"
279+
maxPOIStaleness: BigInt!
280+
"[SubgraphService] Stake to fees ratio"
281+
stakeToFeesRatio: BigInt!
262282
}
263283

264284
"""

src/mappings/helpers/helpers.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,14 @@ export function createOrLoadDataService(verifierAddress: Bytes): DataService {
263263
service.totalTokensThawing = BigInt.fromI32(0)
264264
service.allowedWithTokenLockWallets = false
265265
service.curationCut = BigInt.fromI32(0)
266+
service.maxPOIStaleness = BigInt.fromI32(0)
267+
service.stakeToFeesRatio = BigInt.fromI32(0)
268+
service.minimumProvisionTokens = BigInt.fromI32(0)
269+
service.maximumProvisionTokens = BigInt.fromI32(0)
270+
service.minimumVerifierCut = BigInt.fromI32(0)
271+
service.maximumVerifierCut = BigInt.fromI32(0)
272+
service.minimumThawingPeriod = BigInt.fromI32(0)
273+
service.maximumThawingPeriod = BigInt.fromI32(0)
266274
service.save()
267275
}
268276

src/mappings/subgraphService.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { BigDecimal, BigInt, ethereum, log } from "@graphprotocol/graph-ts"
2-
import { AllocationClosed, AllocationCreated, AllocationResized, CurationCutSet, DelegationRatioSet, IndexingRewardsCollected, QueryFeesCollected, RewardsDestinationSet, ServiceProviderRegistered } from "../types/SubgraphService/SubgraphService"
2+
import { AllocationClosed, AllocationCreated, AllocationResized, CurationCutSet, DelegationRatioSet, IndexingRewardsCollected, MaxPOIStalenessSet, ProvisionTokensRangeSet, QueryFeesCollected, RewardsDestinationSet, ServiceProviderRegistered, StakeToFeesRatioSet, ThawingPeriodRangeSet, VerifierCutRangeSet } from "../types/SubgraphService/SubgraphService"
33
import { batchUpdateSubgraphSignalledTokens, calculatePricePerShare, createOrLoadDataService, createOrLoadEpoch, createOrLoadGraphNetwork, createOrLoadIndexerQueryFeePaymentAggregation, createOrLoadPaymentSource, createOrLoadProvision, createOrLoadSubgraphDeployment, joinID, updateDelegationExchangeRate } from "./helpers/helpers"
44
import { Allocation, GraphAccount, Indexer, PoiSubmission, SubgraphDeployment } from "../types/schema"
55
import { addresses } from "../../config/addresses"
@@ -405,3 +405,36 @@ export function handleCurationCutSet(event: CurationCutSet): void {
405405
dataService.curationCut = event.params.curationCut
406406
dataService.save()
407407
}
408+
409+
export function handleMaxPOIStalenessSet(event: MaxPOIStalenessSet): void {
410+
let dataService = createOrLoadDataService(event.address)
411+
dataService.maxPOIStaleness = event.params.maxPOIStaleness
412+
dataService.save()
413+
}
414+
415+
export function handleStakeToFeesRatioSet(event: StakeToFeesRatioSet): void {
416+
let dataService = createOrLoadDataService(event.address)
417+
dataService.stakeToFeesRatio = event.params.ratio
418+
dataService.save()
419+
}
420+
421+
export function handleProvisionTokensRangeSet(event: ProvisionTokensRangeSet): void {
422+
let dataService = createOrLoadDataService(event.address)
423+
dataService.minimumProvisionTokens = event.params.min
424+
dataService.maximumProvisionTokens = event.params.max
425+
dataService.save()
426+
}
427+
428+
export function handleVerifierCutRangeSet(event: VerifierCutRangeSet): void {
429+
let dataService = createOrLoadDataService(event.address)
430+
dataService.minimumVerifierCut = event.params.min
431+
dataService.maximumVerifierCut = event.params.max
432+
dataService.save()
433+
}
434+
435+
export function handleThawingPeriodRangeSet(event: ThawingPeriodRangeSet): void {
436+
let dataService = createOrLoadDataService(event.address)
437+
dataService.minimumThawingPeriod = event.params.min
438+
dataService.maximumThawingPeriod = event.params.max
439+
dataService.save()
440+
}

subgraph.template.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,16 @@ dataSources:
485485
handler: handleDelegationRatioSet
486486
- event: CurationCutSet(uint256)
487487
handler: handleCurationCutSet
488+
- event: MaxPOIStalenessSet(uint256)
489+
handler: handleMaxPOIStalenessSet
490+
- event: StakeToFeesRatioSet(uint256)
491+
handler: handleStakeToFeesRatioSet
492+
- event: ProvisionTokensRangeSet(uint256,uint256)
493+
handler: handleProvisionTokensRangeSet
494+
- event: VerifierCutRangeSet(uint32,uint32)
495+
handler: handleVerifierCutRangeSet
496+
- event: ThawingPeriodRangeSet(uint64,uint64)
497+
handler: handleThawingPeriodRangeSet
488498
- kind: ethereum/contract
489499
name: GraphPayments
490500
network: {{network}}

0 commit comments

Comments
 (0)