-
Notifications
You must be signed in to change notification settings - Fork 4
/
schema.graphql
634 lines (595 loc) · 13.1 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
"""
A type that has ss58 address format of the account. As soon as the chain
encounters any new address, they get registered here as user/pool/market account.
"""
type Account @entity {
"Account address"
accountId: String!
"List of balances connected to the account"
balances: [AccountBalance]! @derivedFrom(field: "account")
"Unique identifier of the object"
id: ID!
"Zeitgeist's identifier for market. Valid only for market account."
marketId: Int
}
"""
Balance of a particular asset denoted by assetId present in the account
"""
type AccountBalance @entity {
"Connected account"
account: Account!
"Zeitgeist's identifier for asset"
assetId: String!
"Balance of the asset"
balance: BigInt!
"Unique identifier of the object"
id: ID!
}
"""
Balance history of a particular asset in an account. Records all transactions
associated with the account.
"""
type HistoricalAccountBalance @entity {
"Account address"
accountId: String! @index
"Zeitgeist's identifier for asset"
assetId: String!
"Height of the block"
blockNumber: Int!
"Balance difference"
dBalance: BigInt!
"Event method which initiated this change"
event: String!
"Extrinsic responsible for this change"
extrinsic: Extrinsic
"Unique identifier of the object"
id: ID!
"Timestamp of the block"
timestamp: DateTime!
}
"""
A type that has detail of the outcome asset. It is initialised as soon as the
market is created and price is assigned when pool is deployed for the market.
"""
type Asset @entity {
"Balance of the asset present in the pool account"
amountInPool: BigInt!
"Zeitgeist's identifier for asset"
assetId: String!
"Color identifier"
color: String
"Image identifier"
img: String
"Connected market"
market: Market!
"Title ex. `Locomotiv will not be defeated`"
name: String
"Connected pool"
pool: Pool
"Spot price of the asset in the pool"
price: Float!
"Short abbreviation ex. `LMDRAW`"
ticker: String
}
"""
A type that records the price history of an outcome asset.
"""
type HistoricalAsset @entity {
"Unique identifier of the object"
id: ID!
"Account which executed the trade"
accountId: String @index
"Zeitgeist's identifier for asset"
assetId: String! @index
"Price of the asset has decreased if -ve and +ve if increased"
dPrice: Float
"Units of asset user bought (-ve) or sold (+ve)"
dAmountInPool: BigInt
"Price of the asset after trade execution/market resolution"
newPrice: Float
"Units of asset present in the pool account"
newAmountInPool: BigInt
"Event method which initiated this change"
event: String!
"Height of the block"
blockNumber: Int!
"Timestamp of the block"
timestamp: DateTime!
}
"""
A type that records the trade history of an account.
"""
type HistoricalSwap @entity {
"Unique identifier of the object"
id: ID!
"Account which executed the trade"
accountId: String! @index
"Asset sold by the user"
assetIn: String!
"Asset bought by the user"
assetOut: String!
"Units of asset user sold"
assetAmountIn: BigInt!
"Units of asset user bought"
assetAmountOut: BigInt!
"Event method which initiated this swap"
event: String!
"External fees occuring out of trade"
externalFeeAmount: BigInt
"Extrinsic responsible for this change"
extrinsic: Extrinsic
"Height of the block"
blockNumber: Int!
"Swap fees"
swapFeeAmount: BigInt
"Timestamp of the block"
timestamp: DateTime!
}
"""
A type that records the order history of a market.
"""
type Order @entity {
createdAt: DateTime!
id: ID!
makerAccountId: String! @index
maker: OrderRecord!
marketId: Int! @index
status: OrderStatus!
taker: OrderRecord!
updatedAt: DateTime!
}
"""
A type that records the history of an order.
"""
type HistoricalOrder @entity {
accountId: String! @index
assetIn: String!
assetOut: String!
assetAmountIn: BigInt!
assetAmountOut: BigInt!
blockNumber: Int!
event: OrderEvent!
externalFeeAmount: BigInt
extrinsic: Extrinsic
orderId: Int! @index
timestamp: DateTime!
}
"""
Prediction market details
"""
type Market @entity {
"Address responsible for authorizing disputes. Null if Adv Comm is the authority"
authorizedAddress: String
"List of assets connected to the market"
assets: [Asset!]! @derivedFrom(field: "market")
"The base asset in the market swap pool (usually a currency)"
baseAsset: String!
"Tracks the status of the advisory, oracle and validity bonds"
bonds: MarketBonds
"Name of all categories glued together"
categoryNames: String
"Share details"
categories: [CategoryMetadata!]
"Can be `Permissionless` or `Advised`"
creation: MarketCreation!
"Account address of the market creator"
creator: String!
"The creator's fee"
creatorFee: Int
"Deadlines for the market represented in blocks"
deadlines: MarketDeadlines
"Description of the market"
description: String
"The dispute information for each dispute that's been issued"
disputes: [MarketReport]
"Can be `Authorized`/`Court`/`SimpleDisputes` or undefined"
disputeMechanism: DisputeMechanism
"`True` if early closure is scheduled"
earlyClose: Boolean!
"Checks if each category has a name for display on UI"
hasValidMetaCategories: Boolean!
"Image for the market"
img: String
"Liquidity on the market's pool"
liquidity: BigInt!
"Zeitgeist's identifier for market"
marketId: Int! @index
"Type of the market"
marketType: MarketType!
"IPFS cid for market metadata"
metadata: String!
"Account designated to report on the market"
oracle: String!
"Share identifiers"
outcomeAssets: [String!]!
"Time period expressed in block numbers or timestamps"
period: MarketPeriod!
"Market's liquidity pool details"
pool: Pool
"Market's amm2 pool details"
neoPool: NeoPool
"Reasoning for market rejection"
rejectReason: String
"Reported outcome of the market. Null if the market is not reported yet"
report: MarketReport
"Resolved outcome for the market"
resolvedOutcome: String
"Type of scalar range if market is of type scalar"
scalarType: String
"Scoring rule used for the market"
scoringRule: ScoringRule!
"Short name for the market"
slug: String
"Status of the market"
status: MarketStatus!
"Market tags"
tags: [String]
"Total amount of base-asset that has moved through a market's liquidity pool"
volume: BigInt!
"Market question"
question: String
}
"""
Market history of a particular market. Records all transactions
associated with the market.
"""
type HistoricalMarket @entity {
"Height of the block"
blockNumber: Int!
"The account that reported or disputed"
by: String
"Change in market liquidity"
dLiquidity: BigInt!
"Change in market volume"
dVolume: BigInt!
"Event method which initiated this change"
event: MarketEvent!
"New updated liquidity"
liquidity: BigInt!
"Details of the connected market"
market: Market!
"Reported or disputed outcome for the market"
outcome: OutcomeReport
"Latest resolved outcome"
resolvedOutcome: String
"Latest market status"
status: MarketStatus!
"Timestamp of the block"
timestamp: DateTime!
"New updated volume"
volume: BigInt!
}
"""
Liquidity pool details
"""
type Pool @entity {
"Account for the pool"
account: Account!
"List of assets connected to the pool"
assets: [Asset!]! @derivedFrom(field: "pool")
"The base asset in the market swap pool (usually a currency)"
baseAsset: String!
"Timestamp of pool creation"
createdAt: DateTime!
"Zeitgeist's identifier for market connected to the pool"
marketId: Int! @index
"Zeitgeist's identifier for pool"
poolId: Int! @index
"Status of the pool"
status: PoolStatus!
"Fee applied to each swap"
swapFee: String
"Subsidy gathered for the market"
totalSubsidy: String
"Sum of `weights`"
totalWeight: String!
"List of lengths for each asset"
weights: [Weight!]!
}
"""
AMM2 pool details
"""
type NeoPool @entity {
account: Account!
collateral: String!
createdAt: DateTime!
liquidityParameter: BigInt!
liquiditySharesManager: [LiquiditySharesManager!]! @derivedFrom(field: "neoPool")
marketId: Int! @index
poolId: Int! @index
swapFee: BigInt!
totalStake: BigInt!
}
type LiquiditySharesManager @entity {
account: String! @index
fees: BigInt!
neoPool: NeoPool!
stake: BigInt!
}
"""
Liquidity history of a particular pool. Records all transactions
associated with the pool.
"""
type HistoricalPool @entity {
"Height of the block"
blockNumber: Int!
"Event method which initiated this change"
event: String!
"Zeitgeist's identifier for pool"
poolId: Int!
"Current status of the pool"
status: PoolStatus
"Timestamp of the block"
timestamp: DateTime!
}
"""
Court details
"""
type Court @entity {
marketId: Int! @index
roundEnds: RoundEndsInfo!
status: CourtStatus!
voteItemType: VoteItemType!
}
"""
History of a particular court capturing its lifecyle and juror participation.
"""
type HistoricalCourt @entity {
accountId: String @index
blockNumber: Int!
courtId: Int! @index
event: CourtEvent!
timestamp: DateTime!
}
"""
Extrinsic data
"""
type Extrinsic @jsonField {
"Extrinsic hash"
hash: String!
"Name of the extrinsic"
name: String
}
"""
Asset weightage details
"""
type Weight @jsonField {
"Zeitgeist's identifier for asset"
assetId: String!
"Weight of the asset"
weight: BigInt!
}
"""
Amount reserved for creation of markets, selecting oracles, joining the council,
making treasury proposals, setting on-chain identities, voting,
creating DAOs, and other parts of the protocol.
"""
type MarketBonds @jsonField {
"Bond associated with creation of markets"
creation: MarketBond!
"Bond reserved by the disputant"
dispute: MarketBond
"Bond associated with oracle selection"
oracle: MarketBond!
"A bond for an outcome reporter, who is not the oracle"
outsider: MarketBond
}
"""
Market's bond details
"""
type MarketBond @jsonField {
"The flag which determines if the bond was already unreserved and/or (partially) slashed"
isSettled: Boolean!
"Amount reserved"
value: BigInt!
"The account that reserved the bond"
who: String!
}
"""
Market's share details
"""
type CategoryMetadata @jsonField {
"Title ex. `Locomotiv will not be defeated`"
name: String
"Short abbreviation ex. `LMDRAW`"
ticker: String
"Image identifier"
img: String
"Color identifier"
color: String
}
"""
Deadlines for the market represented in blocks
"""
type MarketDeadlines @jsonField {
gracePeriod: BigInt!
oracleDuration: BigInt!
disputeDuration: BigInt!
}
"""
Market's types
"""
type MarketType @jsonField {
"Number of categories if categorical market"
categorical: String
"Range of values if scalar market"
scalar: [String]
}
"""
Time period of the market
"""
type MarketPeriod @jsonField {
"start & end block numbers"
block: [BigInt]
"Timestamp at which market should end"
end: BigInt!
"Timestamp at which market should start"
start: BigInt!
"start & end timestamps"
timestamp: [BigInt]
}
"""
Market's report details
"""
type MarketReport @jsonField {
"Block number"
at: Int
"Account which reported"
by: String
"Outcome details"
outcome: OutcomeReport
}
"""
Market's outcome details
"""
type OutcomeReport @jsonField {
"Index of the categories. Null if market is scalar"
categorical: Int
"Resultant value from the scalar range. Null if market is categorical"
scalar: BigInt
}
type OrderRecord @jsonField {
asset: String!
filledAmount: BigInt!
unfilledAmount: BigInt!
}
type RoundEndsInfo @jsonField {
preVote: BigInt
vote: BigInt
aggregation: BigInt
appeal: BigInt
}
"""
Courts' event options
"""
enum CourtEvent {
CourtOpened
JurorRevealedVote
JurorVoted
StakesReassigned
}
"""
Courts' status options
"""
enum CourtStatus {
Closed
Open
Reassigned
}
"""
Markets' dispute options
"""
enum DisputeMechanism {
Authorized
Court
SimpleDisputes
}
"""
Markets' creation options
"""
enum MarketCreation {
Advised
Permissionless
}
"""
Markets' event options
"""
enum MarketEvent {
ArbitrageBuyBurn
ArbritrageMintSell
BuyExecuted
ExitExecuted
GlobalDisputeStarted
JoinExecuted
MarketApproved
MarketClosed
MarketCreated
MarketDestroyed
MarketDisputed
MarketEarlyCloseScheduled
MarketExpired
MarketInsufficientSubsidy
MarketRejected
MarketReported
MarketResolved
MarketStartedWithSubsidy
OutcomeBought
PoolDeployed
PoolDestroyed
PoolExit
PoolJoin
SellExecuted
SwapExactAmountIn
SwapExactAmountOut
}
"""
Markets' status options
"""
enum MarketStatus {
Active
Closed
CollectingSubsidy
Destroyed
Disputed
Expired
InsufficientSubsidy
Proposed
Rejected
Reported
Resolved
Suspended
}
"""
Orders' event options
"""
enum OrderEvent {
OrderFilled
}
"""
Orders' status options
"""
enum OrderStatus {
Filled
Placed
Removed
}
"""
Pools' status options
"""
enum PoolStatus {
Active
Clean
Closed
CollectingSubsidy
Destroyed
Initialized
}
"""
Markets' scoring rule options
"""
enum ScoringRule {
AmmCdaHybrid
CPMM
Lmsr
Orderbook
Parimutuel
RikiddoSigmoidFeeMarketEma
}
"""
Swaps' event options
"""
enum SwapEvent {
BuyExecuted
OrderFilled
OutcomeBought
SellExecuted
SwapExactAmountIn
SwapExactAmountOut
}
"""
Types of vote items
"""
enum VoteItemType {
Binary
Outcome
}