-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.graphql
232 lines (212 loc) · 7.79 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
type GraphNetwork @entity {
"ID is set to 1"
id: ID!
# Staking global aggregate values
"The total amount of GRT staked in the staking contract"
totalTokensStaked: BigInt
"Total delegated tokens in the protocol. totalDelegatedTokens in the original subgraph"
totalTokensDelegated: BigInt
# Curation global aggregate values
"The total amount of GRT signalled in the Curation contract"
totalTokensSignalled: BigInt
"NOT IMPLEMENTED - Total GRT currently curating via the Auto-Migrate function"
totalTokensSignalledAutoMigrate: BigDecimal
"NOT IMPLEMENTED - Total GRT currently curating to a specific version"
totalTokensSignalledDirectly: BigDecimal
# Graph Token global variables
"Graph Token supply"
totalSupply: BigInt
# Graph Token mint burn totals
"Total amount of GRT minted"
totalGRTMinted: BigInt
"Total amount of GRT burned"
totalGRTBurned: BigInt
"True if the protocol is paused"
isPaused: Boolean!
"True if the protocol is partially paused"
isPartialPaused: Boolean!
}
type GraphAccount @entity {
"Graph account ID"
id: ID!
# GRT info
"Graph token balance"
balance: BigInt
# Staking and Curating and Delegating
"Indexer fields for this GraphAccount. Null if never indexed"
indexer: Indexer
"Delegator fields for this GraphAccount. Null if never delegated"
delegator: Delegator
"Curator fields for this GraphAccount. Null if never delegated"
curator: Curator
}
type Indexer @entity {
"Eth address of Indexer"
id: ID!
"Graph account of this indexer"
account: GraphAccount
# Staking data
"CURRENT tokens staked in the protocol. Decreases on withdraw rather than on lock"
stakedTokens: BigInt
# Delegation Pool
"Delegators to this Indexer"
delegators: [DelegatedStake!]! @derivedFrom(field: "indexer")
"CURRENT tokens delegated to the indexer"
delegatedTokens: BigInt
}
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
}
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
}
type Curator @entity {
"Curator address"
id: ID!
"Graph account of the curator"
account: GraphAccount
"CUMULATIVE tokens signalled on all the subgraphs"
totalSignalledTokens: BigInt
"CUMULATIVE tokens unsignalled on all the subgraphs"
totalUnsignalledTokens: BigInt
"CUMULATIVE tokens signalled on all names"
totalNameSignalledTokens: BigInt
"CUMULATIVE tokens unsignalled on all names"
totalNameUnsignalledTokens: BigInt
}
type SubgrapDeployment @entity {
"Subgraph Deployment ID. The IPFS hash with Qm removed to fit into 32 bytes"
id: ID!
"CURRENT total stake of all indexers on this Subgraph Deployment"
stakedTokens: BigInt!
"Allocations created by indexers for this Subgraph"
indexerAllocations: [Allocation!]! @derivedFrom(field: "subgraphDeployment")
"CURRENT signalled tokens in the bonding curve"
signalledTokens: BigInt!
"CURRENT curation signal for this subgraph deployment"
signalAmount: BigInt!
"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 cobbs douglas formula. Does not include delegation fees"
queryFeeRebates: BigInt!
"Total curator rewards from fees"
curatorFeeRewards: BigInt!
}
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!
"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 cobbs douglas. Does not include portion given to delegators"
queryFeeRebates: 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!
"Status of the allocation"
status: AllocationStatus!
"Timestamp this allocation was created at, human readable, not epoch unlike the original subgraph"
createdAt: Int!
"Timestamp this allocation was closed at, human readable, not epoch unlike the original subgraph"
closedAt: Int
"POI submitted with a closed allocation"
poi: Bytes
}
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 # == Closing && closedAtEpoch + channelDisputeEpochs > now(). Note, the subgraph has no way to return this value. it is implied
Claimed # == not Null && tokens == 0 - i.e. finalized, and all tokens withdrawn
}
"""
Epoch aggregate data for network statistics on signaling, rewards, and query fees
"""
type Epoch @entity {
"Epoch number"
id: ID!
"Start block of the epoch"
startBlock: Int!
"End block of the epoch"
endBlock: Int!
"Signaled tokens during this epoch"
signalledTokens: BigInt!
"Stake deposited during this epoch"
stakeDeposited: BigInt!
"Rebate amount claimed from the protocol through cobbs douglas during this epoch (Doesn't correlate to the queryFeesCollected for this epoch since there's a 7 day period before claiming)"
queryFeeRebates: BigInt!
"Total indexing rewards earned in this epoch. Includes both delegator and indexer rewards"
totalRewards: BigInt!
"Total indexing rewards earned in this epoch by indexers"
totalIndexerRewards: BigInt!
"Total indexing rewards earned in this epoch by delegators"
totalDelegatorRewards: BigInt!
}
type Subgraph @entity {
"Subgraph ID - which is derived from the Organization/Individual graph accountID"
id: ID!
"List of all the subgraph versions included the current one"
versions: [SubgraphVersion!]! @derivedFrom(field: "subgraph")
"Version counter"
versionCount: BigInt!
}
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!
}