-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathschema.graphql
372 lines (348 loc) · 11.2 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
enum ItemStatus {
"The item could be included, but may have been removed or not held by enough stake."
Included
"The item is currently ongoing a dispute."
Disputed
"The item has been excluded after a successful challenge."
Excluded
}
enum DisputeStatus {
"The dispute is still ongoing."
Ongoing
"The dispute has been resolved."
Resolved
}
enum Ruling {
"The submitter side won the dispute and item stays"
Keep
"The challenger side won the dispute and item is removed"
Remove
}
type GeneralCounter @entity {
"The id is always the string '0'"
id: ID!
"Counts how many lists exist"
listCount: BigInt!
"Counts how many accounts exist"
accountCount: BigInt!
"Counts how many arbitration settings exist"
arbitrationSettingCount: BigInt!
"How much time must elapse from request to withdraw a stake"
withdrawalPeriod: BigInt!
"The window of time a challenger has to reference a previous edition"
challengeWindow: BigInt!
"Address able to change some parameters in the contract"
governor: Bytes!
}
# Mainly to prevent subgraph from using contract.bind
# For advanced users, it could be useful in the frontend
type ItemSlot @entity {
"<slotId>"
id: ID!
"The item this slot contains"
item: Item! # entity is created iff filled. so, non-nullable.
}
type Account @entity {
"<accountId>"
id: ID!
"Identifies the account in the contract"
accountId: BigInt!
"The address owning the account"
owner: Bytes!
"Total stake owned by this account (uncompressed)"
fullStake: BigInt!
"Stake available, supports all items equal or under (uncompressed)"
freeStake: BigInt!
"Stake locked due to ongoing disputes (uncompressed)"
lockedStake: BigInt!
"Currently in withdrawal process"
withdrawing: Boolean!
"Timestamp in which withdrawing process has started"
withdrawingTimestamp: BigInt!
"Items owned by this account"
items: [Item!]! @derivedFrom(field: "account")
"Editions authored by this account"
editions: [Edition!]! @derivedFrom(field: "author")
}
type List @entity {
"<listId>"
id: ID!
"Identifies the list in the contract"
listId: BigInt!
"Items contained in this list"
items: [Item!]! @derivedFrom(field: "list")
"How many items have ever been submitted to this list"
itemCount: BigInt!
"How many versions this list has had"
versionCount: BigInt!
"The different versions from this list"
versions: [ListVersion!]! @derivedFrom(field: "list")
"Current version of this list"
currentVersion: ListVersion!
}
type ListVersion @entity(immutable: true) {
"<listVersionId>@<listId>"
id: ID!
"The list this version belongs to"
list: List!
"The incremental id given to this version"
versionId: BigInt!
"Moment in which this version was created"
timestamp: BigInt!
"Account pointing to the governor"
governor: Account!
"Required stake for item inclusion in this list (uncompressed)"
requiredStake: BigInt!
"Removal period for items in this list, in seconds"
removalPeriod: BigInt!
"Upgrade period, during which obsoletion is not an adoption condition (to allow owners to update)"
upgradePeriod: BigInt!
"Whether all items can be freely adopted without most restrictions"
freeAdoptions: Boolean!
"Ratio that the challenger places as stake, each increment corresponds to a 1/16 itemStake"
challengerStakeRatio: Int!
"Arbitration setting for this list"
arbitrationSetting: ArbitrationSetting!
"MetaEvidence for this version"
metaList: MetaList!
}
type ArbitrationSetting @entity(immutable: true) {
"<arbitrationSettingId>"
id: ID!
"Identifies the arbitrationSetting in the contract"
arbitrationSettingId: BigInt!
"Address of the arbitrator"
arbitrator: Bytes!
"Bytes that form the arbitratorExtraData"
arbitratorExtraData: Bytes!
}
type Item @entity {
"<localId>@<listId>"
id: ID!
"The incremental id this item holds within its list"
localId: BigInt!
"Item slot in which the item resides"
itemSlot: BigInt!
"Blocknumber in which the item was submitted"
submissionBlock: BigInt!
"Status of the item"
status: ItemStatus!
"Last time the item was committed"
commitTimestamp: BigInt!
"Whether if the item is currently being removed. It might have been removed already"
removing: Boolean!
"Timestamp at which the removal is initiated"
removalTimestamp: BigInt!
"The account that owns the item"
account: Account!
"The List in which the item was submitted"
list: List!
"How many editions does this item have"
editionCount: BigInt!
"All the editions from this item"
editions: [Edition!]! @derivedFrom(field: "item")
"Current edition of this item. Might be unneeded"
currentEdition: Edition!
"How many disputes there have been for this item"
disputeCount: BigInt!
"All the disputes concerning this item"
disputes: [Dispute!]! @derivedFrom(field: "item")
"Current dispute on this item. Might be uneeded, can be null"
currentDispute: Dispute
"Thread containing the evidence related to this item"
thread: EvidenceThread!
}
type Edition @entity(immutable: true) {
"<localId>@<itemId>"
id: ID!
"The incremental id this edition holds within its item"
localId: BigInt!
"Item the edition belongs to"
item: Item!
"Account authoring this edition"
author: Account!
"Ipfs uri containing the off-chain data for the edition"
ipfsUri: String!
"Props contained in this edition"
props: [Prop!]! @derivedFrom(field: "edition")
"On-chain arbitrary data"
harddata: Bytes
"Whether if this edition is malformatted"
isMalformatted: Boolean!
"Whether if this edition is missing a required prop"
missingRequired: Boolean!
"Whether if this edition contains an unsolicited prop"
hasIntrusion: Boolean!
"When this edition was created"
timestamp: BigInt!
"Block at which this edition was created (used to call out frontrunning)"
blockNumber: BigInt!
"List version when this edition was created (historical)"
listVersion: ListVersion!
}
type Dispute @entity {
"<localId>@<itemId>"
id: ID!
"How many disputes had been made for this item at dispute creation"
localId: BigInt!
"Slot in which the dispute lives"
disputeSlot: BigInt!
"Identifier the arbitrator uses for disputes"
arbitratorDisputeId: BigInt!
"Status of the dispute"
status: DisputeStatus!
"Ruling of the dispute. Null when pending"
ruling: Ruling
"Item whose inclusion is being disputed"
item: Item!
# This is an address because the challenger account is not emitted.
# It doesn't matter since StakeCurate only acts on the address of the account.
"Address of the challenger, who will be rewarded if winning"
challenger: Bytes!
"Timestamp of the edition that is being targeted"
editionTimestamp: BigInt!
"Edition that is referenced through the timestamp, and is the focus of the Dispute"
referencedEdition: Edition!
"Reasoning behind the challenge"
reason: Evidence!
"List version at dispute creation"
listVersion: ListVersion!
"Amount rewarded to challenger upon successful challenge (uncompressed)"
itemStake: BigInt!
"Amount rewarded to the winning side of the dispute"
challengerStake: BigInt!
"Moment in which this dispute was created"
creationTimestamp: BigInt!
"Moment in which this dispute was resolved"
resolutionTimestamp: BigInt
"MetaEvidence linked to this Dispute"
metaEvidence: MetaEvidence!
}
# Get the Dispute belonging to a certain disputeId and arbitrator pair
type DisputeCheckpoint @entity(immutable: true) {
"<disputeId>@<arbitrator>"
id: ID!
"Dispute referenced by this checkpoint"
dispute: Dispute!
}
type MetaList @entity(immutable: true) {
"<versionId>@<listId>"
id: ID!
"The version this MetaList belongs to"
version: ListVersion!
"The incremental id given to this MetaList"
versionId: BigInt!
"The raw MetaList IPFS URI"
ipfsUri: String!
"Whether if the MetaList is malformatted, or file wasn't fetched"
isMalformatted: Boolean!
### From this point on, these fields may be missing or malformatted.
"Uri pointing to the policy document"
policyUri: String
"Columns of this MetaList"
columns: [Column!]! @derivedFrom(field: "metaList")
"How many columns are required"
requiredCount: Int
"Recommended age for considering an item inclusion canonical for queries"
defaultAgeForInclusion: BigInt!
"After a challenge, optional period of time with no challenges to allow owner to edit."
challengeCooldown: BigInt!
"Displayed name for this list"
listTitle: String
"Displayed description for this list"
listDescription: String
"Name that will be used to display one item"
itemName: String
"Name that will be used to display many items"
itemNamePlural: String
"Displayed picture for this list"
logoUri: String
"Whether if this list contains other lists"
isListOfLists: Boolean
"Whether if this list supports harddata"
hasHarddata: Boolean
"Short description of what the harddata contains"
harddataDescription: String
# maybe there should be a field to decode the harddata.
# but probably not, as more applications use harddata, they will
# likely use arbitrary encodings that don't map to sol types
}
type Column @entity(immutable: true) {
"<label>@<metaListId>"
id: ID!
"MetaList that holds this column"
metaList: MetaList!
"Type of this column"
type: String!
"Label of this column"
label: String!
"Description of this column"
description: String!
"Whether if giving a prop for this column is mandatory"
required: Boolean!
"Unknown usage"
isIdentifier: Boolean!
}
type Prop @entity(immutable: true) {
"<label>@<editionId>"
id: ID!
"Edition that holds this props"
edition: Edition!
"Label of this prop"
label: String!
"Value of this prop"
value: String
"Was required, but its value is null"
missing: Boolean!
"There is no column for its linked metalist"
intrusive: Boolean!
}
type EvidenceThread @entity {
"<evidenceGroupId>"
id: ID!
"Evidence group id generated from itemSlot and blockNumber"
evidenceGroupId: BigInt!
"Item this evidence thread points to"
item: Item!
"Counts how many evidence has been posted on this thread"
evidenceCount: BigInt!
"List of evidences posted on this thread"
evidences: [Evidence!]! @derivedFrom(field: "thread")
}
type Evidence @entity(immutable: true) {
"<localId>@<evidenceGroupId>, except reason, which uses <disputeId>"
id: ID!
"Incremental id for its thread"
localId: BigInt!
"Thread this evidence points to"
thread: EvidenceThread!
"Raw ipfs uri of the json of this evidence"
rawUri: String!
"The address that has submitted the Evidence"
party: Bytes!
"Adress of the arbitrator the evidence is submitted to"
arbitrator: Bytes!
"Whether if the evidence is malformatted"
isMalformatted: Boolean!
"Whether if this is a challenge reason"
isReason: Boolean!
# You cannot point to the historical edition or listVersion
# because you don't know if this evidence is being submitted
# for an ongoing dispute that was on a previous version.
# From this point on, these are parsed from its json
# Frontends should have workarounds when they are null
"Title of the evidence"
name: String
"Description of the evidence"
description: String
"URI of an optional file"
fileUri: String
"Extension of this file"
fileTypeExtension: String
}
type MetaEvidence @entity(immutable: true) {
"<metaEvidenceId>"
id: ID!
"Link to ipfs"
uri: String!
}