-
Notifications
You must be signed in to change notification settings - Fork 45
/
schema.graphql
1470 lines (1367 loc) · 54.3 KB
/
schema.graphql
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
"""
Graph Network global parameters and contract addresses
"""
type GraphNetwork @entity {
"ID is set to 1"
id: ID!
"Controller address"
controller: Bytes!
"Graph token address"
graphToken: Bytes!
"Epoch manager address"
epochManager: Bytes!
"Epoch Manager implementations. Last in the array is current"
epochManagerImplementations: [Bytes!]!
"Curation address"
curation: Bytes!
"Curation implementations. Last in the array is current"
curationImplementations: [Bytes!]!
"Staking address"
staking: Bytes!
"Graph token implementations. Last in the array is current"
stakingImplementations: [Bytes!]!
"Dispute manager address"
disputeManager: Bytes!
"GNS address"
gns: Bytes!
"Service registry address"
serviceRegistry: Bytes!
"Rewards manager address"
rewardsManager: Bytes!
"Rewards Manager implementations. Last in the array is current"
rewardsManagerImplementations: [Bytes!]!
"True if the protocol is paused"
isPaused: Boolean!
"True if the protocol is partially paused"
isPartialPaused: Boolean!
"Governor of the controller (i.e. the whole protocol)"
governor: Bytes!
"Pause guardian address"
pauseGuardian: Bytes!
# Staking global parameters
"Percentage of fees going to curators. In parts per million"
curationPercentage: Int!
"Percentage of fees burn as protocol fee. In parts per million"
protocolFeePercentage: Int!
"Ratio of max staked delegation tokens to indexers stake that earns rewards"
delegationRatio: Int!
"[DEPRECATED] Epochs to wait before fees can be claimed in rebate pool"
channelDisputeEpochs: Int!
"Epochs to wait before delegators can settle"
maxAllocationEpochs: Int!
"Time in blocks needed to wait to unstake"
thawingPeriod: Int!
"Minimum time an Indexer must use for resetting their Delegation parameters"
delegationParametersCooldown: Int!
"Minimum GRT an indexer must stake"
minimumIndexerStake: BigInt!
"Contracts that have been approved to be a slasher"
slashers: [Bytes!]
"Time in epochs a delegator needs to wait to withdraw delegated stake"
delegationUnbondingPeriod: Int!
"[DEPRECATED] Alpha in the cobbs douglas formula"
rebateRatio: BigDecimal!
"Alpha in the exponential formula"
rebateAlpha: BigDecimal!
"Lambda in the exponential formula"
rebateLambda: BigDecimal!
"Tax that delegators pay to deposit. In Parts per million"
delegationTaxPercentage: Int!
"Asset holder for the protocol"
assetHolders: [Bytes!]
# Transfers to L2 totals
"Total amount of indexer stake transferred to L2"
totalTokensStakedTransferredToL2: BigInt!
"Total amount of delegated tokens transferred to L2"
totalDelegatedTokensTransferredToL2: BigInt!
"Total amount of delegated tokens transferred to L2"
totalSignalledTokensTransferredToL2: BigInt!
# Staking global aggregate values
"The total amount of GRT staked in the staking contract"
totalTokensStaked: BigInt!
"NOT IMPLEMENTED - Total tokens that are settled and waiting to be claimed"
totalTokensClaimable: BigInt! # TODO - see https://github.com/graphprotocol/graph-network-subgraph/issues/89
"Total tokens that are currently locked or withdrawable in the network from unstaking"
totalUnstakedTokensLocked: BigInt!
"Total GRT currently in allocation"
totalTokensAllocated: BigInt!
"Total delegated tokens in the protocol"
totalDelegatedTokens: BigInt!
# Curation global aggregate values
"The total amount of GRT signalled in the Curation contract"
totalTokensSignalled: BigInt!
"Total GRT currently curating via the Auto-Migrate function"
totalTokensSignalledAutoMigrate: BigDecimal!
"Total GRT currently curating to a specific version"
totalTokensSignalledDirectly: BigDecimal!
# Query fees globals
"Total query fees generated in the network"
totalQueryFees: BigInt!
"Total query fees collected by indexers"
totalIndexerQueryFeesCollected: BigInt!
"Total query fees rebates claimed by indexers"
totalIndexerQueryFeeRebates: BigInt!
"Total query fees rebates claimed by delegators"
totalDelegatorQueryFeeRebates: BigInt!
"Total query fees payed to curators"
totalCuratorQueryFees: BigInt!
"Total protocol taxes applied to the query fees"
totalTaxedQueryFees: BigInt!
# It is hard to separate the unclaimed and rebates lost
"Total unclaimed rebates. Includes unclaimed rebates, and rebates lost in rebates mechanism "
totalUnclaimedQueryFeeRebates: BigInt!
# Indexing rewards globals
"Total indexing rewards minted"
totalIndexingRewards: BigInt!
"Total indexing rewards minted to Delegators"
totalIndexingDelegatorRewards: BigInt!
"Total indexing rewards minted to Indexers"
totalIndexingIndexerRewards: BigInt!
# Rewards manager global parameters
"(Deprecated) The issuance rate of GRT per block before GIP-0037. To get annual rate do (networkGRTIssuance * 10^-18)^(blocksPerYear)"
networkGRTIssuance: BigInt!
"The issuance rate of GRT per block after GIP-0037. To get annual rate do (networkGRTIssuancePerBlock * blocksPerYear)"
networkGRTIssuancePerBlock: BigInt!
"Address of the availability oracle"
subgraphAvailabilityOracle: Bytes!
# Curation global parameters
"Default reserve ratio for all subgraphs. In parts per million"
defaultReserveRatio: Int!
"Minimum amount of tokens needed to start curating"
minimumCurationDeposit: BigInt!
"The fee charged when a curator withdraws signal. In parts per million"
curationTaxPercentage: Int!
"Percentage of the GNS migration tax payed by the subgraph owner"
ownerTaxPercentage: Int!
# Graph Token global variables
"Graph Token supply"
totalSupply: BigInt!
# TODO - implement these with uniswap
"NOT IMPLEMENTED - Price of one GRT in USD"
GRTinUSD: BigDecimal!
"NOT IMPLEMENTED - Price of one GRT in ETH"
GRTinETH: BigDecimal
# Graph Token mint burn totals
"Total amount of GRT minted"
totalGRTMinted: BigInt!
"Total amount of GRT burned"
totalGRTBurned: BigInt!
# Epoch manager global variables
"Epoch Length in blocks"
epochLength: Int!
"Epoch that was last run"
lastRunEpoch: Int!
"Epoch when epoch length was last updated"
lastLengthUpdateEpoch: Int!
"Block when epoch length was last updated"
lastLengthUpdateBlock: Int!
"Current epoch the protocol is in"
currentEpoch: Int!
# Count aggregate values. Note, deprecated subgraphs or inactive users not removed from counts
"Total indexers"
indexerCount: Int!
"Number of indexers that currently have some stake in the protocol"
stakedIndexersCount: Int!
"Total amount of delegators historically"
delegatorCount: Int!
"Total active delegators. Those that still have at least one active delegation."
activeDelegatorCount: Int!
"Total amount of delegations historically"
delegationCount: Int!
"Total active delegations. Those delegations that still have GRT staked towards an indexer"
activeDelegationCount: Int!
"Total amount of curators historically"
curatorCount: Int!
"Total amount of curators historically"
activeCuratorCount: Int!
"Total amount of Subgraph entities"
subgraphCount: Int!
"Amount of active Subgraph entities"
activeSubgraphCount: Int!
"Total amount of SubgraphDeployment entities"
subgraphDeploymentCount: Int!
"Total epochs"
epochCount: Int!
"Total amount of allocations opened"
allocationCount: Int!
"Total amount of allocations currently active"
activeAllocationCount: Int!
# Dispute Manager global variables
"Dispute arbitrator"
arbitrator: Bytes!
"Penalty to Indexer on successful disputes for query disputes. In parts per million"
querySlashingPercentage: Int!
"Penalty to Indexer on successful disputes for indexing disputes. In parts per million"
indexingSlashingPercentage: Int!
"[DEPRECATED] Penalty to Indexer on successful disputes for indexing disputes. In parts per million"
slashingPercentage: Int!
"Minimum deposit to create a dispute"
minimumDisputeDeposit: BigInt!
"Reward to Fisherman on successful disputes. In parts per million"
fishermanRewardPercentage: Int!
# Bridge totals (Only available on L1 networks)
"Total amount of GRT deposited to the L1 gateway. Note that the actual amount claimed in L2 might be lower due to tickets not redeemed."
totalGRTDeposited: BigInt!
"Total amount of GRT withdrawn from the L2 gateway and claimed in L1."
totalGRTWithdrawnConfirmed: BigInt!
"Total amount of GRT minted by L1 bridge"
totalGRTMintedFromL2: BigInt!
# Bridge totals (Only available on L2 networks)
"Total amount of GRT deposited to the L1 gateway and redeemed in L2."
totalGRTDepositedConfirmed: BigInt!
"Total amount of GRT withdrawn from the L2 gateway. Note that the actual amount claimed in L1 might be lower due to outbound transactions not finalized."
totalGRTWithdrawn: BigInt!
"Block number for L1. Only implemented for L2 deployments to properly reflect the L1 block used for timings"
currentL1BlockNumber: BigInt
}
"""
An account within the graph network. Contains metadata and all relevant data for this accounts
delegating, curating, and indexing.
"""
type GraphAccount @entity {
"Graph account ID"
id: ID!
"All names this graph account has claimed from all name systems"
names: [GraphAccountName!]! @derivedFrom(field: "graphAccount")
"Default name the graph account has chosen"
defaultName: GraphAccountName # Can optimize in future by checking ENS & others to make sure they still own the name
"Time the account was created"
createdAt: Int!
"Default display name is the current default name. Used for filtered queries in the explorer"
defaultDisplayName: String
# IPFS Meta.
metadata: GraphAccountMeta
# Operator info
"Operator of other Graph Accounts"
operatorOf: [GraphAccount!]! @derivedFrom(field: "operators")
"Operators of this Graph Accounts"
operators: [GraphAccount!]!
# GRT info
"Graph token balance"
balance: BigInt!
"Balance received due to failed signal transfer from L1"
balanceReceivedFromL1Signalling: BigInt!
"Balance received due to failed delegation transfer from L1"
balanceReceivedFromL1Delegation: BigInt!
"Amount this account has approved staking to transfer their GRT"
curationApproval: BigInt!
"Amount this account has approved curation to transfer their GRT"
stakingApproval: BigInt!
"Amount this account has approved the GNS to transfer their GRT"
gnsApproval: BigInt!
# Subgraphs
"Subgraphs the graph account owns"
subgraphs: [Subgraph!]! @derivedFrom(field: "owner")
"Time that this graph account became a developer"
developerCreatedAt: Int
"NOT IMPLEMENTED - Total query fees the subgraphs created by this account have accumulated in GRT"
subgraphQueryFees: BigInt! # TODO - This is very hard to calculate, due to the many to one relationship between Subgraphs and SubgraphDeployments
# Disputes
"Disputes this graph account has created"
createdDisputes: [Dispute!]! @derivedFrom(field: "fisherman")
"Disputes against this graph account"
disputesAgainst: [Dispute!]! @derivedFrom(field: "indexer")
# Staking and Curating and Delegating
"Curator fields for this GraphAccount. Null if never curated"
curator: Curator
"Indexer fields for this GraphAccount. Null if never indexed"
indexer: Indexer
"Delegator fields for this GraphAccount. Null if never delegated"
delegator: Delegator
# Transactions / activity feed
"Name signal transactions created by this GraphAccount"
nameSignalTransactions: [NameSignalTransaction!]! @derivedFrom(field: "signer")
bridgeWithdrawalTransactions: [BridgeWithdrawalTransaction!]! @derivedFrom(field: "signer")
bridgeDepositTransactions: [BridgeDepositTransaction!]! @derivedFrom(field: "signer")
# Token Lock Wallets that this account is associated with
tokenLockWallets: [TokenLockWallet!]!
}
type GraphAccountMeta @entity(immutable:true) {
"IPFS hash with account metadata details"
id: ID!
"Account that reference this metadata file. For compatibility purposes. For the full list use graphAccounts"
graphAccount: GraphAccount @derivedFrom(field:"metadata")
"Accounts that reference this metadata file"
graphAccounts: [GraphAccount!]! @derivedFrom(field:"metadata")
"True if it is an organization. False if it is an individual"
isOrganization: Boolean
"Main repository of code for the graph account"
codeRepository: String
"Description of the graph account"
description: String
"Image URL"
image: String
"Website URL"
website: String
"Display name. Not unique"
displayName: String
}
"""
A name chosen by a Graph Account from a Name System such as ENS. This allows Graph Accounts to be
recognized by name, rather than just an Ethereum address
"""
type GraphAccountName @entity {
"Name system concatenated with the unique ID of the name system"
id: ID!
"Name system for this name"
nameSystem: NameSystem!
"Name from the system"
name: String!
"The graph account that owned the name when it was linked in the graph network"
graphAccount: GraphAccount # May not match if the graph account proceeded to transfer away their name on that system
}
enum NameSystem {
ENS
}
"""
The Subgraph entity represents a permanent, unique endpoint. This unique endpoint can resolve to
many different SubgraphVersions over it's lifetime. The Subgraph can also have a name attributed
to it. The owner of the Subgraph can only use a name once, thus making the owner account and the
name chosen a unique combination. When a Curator singals on a Subgraph, they receive "Name Signal".
"Name Signal" resolves into the underlying "Signal" of the SubgraphDeployment. The metadata of the
subgraph is stored on IPFS.
"""
type Subgraph @entity {
"Subgraph ID - which is derived from the Organization/Individual graph accountID"
id: ID!
"Graph account that owns this subgraph"
owner: GraphAccount!
"Current version. Null if the subgraph is deprecated"
currentVersion: SubgraphVersion
"[DEPRECATED] Past versions. Has the same data as 'versions' but keeps the old naming for backwards compatibility"
pastVersions: [SubgraphVersion!]! @derivedFrom(field: "subgraph")
"List of all the subgraph versions included the current one"
versions: [SubgraphVersion!]! @derivedFrom(field: "subgraph")
"Version counter"
versionCount: BigInt!
"Creation timestamp"
createdAt: Int!
"Updated timestamp"
updatedAt: Int!
"Whether the subgraph is active or deprecated"
active: Boolean!
"Whether the subgraph has been claimed/migrated. Can only be false for subgraphs created with V1 contracts that have not been claimed/migrated"
migrated: Boolean!
"Whether the subgraph has been transferred from L1 to L2. Subgraphs published on L2 will have this as false unless they were published through a transfer"
startedTransferToL2: Boolean!
"Timestamp for the L1 -> L2 Transfer. Null if the transfer hasn't started yet"
startedTransferToL2At: BigInt
"Block number for the L1 -> L2 Transfer. Null if the transfer hasn't started yet"
startedTransferToL2AtBlockNumber: BigInt
"Transaction hash for the L1 -> L2 Transfer. Null if the transfer hasn't started yet"
startedTransferToL2AtTx: String
"Whether the subgraph has been fully transferred from L1 to L2. Subgraphs published on L2 will have this as false unless they were published through a transfer"
transferredToL2: Boolean!
"Timestamp for the L1 -> L2 Transfer. Null if it's not fully transferred or if it's an L1 deployment"
transferredToL2At: BigInt
"Block number for the L1 -> L2 Transfer. Null if it's not fully transferred or if it's an L1 deployment"
transferredToL2AtBlockNumber: BigInt
"Transaction hash for the L1 -> L2 Transfer. Null if it's not fully transferred or if it's an L1 deployment"
transferredToL2AtTx: String
"Amount of GRT transferred to L2"
signalledTokensSentToL2: BigInt!
"Amount of GRT received on L2"
signalledTokensReceivedOnL2: BigInt!
"ID of the subgraph on L2. Null if it's not transferred"
idOnL2: String
"ID of the subgraph on L1. Null if it's not transferred"
idOnL1: String
"The actual ID of the subgraph on the contracts subgraph NFT implementation. BigInt represented as a String. It's only actually valid once the subgraph is migrated (migrated == true)"
nftID: String
"ID of the subgraph that was used on the old version of this The Graph Network Subgraph. Null for Subgraphs created with the new GNS implementation or for version 1 entities (since they use the old id)"
oldID: String
"Address used to create the ID. Only available for Subgraphs created pre-migration"
creatorAddress: Bytes
"Subgraph number used to create the ID. Only available for Subgraphs created pre-migration"
subgraphNumber: BigInt
"Auxiliary field to denote whether the subgraph is handling the initialization order on V2 events. Doesn't matter for V1 events."
initializing: Boolean!
"Version of the entity. Subgraph entities are changing the way their ID is generated when the new GNS v2 rolls out so we need to differnetiate them"
entityVersion: Int!
"[DEPRECATED] Used for duplicate entities to enable old IDs from before the subgraph NFT update"
linkedEntity: Subgraph
# Name curation data for bonding curve
# Note that the Subgraphs V signal is actually stored in a Signal entity, which
# considers the GNS as a Curator
"CUMULATIVE signaled tokens on this subgraph all time"
signalledTokens: BigInt!
"CUMULATIVE unsignalled tokens on this subgraph all time"
unsignalledTokens: BigInt!
"CURRENT amount of tokens signalled on this subgraph latest version. Mirrors the total amount signalled towards the current deployment."
currentSignalledTokens: BigInt!
"The CURRENT name signal amount for this subgraph"
nameSignalAmount: BigInt!
"Current amount of version signal managed by the name pool"
signalAmount: BigInt!
"Reserve ratio of the name curation curve. In parts per million"
reserveRatio: Int!
"Tokens that can be withdrawn once the Subgraph is deprecated"
withdrawableTokens: BigInt!
"Tokens the curators have withdrawn from the deprecated Subgraph"
withdrawnTokens: BigInt!
"Curators of this subgraph deployment"
nameSignals: [NameSignal!]! @derivedFrom(field: "subgraph")
"Total amount of NameSignal entities"
nameSignalCount: Int!
# Meta from IPFS linked in GNS
"Subgraph metadata"
metadataHash: Bytes
"Subgraph metadata ipfs hash and entity"
metadata: SubgraphMeta
# Auxiliary fields
currentVersionRelationEntity: CurrentSubgraphDeploymentRelation
}
type SubgraphMeta @entity(immutable:true) {
"Subgraph metadata ipfs hash"
id: ID!
"Subgraph that reference this metadata. For compatibility purposes. For the full list use subgraphs"
subgraph: Subgraph @derivedFrom(field:"metadata")
"Subgraphs that reference this metadata"
subgraphs: [Subgraph!]! @derivedFrom(field:"metadata")
"Short description of the subgraph"
description: String
"Image in string format"
image: String
"NFT Image representation"
nftImage: String
"Location of the code for this project"
codeRepository: String
"Projects website"
website: String
"Display name"
displayName: String
"Categories that the subgraph belongs to."
categories: [String!]
}
type CurrentSubgraphDeploymentRelation @entity {
"Auxiliary entity used to batch update Subgraph entities when signalling on the deployment changes. ID replicates the deployment ID and adds a counter, to make it easy to reproduce."
id: ID!
subgraph: Subgraph!
deployment: SubgraphDeployment!
"Indicates whether this relation is active. This means that the deployment is still the current deployment for the named Subgraph"
active: Boolean!
}
"""
The SubgraphVersion entity represents a version of the Subgraph. A new SubgraphVersion is created
whenever there is an update to the Subgraph triggered by the owner. The new SubgraphVersion can
then point to a new SubgraphDeployment, thus allowing the Subgraph to resolve to a different
deployment, while keeping the same endpoint. The metadata and label are stored on IPFS. The label
is for the developer to provide a semantic version. This is different from the version, which is
just a counter than increases each time a new SubgraphVersion is created for a Subgraph.
"""
type SubgraphVersion @entity {
"Concatenation of subgraph, subgraph deployment, and version ID"
id: ID!
"Subgraph of this version"
subgraph: Subgraph!
"Subgraph deployment of this version"
subgraphDeployment: SubgraphDeployment!
"Version number"
version: Int!
"Creation timestamp"
createdAt: Int!
metadataHash: Bytes
# Meta from IPFS linked in GNS
metadata: SubgraphVersionMeta
entityVersion: Int!
"[DEPRECATED] Used for duplicate entities to enable old IDs from before the subgraph NFT update"
linkedEntity: SubgraphVersion
}
type SubgraphVersionMeta @entity(immutable:true) {
"Subgraph version metadata ipfs hash"
id: ID!
"SubgraphVersion entity that references this metadata. For compatibility purposes. For the full list use subgraphVersions"
subgraphVersion: SubgraphVersion @derivedFrom(field:"metadata")
"SubgraphVersion entities that reference this metadata"
subgraphVersions: [SubgraphVersion!]! @derivedFrom(field:"metadata")
"Short description of the version"
description: String
"Semantic versioning label"
label: String
}
"""
The SubgraphDeployment is represented by the immutable subgraph code that is uploaded, and posted
to IPFS. A SubgraphDeployment has a manifest which gives the instructions to the Graph Network on
what to index. The entity stores relevant data for the SubgraphDeployment on how much it is being
staked on and signaled on in the contracts, as well as how it is performing in query fees. It is
related to a SubgraphVersion.
"""
type SubgraphDeployment @entity {
"Subgraph Deployment ID. The IPFS hash with Qm removed to fit into 32 bytes"
id: ID!
"IPFS hash of the subgraph manifest"
ipfsHash: String!
"The versions this subgraph deployment relates to"
versions: [SubgraphVersion!]! @derivedFrom(field: "subgraphDeployment")
"Creation timestamp"
createdAt: Int!
"The block at which this deployment was denied for rewards. Null if not denied"
deniedAt: Int!
"[DEPRECATED] The original Subgraph that was deployed through GNS. Can be null if never created through GNS. Used for filtering in the Explorer. Always null now"
originalName: String
# From Staking
"CURRENT total stake of all indexers on this Subgraph Deployment"
stakedTokens: BigInt!
"Allocations created by indexers for this Subgraph"
indexerAllocations: [Allocation!]! @derivedFrom(field: "subgraphDeployment")
"Total rewards accrued all time by this Subgraph Deployment. Includes delegator and indexer rewards"
indexingRewardAmount: BigInt!
"Total rewards accrued all time by indexers"
indexingIndexerRewardAmount: BigInt!
"Total rewards accrued all time by delegators"
indexingDelegatorRewardAmount: BigInt!
"Total query fees earned by this Subgraph Deployment, without curator query fees"
queryFeesAmount: BigInt!
"Total query fee rebates earned from the protocol, through the rebates formula. Does not include delegation fees"
queryFeeRebates: BigInt!
"Total curator rewards from fees"
curatorFeeRewards: BigInt!
# TODO - We can add a field here for delegation fees earned when calling claim()
# Subgraph deployment curation bonding curve
"CURRENT signalled tokens in the bonding curve"
signalledTokens: BigInt!
"NOT IMPLEMENTED - CURRENT signalled tokens in the bonding curve"
unsignalledTokens: BigInt! # Will be used for rewards
"CURRENT curation signal for this subgraph deployment"
signalAmount: BigInt!
"signalledTokens / signalAmount"
pricePerShare: BigDecimal!
"Curators of this subgraph deployment"
curatorSignals: [Signal!]! @derivedFrom(field: "subgraphDeployment")
"Bonding curve reserve ratio. In parts per million"
reserveRatio: Int!
# From Subgraph Manifest
# dataSources: [DataSource!]
"Entity that represents the manifest of the deployment. Filled by File Data Sources"
manifest: SubgraphDeploymentManifest
# Counters for currentSignalledTokens tracking on Subgraph
"Total amount of Subgraph entities that used this deployment at some point. subgraphCount >= activeSubgraphCount + deprecatedSubgraphCount"
subgraphCount: Int!
"Amount of active Subgraph entities that are currently using this deployment. Deprecated subgraph entities are not counted"
activeSubgraphCount: Int!
"Amount of Subgraph entities that were currently using this deployment when they got deprecated"
deprecatedSubgraphCount: Int!
"Whether the deployment has been transferred from L1 to L2. Subgraphs published on L2 will have this as false unless they were published through a transfer"
transferredToL2: Boolean!
"Timestamp for the L1 -> L2 Transfer. Null if it's not fully transferred or if it's an L1 deployment"
transferredToL2At: BigInt
"Block number for the L1 -> L2 Transfer. Null if it's not fully transferred or if it's an L1 deployment"
transferredToL2AtBlockNumber: BigInt
"Transaction hash for the L1 -> L2 Transfer. Null if it's not fully transferred or if it's an L1 deployment"
transferredToL2AtTx: String
"Amount of GRT transferred to L2"
signalledTokensSentToL2: BigInt!
"Amount of GRT received on L2"
signalledTokensReceivedOnL2: BigInt!
}
type SubgraphDeploymentSchema @entity(immutable:true) {
"IPFS Hash"
id: ID!
"Link to a SubgraphDeploymentManifest entity that references this schema. For backwards compatibility purposes only, for the full list of manifests use manifests"
manifest: SubgraphDeploymentManifest @derivedFrom(field:"schema")
"Links to SubgraphDeploymentManifest entities that reference this schema"
manifests: [SubgraphDeploymentManifest!]! @derivedFrom(field:"schema")
"Contents of the Schema file"
schema: String
}
type SubgraphDeploymentManifest @entity(immutable:true) {
"IPFS Hash"
id: ID!
"Link to SubgraphDeployment entity"
deployment: SubgraphDeployment @derivedFrom(field:"manifest")
"Schema entity"
schema: SubgraphDeploymentSchema
"Schema ipfs hash"
schemaIpfsHash: String
"Contents of the Manifest file"
manifest: String
"Network where the contracts that the subgraph indexes are located"
network: String
"Whether the subgraph is a SpS/SbS. Null if we can't parse it"
poweredBySubstreams: Boolean
"Start block for the deployment. It's the lowest startBlock found (0 if some data source doesn't contain a start block)"
startBlock: BigInt
}
# TODO - add when we have the ability to parse data sources
# """Data source obtained from the subgraph manifest"""
# type DataSource @entity {
# "Unique identifier of the data source. Such as contract address"
# id: ID!
# "Data source name in the manifest"
# name: String!
# "Networks that the subgraph deployment is indexing"
# networks: [String!]!
# "Contract"
# contract: Contract!
# "ABI of the contract"
# abi: String!
# }
# type Contract @entity {
# "Address of the contract"
# id: ID!
# "Contract name"
# name: String
# }
"""
Meta for the Indexer along with parameters and staking data
"""
type Indexer @entity {
"Eth address of Indexer"
id: ID!
"Time this indexer was created"
createdAt: Int!
"Graph account of this indexer"
account: GraphAccount!
"Service registry URL for the indexer"
url: String
"Geohash of the indexer. Shows where their indexer is located in the world"
geoHash: String
"Default display name is the current default name. Used for filtered queries"
defaultDisplayName: String
# Staking data
"CURRENT tokens staked in the protocol. Decreases on withdraw, not on lock"
stakedTokens: BigInt!
"CURRENT tokens allocated on all subgraphs"
allocatedTokens: BigInt!
"NOT IMPLEMENTED - Tokens that have been unstaked and withdrawn"
unstakedTokens: BigInt! # will be used for return % calcs
"CURRENT tokens locked"
lockedTokens: BigInt!
"The block when the Indexers tokens unlock"
tokensLockedUntil: Int!
"Active allocations of stake for this Indexer"
allocations: [Allocation!]! @derivedFrom(field: "activeForIndexer")
"All allocations of stake for this Indexer (i.e. closed and active)"
totalAllocations: [Allocation!]! @derivedFrom(field: "indexer")
"Number of active allocations of stake for this Indexer"
allocationCount: Int!
"All allocations for this Indexer (i.e. closed and active)"
totalAllocationCount: BigInt!
"Total query fees collected. Includes the portion given to delegators"
queryFeesCollected: BigInt!
"Query fee rebate amount claimed from the protocol through rebates mechanism. Does not include portion given to delegators"
queryFeeRebates: BigInt!
"Total indexing rewards earned by this indexer from inflation. Including delegation rewards"
rewardsEarned: BigInt!
"The total amount of indexing rewards the indexer kept"
indexerIndexingRewards: BigInt!
"The total amount of indexing rewards given to delegators"
delegatorIndexingRewards: BigInt!
"Percentage of indexers' own rewards received in relation to its own stake. 1 (100%) means that the indexer is receiving the exact amount that is generated by his own stake"
indexerRewardsOwnGenerationRatio: BigDecimal!
"Whether the indexer has been transferred from L1 to L2 partially or fully"
transferredToL2: Boolean!
"Timestamp for the FIRST L1 -> L2 Transfer"
firstTransferredToL2At: BigInt
"Block number for the FIRST L1 -> L2 Transfer"
firstTransferredToL2AtBlockNumber: BigInt
"Transaction hash for the FIRST L1 -> L2 Transfer"
firstTransferredToL2AtTx: String
"Timestamp for the latest L1 -> L2 Transfer"
lastTransferredToL2At: BigInt
"Block number for the latest L1 -> L2 Transfer"
lastTransferredToL2AtBlockNumber: BigInt
"Transaction hash for the latest L1 -> L2 Transfer"
lastTransferredToL2AtTx: String
"Amount of GRT transferred to L2. Only visible from L1, as there's no events for it on L2"
stakedTokensTransferredToL2: BigInt!
"ID of the indexer on L2. Null if it's not transferred"
idOnL2: String
"ID of the indexer on L1. Null if it's not transferred"
idOnL1: String
# Capacity Data
"Amount of delegated tokens that can be eligible for rewards"
delegatedCapacity: BigInt!
"Total token capacity = delegatedCapacity + stakedTokens"
tokenCapacity: BigInt!
"Stake available to earn rewards. tokenCapacity - allocationTokens - lockedTokens"
availableStake: BigInt!
# Delegation Pool
"Delegators to this Indexer"
delegators: [DelegatedStake!]! @derivedFrom(field: "indexer")
"CURRENT tokens delegated to the indexer"
delegatedTokens: BigInt!
"Ratio between the amount of the indexers own stake over the total usable stake."
ownStakeRatio: BigDecimal!
"Ratio between the amount of delegated stake over the total usable stake."
delegatedStakeRatio: BigDecimal!
"Total shares of the delegator pool"
delegatorShares: BigInt!
"Exchange rate of of tokens received for each share"
delegationExchangeRate: BigDecimal!
"The percent of indexing rewards generated by the total stake that the Indexer keeps for itself. In parts per million"
indexingRewardCut: Int!
"The percent of indexing rewards generated by the delegated stake that the Indexer keeps for itself"
indexingRewardEffectiveCut: BigDecimal!
"The percent of reward dilution delegators experience because of overdelegation. Overdelegated stake can't be used to generate rewards but still gets accounted while distributing the generated rewards. This causes dilution of the rewards for the rest of the pool."
overDelegationDilution: BigDecimal!
"The total amount of query fees given to delegators"
delegatorQueryFees: BigInt!
"The percent of query rebate rewards the Indexer keeps for itself. In parts per million"
queryFeeCut: Int!
"The percent of query rebate rewards generated by the delegated stake that the Indexer keeps for itself"
queryFeeEffectiveCut: BigDecimal!
"Amount of blocks a delegator chooses for the waiting period for changing their params"
delegatorParameterCooldown: Int!
"Block number for the last time the delegator updated their parameters"
lastDelegationParameterUpdate: Int!
"Count of how many times this indexer has been forced to close an allocation"
forcedClosures: Int!
# Metrics
"NOT IMPLEMENTED - Total return this indexer has earned"
totalReturn: BigDecimal!
"NOT IMPLEMENTED - Annualized rate of return for the indexer"
annualizedReturn: BigDecimal! # You must multiple by 100 to get percentage
"NOT IMPLEMENTED - Staking efficiency of the indexer"
stakingEfficiency: BigDecimal!
}
"""
A state channel Allocation representing a single Indexer-SubgraphDeployment stake
"""
type Allocation @entity {
"Channel Address"
id: ID!
"Indexer of this allocation"
indexer: Indexer!
"Creator of the allocation - can be the operator or the indexer"
creator: Bytes!
"If the Allocation is active it shows the indexer. If closed, it is null"
activeForIndexer: Indexer
"Subgraph deployment that is being allocated to"
subgraphDeployment: SubgraphDeployment!
"Tokens allocation in this allocation"
allocatedTokens: BigInt!
"[DEPRECATED] Effective allocation that is realized upon closing"
effectiveAllocation: BigInt!
"Epoch this allocation was created"
createdAtEpoch: Int!
"Block at which this allocation was created"
createdAtBlockHash: Bytes!
"Block number at which this allocation was created"
createdAtBlockNumber: Int!
"Epoch this allocation was closed in"
closedAtEpoch: Int
"Block hash at which this allocation was closed"
closedAtBlockHash: Bytes
"Block number at which this allocation was closed"
closedAtBlockNumber: Int
"Fees this allocation collected from query fees upon closing. Excludes curator reward and protocol tax"
queryFeesCollected: BigInt!
"Query fee rebate amount claimed from the protocol through rebates mechanism. Does not include portion given to delegators"
queryFeeRebates: BigInt!
"Query fee rebates collected from the protocol. Can differ from queryFeeRebates if multiple vouchers per allocation are allowed."
distributedRebates: BigInt!
"Curator rewards deposited to the curating bonding curve"
curatorRewards: BigInt!
"Indexing rewards earned by this allocation. Includes delegator and indexer rewards"
indexingRewards: BigInt!
"Indexing rewards earned by this allocation by indexers"
indexingIndexerRewards: BigInt!
"Indexing rewards earned by this allocation by delegators"
indexingDelegatorRewards: BigInt!
"[DEPRECATED] Pool in which this allocation was closed"
poolClosedIn: Pool
"Fees paid out to delegators"
delegationFees: BigInt!
"Status of the allocation"
status: AllocationStatus!
"Timestamp this allocation was created at"
createdAt: Int!
"Timestamp this allocation was closed at"
closedAt: Int
"POI submitted with a closed allocation"
poi: Bytes
# Indexer cut settings at start and close
indexingRewardCutAtStart: Int!
indexingRewardEffectiveCutAtStart: BigDecimal!
queryFeeCutAtStart: Int!
queryFeeEffectiveCutAtStart: BigDecimal!
indexingRewardCutAtClose: Int
indexingRewardEffectiveCutAtClose: BigDecimal
queryFeeCutAtClose: Int
queryFeeEffectiveCutAtClose: BigDecimal
# Metrics NOT IMPLEMENTED YET
"NOT IMPLEMENTED - Return for this allocation"
totalReturn: BigDecimal!
"NOT IMPLEMENTED - Yearly annualzied return"
annualizedReturn: BigDecimal!
}
enum AllocationStatus {
Null # == indexer == address(0)
Active # == not Null && tokens > 0 #
Closed # == Active && closedAtEpoch != 0. Still can collect, while you are waiting to be finalized. a.k.a settling
Finalized # == [DEPRECATED] Closing && closedAtEpoch + channelDisputeEpochs > now(). Note, the subgraph has no way to return this value. it is implied
Claimed # == [DEPRECATED] not Null && tokens == 0 - i.e. finalized, and all tokens withdrawn
}
"""
[DEPRECATED] Global pool of query fees for closed state channels. Each Epoch has a single pool,
hence why they share the same IDs.
"""
type Pool @entity {
"Epoch number of the pool"
id: ID!
"Total effective allocation tokens from all allocations closed in this epoch"
allocation: BigInt!
"Total query fees collected in this epoch"
totalQueryFees: BigInt!
"Total query fees claimed in this epoch. Can be smaller than totalFees because of rebates function "
claimedFees: BigInt!
"Total rewards from query fees deposited to all curator bonding curves during the epoch"
curatorRewards: BigInt!
"Allocations that were closed during this epoch"
closedAllocations: [Allocation!]! @derivedFrom(field: "poolClosedIn")
}
"""
Delegator with all their delegated stakes towards Indexers
"""
type Delegator @entity {
"Delegator address"
id: ID!
"Graph account of the delegator"
account: GraphAccount!
"Stakes of this delegator"
stakes: [DelegatedStake!]! @derivedFrom(field: "delegator")
"CUMULATIVE staked tokens in DelegatorStakes of this Delegator"
totalStakedTokens: BigInt!
"CUMULATIVE unstaked tokens in DelegatorStakes of this Delegator"
totalUnstakedTokens: BigInt!
"Time created at"
createdAt: Int!
"Total realized rewards on all delegated stakes. Realized rewards are added when undelegating and realizing a profit"
totalRealizedRewards: BigDecimal!
"Total DelegatedStake entity count (Active and inactive)"
stakesCount: Int!
"Active DelegatedStake entity count. Active means it still has GRT delegated"
activeStakesCount: Int!
"Default display name is the current default name. Used for filtered queries"
defaultDisplayName: String
}
"""
Delegator stake for a single Indexer
"""
type DelegatedStake @entity {
"Concatenation of Delegator address and Indexer address"
id: ID!
"Index the stake is delegated to"
indexer: Indexer!
"Delegator"
delegator: Delegator!
"CUMULATIVE tokens delegated"
stakedTokens: BigInt!
"CUMULATIVE tokens undelegated"
unstakedTokens: BigInt!
"CURRENT tokens locked"
lockedTokens: BigInt!
"Epoch the locked tokens get unlocked"
lockedUntil: Int!
"Shares owned in the delegator pool. Used to calculate total amount delegated"
shareAmount: BigInt!
"The rate this delegator paid for their shares (calculated using average cost basis). Used for rewards calculations"
personalExchangeRate: BigDecimal!
"Realized rewards from undelegating and realizing a reward"
realizedRewards: BigDecimal!
"Time this delegator first delegated to an indexer"
createdAt: Int!
"Last time this delegator delegated towards this indexer"
lastDelegatedAt: Int
"Last time this delegator undelegated from this indexer"
lastUndelegatedAt: Int
"Whether the delegation has been transferred from L1 to L2"
transferredToL2: Boolean!
"Timestamp for the L1 -> L2 Transfer"
transferredToL2At: BigInt
"Block number for the L1 -> L2 Transfer"
transferredToL2AtBlockNumber: BigInt
"Transaction hash for the L1 -> L2 Transfer"
transferredToL2AtTx: String
"Amount of GRT transferred to L2. Only visible from L1, as there's no events for it on L2"
stakedTokensTransferredToL2: BigInt!
"ID of the delegation on L2. Null if it's not transferred"
idOnL2: String
"ID of the delegation on L1. Null if it's not transferred"
idOnL1: String
}
"""
Curator with all Signals and metrics
"""
type Curator @entity {
"Eth address of the Curator"
id: ID!
"Time this curator was created"
createdAt: Int!
"Graph account of this curator"
account: GraphAccount!
"CUMULATIVE tokens signalled on all the subgraphs"
totalSignalledTokens: BigInt!
"CUMULATIVE tokens unsignalled on all the subgraphs"
totalUnsignalledTokens: BigInt!
"Subgraphs the curator is curating"
signals: [Signal!]! @derivedFrom(field: "curator")
"Default display name is the current default name. Used for filtered queries"
defaultDisplayName: String
"CUMULATIVE tokens signalled on all names"
totalNameSignalledTokens: BigInt!
"CUMULATIVE tokens unsignalled on all names"
totalNameUnsignalledTokens: BigInt!
"CUMULATIVE withdrawn tokens from deprecated subgraphs"
totalWithdrawnTokens: BigInt!
"Subgraphs the curator is curating"
nameSignals: [NameSignal!]! @derivedFrom(field: "curator")
# Metrics NOTE - will be hard to calculate these with the two types of signal
"NOT IMPLEMENTED - Summation of realized rewards from all Signals"
realizedRewards: BigInt!
"NOT IMPLEMENTED - Annualized rate of return on curator signal"
annualizedReturn: BigDecimal!
"NOT IMPLEMENTED - Total return of the curator"
totalReturn: BigDecimal!
"NOT IMPLEMENTED - Signaling efficiency of the curator"
signalingEfficiency: BigDecimal!
"CURRENT summed name signal for all bonding curves"
totalNameSignal: BigDecimal!
"Total curator cost basis of all shares of name pools purchased on all bonding curves"
totalNameSignalAverageCostBasis: BigDecimal!
"totalNameSignalAverageCostBasis / totalNameSignal"
totalAverageCostBasisPerNameSignal: BigDecimal!
"CURRENT summed signal for all bonding curves"
totalSignal: BigDecimal!
"Total curator cost basis of all version signal shares purchased on all bonding curves. Includes those purchased through GNS name pools"
totalSignalAverageCostBasis: BigDecimal!
"totalSignalAverageCostBasis / totalSignal"