-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathschema.graphql
More file actions
2804 lines (2695 loc) · 64.5 KB
/
Copy pathschema.graphql
File metadata and controls
2804 lines (2695 loc) · 64.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
enum ProjectType {
SUBQUERY
RPC
SQ_DICT
SUBGRAPH
LLM
}
enum OrderType {
SERVICE_AGREEMENT
STATE_CHANNEL
UNKNOWN
}
enum ServiceStatus {
READY
TERMINATED
}
enum WithdrawalStatus {
ONGOING
CLAIMED
CANCELLED
}
enum WithdrawalType {
UNDELEGATION
UNSTAKE
COMMISSION
MERGE
}
enum ChannelStatus {
FINALIZED
OPEN
TERMINATING
}
enum DisputeType {
POI
QUERY
}
enum DisputeState {
ONGOING
ACCEPTED
REJECTED
CANCELLED
}
"""
Project entity represents SubQuery projects in the network.
Each project can have multiple deployment versions and dynamic type weighting configuration.
"""
type Project @entity {
"""
Project unique identifier
"""
id: ID!
"""
Project owner wallet address
"""
owner: String!
"""
Project type classification
"""
type: ProjectType!
"""
Project metadata IPFS hash
"""
metadata: String!
"""
IPFS hash pointing to deployment code version
"""
deploymentId: String!
"""
IPFS hash pointing to deployment metadata
"""
deploymentMetadata: String!
"""
When project was last updated
"""
updatedTimestamp: Date!
"""
When project was created
"""
createdTimestamp: Date!
"""
Total rewards earned by this project
"""
totalReward: BigInt!
"""
Consumer boost funds for this project's deployments
"""
totalBoost: BigInt!
"""
Combined operator(indexer) + delegator allocation funds
"""
totalAllocation: BigInt!
"""
Ratio of boost to total allocation with 18 decimal precision: (totalBoost * 10^18) / totalAllocation
"""
boostAllocationRatio: BigInt!
deployments: [Deployment] @derivedFrom(field: "project")
"""
Block number when record was created
"""
createdBlock: Int
"""
Latest event details: topicHandler:blockNumber
"""
lastEvent: String
}
"""
Deployment entity represents versions of a project's code deployment.
A single project can have multiple deployments (versions), with Plans for creating agreements and IndexerDeployment records for operators running it.
"""
type Deployment @entity {
"""
Deployment identifier (IPFS hash to deployment)
"""
id: ID!
"""
Deployment metadata IPFS hash
"""
metadata: String!
"""
The parent project that this deployment belongs to - one project can have multiple deployment versions
"""
project: Project!
"""
List of operators(indexers) that are running this specific deployment
"""
indexers: [IndexerDeployment]! @derivedFrom(field: "deployment")
"""
When deployment was created
"""
createdTimestamp: Date!
"""
Service plans available for creating agreements on this deployment
"""
plans: [Plan]! @derivedFrom(field: "deployment")
"""
Block number when record was created
"""
createdBlock: Int
"""
Latest event details: topicHandler:blockNumber
"""
lastEvent: String
}
"""
IndexerDeployment tracks which operators (indexers) are running specific deployments.
One operator can serve multiple deployments, and one deployment can be served by multiple operators.
Status changes are controlled by operator calling chain methods.
"""
type IndexerDeployment @entity {
"""
Composite ID: indexer address + deployment id
"""
id: ID!
indexer: Indexer!
deployment: Deployment!
"""
Timestamp of the last status change - when operator called chain methods to update service status
"""
timestamp: Date
"""
Current service status (READY/TERMINATED) - controlled by operator via on-chain method calls
"""
status: ServiceStatus!
"""
Block number when record was created
"""
createdBlock: Int
"""
Latest event details: topicHandler:blockNumber
"""
lastEvent: String
}
"""
Era represents time periods for reward distribution cycles in the network.
Era duration is operator-triggered with minimum seconds configuration, may have delays.
Most reward distributions are triggered after era transitions.
eraPeriod stores duration in milliseconds format (seconds * 1000).
"""
type Era @entity {
"""
Era identifier
"""
id: ID!
"""
Block timestamp when this Era started - triggered by operator calling era advancement.
Most reward distributions are triggered after era transitions.
"""
startTime: Date!
"""
Block timestamp when this Era ended (when next Era started) - may be delayed beyond configured period
"""
endTime: Date
"""
True when this Era was force-created to fill missing previous Era data
"""
forceNext: Boolean
"""
Block number when record was created
"""
createdBlock: Int
"""
Latest event details: topicHandler:blockNumber
"""
lastEvent: String
"""
Era period duration in milliseconds - derived from on-chain eraPeriod configuration (seconds * 1000)
"""
eraPeriod: String
}
"""
AI/LLM Warning: Do not use this JSONBigInt field for filtering or queries.
Use the flattened BigInt field instead (e.g., maxUnstakeAmountValue)
This is a legacy workaround from old SDK bugs - flattened fields are preferred for easier AI analysis.
"""
type JSONBigInt @jsonField {
"""
Always "bigint" - type identifier for the JSON field
"""
type: String!
"""
Hex encoded string representation of the BigInt value
"""
value: String!
}
"""
AI/LLM Warning: Do not use this EraValue field for filtering or queries.
Use the flattened fields instead (e.g., commissionEra, commissionEraValueAt, commissionEraValueAfter)
This is a legacy workaround for tracking value changes across eras - flattened fields are preferred for easier AI analysis.
"""
type EraValue @jsonField {
"""
Era number when this value change occurred
"""
era: Int!
"""
Value before the change in the specified era
"""
value: JSONBigInt!
"""
Value after the change in the specified era
"""
valueAfter: JSONBigInt!
"""
Block number when record was created
"""
createdBlock: Int
"""
Latest event details: topicHandler:blockNumber
"""
lastEvent: String
}
"""
Indexer entity represents network operators who run deployments and earn rewards.
Contains both EraValue and flattened fields - use flattened fields for easier querying.
Capacity = selfStake * leverageLimit - totalStake (remaining delegation capacity).
Current value rule: use xxxEraValueAfter if currentEra > xxxEra, otherwise use xxxEraValue.
"""
type Indexer @entity {
"""
Indexer wallet address
"""
id: ID!
"""
Indexer metadata IPFS CID
"""
metadata: String!
"""
Controller address for the indexer (proxy for chain operations)
"""
controller: String
"""
AI/LLM Warning: Do not use this field for filtering or queries. Use commissionEra, commissionEraValue, commissionEraValueAfter instead
"""
commission: EraValue!
"""
Era when commission rate was last changed.
For current commission rate: use commissionEraValueAfter if currentEra > commissionEra, otherwise use commissionEraValue
"""
commissionEra: Int!
"""
Commission rate value before the change in commissionEra
"""
commissionEraValue: BigInt!
"""
Commission rate value after the change in commissionEra
"""
commissionEraValueAfter: BigInt!
"""
AI/LLM Warning: Do not use this field for filtering or queries. Use totalStakeEra, totalStakeEraValue, totalStakeEraValueAfter instead
"""
totalStake: EraValue!
"""
Era when total stake was last changed.
For current total stake: use totalStakeEraValueAfter if currentEra > totalStakeEra, otherwise use totalStakeEraValue
"""
totalStakeEra: Int!
"""
Total stake value before the change in totalStakeEra (selfStake + all delegations)
"""
totalStakeEraValue: BigInt!
"""
Total stake value after the change in totalStakeEra (selfStake + all delegations)
"""
totalStakeEraValueAfter: BigInt!
"""
AI/LLM Warning: Do not use this field for filtering or queries. Use selfStakeEra, selfStakeEraValue, selfStakeEraValueAfter instead
"""
selfStake: EraValue!
"""
Era when self stake was last changed.
For current self stake: use selfStakeEraValueAfter if currentEra > selfStakeEra, otherwise use selfStakeEraValue
"""
selfStakeEra: Int!
"""
Self stake value before the change in selfStakeEra
"""
selfStakeEraValue: BigInt!
"""
Self stake value after the change in selfStakeEra
"""
selfStakeEraValueAfter: BigInt!
"""
AI/LLM Warning: Do not use this field for filtering or queries. Use capacityEra, capacityEraValue, capacityEraValueAfter instead
"""
capacity: EraValue!
"""
Era when capacity was last changed.
For current capacity: use capacityEraValueAfter if currentEra > capacityEra, otherwise use capacityEraValue
"""
capacityEra: Int!
"""
Capacity value before the change in capacityEra.
Capacity = selfStake * leverageLimit - totalStake (remaining delegation capacity)
"""
capacityEraValue: BigInt!
"""
Capacity value after the change in capacityEra.
Capacity = selfStake * leverageLimit - totalStake (remaining delegation capacity)
"""
capacityEraValueAfter: BigInt!
"""
AI/LLM Warning: Do not use this field for filtering or queries. Use maxUnstakeAmountValue instead
"""
maxUnstakeAmount: JSONBigInt!
"""
Maximum unstake amount as BigInt value
"""
maxUnstakeAmountValue: BigInt!
controllers: [Controller] @derivedFrom(field: "indexer")
projects: [IndexerDeployment] @derivedFrom(field: "indexer")
delegations: [Delegation] @derivedFrom(field: "indexer")
rewards: [IndexerReward] @derivedFrom(field: "indexer")
"""
Era when this indexer last claimed rewards
"""
lastClaimEra: String
"""
Era when this indexer's rewards were last settled/calculated
"""
lastSettledEra: String
"""
Whether the indexer is currently active
"""
active: Boolean! @index
"""
Block number when record was created
"""
createdBlock: Int
"""
Latest event details: topicHandler:blockNumber
"""
lastEvent: String
}
"""
Historical commission rate records for indexers across different eras.
When commission rate changes, creates records for current era + next 2 eras.
New rate takes effect from era+2, providing 2-era buffer period for delegators.
"""
type IndexerCommissionRate @entity {
"""
Composite ID: indexer address + era id (hex format)
"""
id: ID!
indexer: Indexer!
era: Era!
"""
Era number for easier calculation and comparison
"""
eraIdx: Int!
"""
Commission rate converted from indexer.commission BigInt to Number
"""
commissionRate: Int!
}
"""
Controller entity represents proxy addresses that execute on-chain operations for indexers.
Each indexer can have only one active controller at a time, but can switch controllers.
Historical controller records are preserved with isActive flag indicating current status.
"""
type Controller @entity {
"""
Composite ID: indexer address + controller address
"""
id: ID!
"""
Controller proxy address that executes chain operations
"""
controller: String!
indexer: Indexer!
"""
Whether this controller is currently active for the indexer (only one can be active at a time)
"""
isActive: Boolean!
"""
Block number when record was created
"""
createdBlock: Int
"""
Latest event details: topicHandler:blockNumber
"""
lastEvent: String
}
"""
Delegator entity represents users who delegate tokens to indexers to earn rewards.
Tracks total delegations across all indexers with era-based value changes.
exitEra is set only when completely exiting (totalDelegations <= 0), otherwise remains -1.
"""
type Delegator @entity {
"""
Delegator wallet address
"""
id: ID!
"""
AI/LLM Warning: Do not use this field for filtering or queries. Use totalDelegationsEra, totalDelegationsEraValue, totalDelegationsEraValueAfter instead
"""
totalDelegations: EraValue!
totalDelegationsEra: Int!
totalDelegationsEraValue: BigInt!
totalDelegationsEraValueAfter: BigInt!
delegations: [Delegation] @derivedFrom(field: "delegator")
claimedRewards: [Reward] @derivedFrom(field: "delegator")
unclaimedRewards: [UnclaimedReward] @derivedFrom(field: "delegator")
"""
Era when first started delegating (or re-entered after complete exit)
"""
startEra: Int!
"""
Era when completely exited all delegations. -1 means still actively delegating
"""
exitEra: Int!
"""
Block number when record was created
"""
createdBlock: Int
"""
Latest event details: topicHandler:blockNumber
"""
lastEvent: String
}
"""
Delegation entity represents a specific delegation relationship between a delegator and an indexer.
Each delegator can have multiple delegations to different indexers.
exitEra is set only when completely exiting this specific delegation, partial withdrawals just update amount.
"""
type Delegation @entity {
"""
Composite ID: delegator address + indexer address
"""
id: ID!
delegator: Delegator!
indexer: Indexer!
"""
AI/LLM Warning: Do not use this field for filtering or queries. Use amountEra, amountEraValue, amountEraValueAfter instead
"""
amount: EraValue!
amountEra: Int!
amountEraValue: BigInt!
amountEraValueAfter: BigInt!
"""
Era when this specific delegation to the indexer was completely exited. undefined/null means still active
"""
exitEra: Int
"""
Block number when record was created
"""
createdBlock: Int
"""
Latest event details: topicHandler:blockNumber
"""
lastEvent: String
}
"""
AI/LLM Warning: Do not use this DelegationFrom field for filtering or queries.
Use the flattened fields instead (e.g., delegatorAddresses, delegatorAmounts)
DelegationFrom represents delegator information in era-based snapshots.
Used in EraIndexerDelegator entity to store all delegators for a specific indexer in a specific era.
Legacy JSON field type - flattened arrays are preferred for easier AI analysis.
"""
type DelegationFrom @jsonField {
"""
Delegator wallet address
"""
delegator: String!
"""
Delegation amount from this delegator
"""
amount: BigInt!
}
"""
AI/LLM Warning: Do not use this DelegationTo field for filtering or queries.
Use the flattened fields instead (e.g., indexerAddresses, indexerAmounts)
DelegationTo represents indexer information from delegator's perspective in era-based snapshots.
Used in EraDelegatorIndexer entity to store all indexers a specific delegator delegates to in a specific era.
Symmetric counterpart to DelegationFrom - provides delegator->indexer view while DelegationFrom provides indexer->delegator view.
Legacy JSON field type - flattened arrays are preferred for easier AI analysis.
"""
type DelegationTo @jsonField {
"""
Target indexer address receiving the delegation
"""
indexer: String!
"""
Delegation amount to this indexer
"""
amount: BigInt!
}
"""
EraIndexerDelegator provides era-based snapshots of delegator distribution for each indexer.
Uses dual ID system: 'indexer' for latest live data, 'indexer:era' for historical snapshots.
Real-time updates to latest record, batch creation of historical records via fillUpEraIndexerDelegator.
totalStake = sum of all delegatorAmounts + selfStake.
"""
type EraIndexerDelegator @entity {
"""
Dual ID format: 'indexer_address' (latest data) or 'indexer_address:era_hex' (historical data)
"""
id: ID!
indexer: String!
era: Int!
"""
AI/LLM Warning: Do not use this field for filtering or queries. Use delegatorAddresses, delegatorAmounts instead
"""
delegators: [DelegationFrom!]!
delegatorAddresses: [String!]!
delegatorAmounts: [BigInt!]!
"""
Total stake amount: sum of all delegation amounts plus self stake
"""
totalStake: BigInt!
"""
Self stake amount by the indexer
"""
selfStake: BigInt!
}
"""
EraDelegatorIndexer provides era-based snapshots of indexer targets from each delegator's perspective.
Symmetric counterpart to EraIndexerDelegator - shows which indexers a delegator delegates to.
Uses same dual ID system: 'delegator' for latest live data, 'delegator:era' for historical snapshots.
Real-time updates to latest record, batch creation of historical records via fillUpEraDelegatorIndexer.
"""
type EraDelegatorIndexer @entity {
"""
Dual ID format: 'delegator_address' (latest data) or 'delegator_address:era_hex' (historical data)
"""
id: ID!
delegator: String!
era: Int!
"""
AI/LLM Warning: Do not use this field for filtering or queries. Use indexerAddresses, indexerAmounts instead
"""
indexers: [DelegationTo!]!
indexerAddresses: [String!]!
indexerAmounts: [BigInt!]!
"""
Total stake amount: sum of all delegation amounts by this delegator
"""
totalStake: BigInt!
"""
Self stake amount if this delegator is also an indexer, otherwise 0
"""
selfStake: BigInt!
}
"""
Withdrawl represents withdrawal/unstaking operations in the network.
Note: Entity name has intentional spelling (Withdrawl vs Withdrawal) - cannot be changed.
Supports different withdrawal types: undelegation, unstaking, commission claims, and merge operations.
Status progresses from ONGOING to either CLAIMED or CANCELLED.
"""
type Withdrawl @entity {
"""
Composite ID: delegator_address:index_hex
"""
id: ID!
"""
Sequential index for this delegator's withdrawal operations
"""
index: BigInt!
"""
Delegator (nominator) address initiating the withdrawal
"""
delegator: String! @index
"""
Target indexer address for the withdrawal operation
"""
indexer: String!
"""
Timestamp when withdrawal was initiated
"""
startTime: Date!
"""
Amount being withdrawn
"""
amount: BigInt!
"""
Type of withdrawal: UNDELEGATION, UNSTAKE, COMMISSION, or MERGE
"""
type: WithdrawalType!
"""
Current status: ONGOING, CLAIMED, or CANCELLED
"""
status: WithdrawalStatus!
"""
Block number when record was created
"""
createdBlock: Int
"""
Latest event details: topicHandler:blockNumber
"""
lastEvent: String
}
"""
ConsumerController represents proxy addresses that execute on-chain operations for consumers.
Similar to indexer controllers, consumers can delegate operational control to controller addresses.
Provides consumer-side proxy management mechanism for chain interactions.
"""
type ConsumerController @entity {
"""
Composite ID: consumer_address_controller_address
"""
id: ID!
"""
Controller proxy address that executes chain operations for the consumer
"""
controller: String! @index
"""
Consumer address that delegates control to the controller
"""
consumer: String! @index
"""
Block number when record was created
"""
createdBlock: Int
"""
Latest event details: topicHandler:blockNumber
"""
lastEvent: String
}
"""
PlanTemplate represents service plan templates that define pricing and service limits.
Templates are used to create specific Plan instances with custom pricing.
Supports billing periods, request quotas, rate limiting, and multi-token payments.
Templates can be activated/deactivated and have updatable metadata stored on IPFS.
"""
type PlanTemplate @entity {
"""
Template index in hex format
"""
id: ID!
"""
Billing period duration (units defined in contract)
"""
period: BigInt!
"""
Daily request quota limit
"""
dailyReqCap: BigInt!
"""
Request rate limit (requests per time unit)
"""
rateLimit: BigInt!
"""
Payment token contract address
"""
priceToken: String!
"""
IPFS CID containing additional service description and metadata
"""
metadata: String
"""
Whether this template is currently active and available for use
"""
active: Boolean!
"""
Block number when record was created
"""
createdBlock: Int
"""
Latest event details: topicHandler:blockNumber
"""
lastEvent: String
}
"""
Plan represents specific service plan instances created from PlanTemplate.
Inherits service limits (period, quotas, rate limits) from template but has custom pricing.
Can be optionally bound to specific deployments to provide targeted services.
Used as basis for creating ServiceAgreements between indexers and consumers.
"""
type Plan @entity {
"""
Plan index in hex format
"""
id: ID!
"""
Custom price for this plan instance
"""
price: BigInt!
"""
Address of the plan creator (typically indexer)
"""
creator: String! @index
"""
Template that defines service limits and payment token
"""
planTemplate: PlanTemplate!
"""
Whether this plan is currently active and available
"""
active: Boolean!
"""
Optional deployment this plan is specifically bound to
"""
deployment: Deployment
"""
Block number when record was created
"""
createdBlock: Int
"""
Latest event details: topicHandler:blockNumber
"""
lastEvent: String
}
"""
ServiceAgreement represents service contracts between indexers and consumers.
Created when a closed service agreement is established on-chain, defining service terms,
duration, and payment amounts. Each agreement is an NFT-like token that can be transferred.
"""
type ServiceAgreement @entity {
"""
Service agreement token ID from the contract
"""
id: ID!
"""
Indexer providing the service
"""
indexerAddress: String! @index
"""
Consumer purchasing the service (can be transferred)
"""
consumerAddress: String! @index
"""
Deployment being served by this agreement
"""
deployment: Deployment!
"""
Template defining service limits and payment token (not Plan instance)
"""
planTemplate: PlanTemplate!
"""
Service duration in seconds
"""
period: BigInt!
"""
Agreement start timestamp
"""
startTime: Date!
"""
Agreement end timestamp (calculated from startTime + period)
"""
endTime: Date! @index
"""
Total amount locked/paid for this service agreement
"""
lockedAmount: BigInt!
"""
Block number when record was created
"""
createdBlock: Int
"""
Latest event details: topicHandler:blockNumber
"""
lastEvent: String
}
"""
UnclaimedReward tracks accumulated unclaimed rewards for delegator-indexer pairs.
Rewards accumulate over time through era distributions and are removed when claimed,
creating a corresponding Reward record for the claimed amount.
"""
type UnclaimedReward @entity {
"""
Composite ID: indexer_address:delegator_address
"""
id: ID!
"""
Indexer address earning rewards
"""
indexerAddress: String!
"""
Delegator address with unclaimed rewards
"""
delegatorAddress: String! @index
"""
Reference to the delegator entity
"""
delegator: Delegator
"""
Total accumulated unclaimed reward amount (cumulative)
"""
amount: BigInt!
"""
Block number when record was created
"""
createdBlock: Int
"""
Latest event details: topicHandler:blockNumber
"""
lastEvent: String
}
"""
Reward represents historical records of claimed rewards.
Created when users claim their accumulated rewards from UnclaimedReward entities.
Each record is immutable and tracks the specific claim transaction details.
"""
type Reward @entity {
"""
Composite ID: indexer:delegator:transaction_hash:log_index
"""
id: ID!
"""
Indexer address that earned the rewards
"""
indexerAddress: String!
"""
Delegator address that claimed the rewards
"""
delegatorAddress: String! @index
"""
Reference to the delegator entity
"""
delegator: Delegator
"""
Amount of rewards claimed in this transaction
"""
amount: BigInt!
"""
Timestamp when the rewards were claimed
"""
claimedTime: Date!
"""
Block number when record was created
"""
createdBlock: Int
"""
Latest event details: topicHandler:blockNumber
"""
lastEvent: String
}
"""
IndexerReward tracks the total accumulated rewards for each indexer per era.
Records are created or updated when various reward events occur (instant rewards, agreement rewards, etc.).
Amount field accumulates all rewards an indexer receives during a specific era.
"""
type IndexerReward @entity {
"""
Composite ID: indexer_address:era_hex
"""
id: ID!
"""
Reference to the indexer earning rewards
"""
indexer: Indexer!
"""
Era index in string format (deprecated, use eraId instead)
"""
eraIdx: String!
"""
Era index in BigInt format
"""
eraId: BigInt!
"""
Total accumulated reward amount for this indexer in this era
"""
amount: BigInt!
"""
Block number when record was created
"""
createdBlock: Int
"""
Latest event details: topicHandler:blockNumber
"""
lastEvent: String
}
"""
EraReward tracks detailed reward records for each indexer-delegator pair per era.
Records both regular delegation rewards and commission rewards for indexers.
Provides granular reward tracking that feeds into APY calculations and claim management.
"""
type EraReward @entity {
"""
Composite ID: indexer:delegator:era[_commission]
Appends '_commission' suffix for commission reward records
"""
id: ID!
"""
Indexer earning or distributing the rewards
"""
indexer: Indexer!
"""
Delegator receiving the rewards (same as indexer for commission)
"""
delegator: Delegator!
"""
Era when this reward was distributed
"""
era: Era!
"""
Era index as integer
"""
eraIdx: Int!
"""
True if this is a self-stake reward (indexerId === delegatorId)
"""
isIndexer: Boolean!
"""
True if this represents commission earnings for indexer
"""
isCommission: Boolean!
"""
Reward amount for this specific indexer-delegator-era combination
"""
amount: BigInt!
"""
Whether this reward has been claimed (commission rewards are auto-claimed)
"""
claimed: Boolean!
createdBlock: Int
createdTimestamp: Date!