-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.graphql
343 lines (265 loc) · 5.76 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
enum AccountType {
USER
VESTING
}
type Account @entity {
id: ID!
type: AccountType!
balance: BigInt!
owner: Account
owned: [Account!]! @derivedFrom(field: "owner")
transfers: [AccountTransfer!] @derivedFrom(field: "account")
transfersTo: [Transfer!] @derivedFrom(field: "to")
transfersFrom: [Transfer!] @derivedFrom(field: "from")
workers: [Worker!] @derivedFrom(field: "realOwner")
workers2: [Worker!] @derivedFrom(field: "owner")
delegations: [Delegation!] @derivedFrom(field: "realOwner")
delegations2: [Delegation!] @derivedFrom(field: "owner")
claimableDelegationCount: Int!
claims: [Claim!] @derivedFrom(field: "account")
gatewayOperator: GatewayOperator @derivedFrom(field: "account")
gateways: [Gateway!] @derivedFrom(field: "owner")
gatewayStakes: [GatewayStake!] @derivedFrom(field: "owner")
}
enum TransferDirection {
FROM
TO
}
type AccountTransfer @entity {
id: ID!
direction: TransferDirection!
account: Account!
transfer: Transfer!
}
type Transfer @entity {
id: ID!
blockNumber: Int!
timestamp: DateTime! @index
from: Account!
to: Account!
amount: BigInt!
}
type Settings @entity {
id: ID!
bondAmount: BigInt
delegationLimitCoefficient: Float!
epochLength: Int
minimalWorkerVersion: String
recommendedWorkerVersion: String
}
enum ClaimType {
WORKER
DELEGATION
}
type Claim @entity {
id: ID!
blockNumber: Int!
timestamp: DateTime! @index
type: ClaimType!
worker: Worker
delegation: Delegation
"worker.realOwner or delegation.realOwner"
account: Account!
amount: BigInt!
}
type Commitment @entity {
id: ID!
from: DateTime!
fromBlock: Int!
to: DateTime!
toBlock: Int!
recipients: [CommitmentRecipient!]!
}
type CommitmentRecipient {
workerId: ID!
workerReward: BigInt!
workerApr: Float!
stakerReward: BigInt!
stakerApr: Float!
}
type Block @entity {
id: ID!
hash: String!
height: Int! @index
timestamp: DateTime! @index
l1BlockNumber: Int! @index
}
enum WorkerStatus {
REGISTERING
ACTIVE
DEREGISTERING
DEREGISTERED
WITHDRAWN
UNKNOWN
}
type WorkerDayUptime {
timestamp: DateTime!
uptime: Float!
}
type Worker
@entity
@index(fields: ["id", "createdAt", "status"])
@index(fields: ["id", "realOwner"]) {
id: ID!
peerId: String! @index
owner: Account!
"owner.owner for VESTING account"
realOwner: Account!
bond: BigInt!
createdAt: DateTime!
locked: Boolean
lockStart: Int
lockEnd: Int
name: String
website: String
email: String
description: String
status: WorkerStatus!
statusHistory: [WorkerStatusChange!]! @derivedFrom(field: "worker")
claimableReward: BigInt!
rewards: [WorkerReward!] @derivedFrom(field: "worker")
claimedReward: BigInt!
claims: [Claim!] @derivedFrom(field: "worker")
apr: Float
stakerApr: Float
totalDelegation: BigInt!
capedDelegation: BigInt!
delegationCount: Int!
delegations: [Delegation!] @derivedFrom(field: "worker")
totalDelegationRewards: BigInt!
# network metrics
online: Boolean @index
dialOk: Boolean
jailed: Boolean
jailReason: String
version: String
storedData: BigInt
queries24Hours: BigInt
queries90Days: BigInt
servedData24Hours: BigInt
servedData90Days: BigInt
scannedData24Hours: BigInt
scannedData90Days: BigInt
uptime24Hours: Float
uptime90Days: Float
trafficWeight: Float
liveness: Float
dTenure: Float
dayUptimes: [WorkerDayUptime!]
snapshots: [WorkerSnapshot!] @derivedFrom(field: "worker")
}
type WorkerStatusChange @entity {
worker: Worker!
status: WorkerStatus!
timestamp: DateTime
blockNumber: Int!
pending: Boolean!
}
type WorkerReward @entity {
id: ID!
blockNumber: Int!
timestamp: DateTime! @index
worker: Worker!
amount: BigInt!
stakersReward: BigInt!
}
type WorkerSnapshot @entity {
id: ID!
worker: Worker!
timestamp: DateTime!
uptime: Float!
epoch: Epoch!
}
type Delegation @entity @index(fields: ["id", "realOwner"]) {
id: ID!
owner: Account!
"owner.owner for VESTING account"
realOwner: Account!
worker: Worker!
deposit: BigInt!
locked: Boolean
lockStart: Int
lockEnd: Int
claimableReward: BigInt!
rewards: [DelegationReward!] @derivedFrom(field: "delegation")
claimedReward: BigInt!
claims: [Claim!] @derivedFrom(field: "delegation")
}
type DelegationReward @entity {
id: ID!
blockNumber: Int!
timestamp: DateTime! @index
delegation: Delegation!
amount: BigInt!
}
enum GatewayStatus {
REGISTERED
DEREGISTERED
UNKNOWN
}
type Gateway @entity {
id: ID!
createdAt: DateTime!
operator: GatewayOperator
owner: Account
status: GatewayStatus!
statusHistory: [GatewayStatusChange!]! @derivedFrom(field: "gateway")
name: String
website: String
email: String
description: String
endpointUrl: String
}
type GatewayStatusChange @entity {
gateway: Gateway!
status: GatewayStatus!
timestamp: DateTime
blockNumber: Int!
}
type GatewayStake @entity {
id: ID!
index: Int!
operator: GatewayOperator!
owner: Account!
amount: BigInt!
computationUnits: BigInt!
locked: Boolean!
lockStart: Int!
lockEnd: Int!
}
type GatewayOperator @entity {
id: ID!
account: Account! @unique
autoExtension: Boolean!
gateways: [Gateway!]! @derivedFrom(field: "operator")
stake: GatewayStake
pendingStake: GatewayStake
}
type Statistics @entity {
id: ID!
currentEpoch: Int
lastSnapshotTimestamp: DateTime!
blockTime: Int!
lastBlock: Int!
lastBlockTimestamp: DateTime!
blockTimeL1: Int!
lastBlockL1: Int!
lastBlockTimestampL1: DateTime!
utilizedStake: BigInt!
baseApr: Float!
}
enum EpochStatus {
PLANNED
STARTED
ENDED
}
type Epoch @entity {
id: ID!
number: Int!
start: Int!
startedAt: DateTime
end: Int!
endedAt: DateTime
status: EpochStatus!
activeWorkerIds: [String!]
}