-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
282 lines (196 loc) · 5.71 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
#
# Kleros
#
type KlerosSummary @entity {
" Kleros platform ID "
id: ID!
" Current phase "
currentPhase: Phase
" The last time the phase was change "
lastPhaseChange: BigInt
" Total numbers of courts "
courtCount: BigInt!
" Total numbers of disputes "
disputeCount: BigInt!
" Total numbers of votes "
voteCount: BigInt!
" Total amount of tokens staked in all courts "
totalStaked: BigDecimal!
" Total amount of ETH punished to jurors "
totalEthPunished: BigDecimal!
" Total amount of ETH rewarded to jurors "
totalEthRewarded: BigDecimal!
" Total amount of tokens punished to jurors "
totalTokenPunished: BigDecimal!
" Total amount of tokens rewarded to jurors "
totalTokenRewarded: BigDecimal!
}
type Court @entity {
" Court index "
id: ID!
" Court name "
name: String!
" Parent court "
parent: Court
" Whether to use commit and reveal or not "
hiddenVotes: Boolean!
" Minimum tokens needed to stake in the court "
minStake: BigDecimal!
" Basis point of tokens that are lost when incoherent "
alpha: BigInt!
" Arbitration fee paid per juror "
feeForJuror: BigDecimal!
" The appeal after the one that reaches this number of jurors will go to the parent court if any, otherwise, no more appeals are possible "
jurorsForCourtJump: BigDecimal!
" Total numbers of disputes on this court "
disputeCount: BigInt!
" URI of the court policy "
policy: String
" List of child courts "
children: [Court!] @derivedFrom(field: "parent")
"All disputes in this court "
disputes: [Dispute!] @derivedFrom(field: "court")
" All token stakes in this court "
stakes: [Stake!] @derivedFrom(field: "court")
}
type Dispute @entity {
" Dispute ID "
id: ID!
" The subcourt the dispute is in "
court: Court!
" The number of choices jurors have when voting "
numberOfChoices: BigInt!
" Current period "
period: Period!
" Address of the dispute's owner "
owner: Bytes!
" Total numbers of votes of this dispute "
voteCount: BigInt!
" Creation timestamp as seconds "
created: BigInt!
" Block number in which the dispute was created "
createdAtBlock: BigInt!
" Transaction hash in which the dispute was created "
createdAtTransaction: Bytes!
" The last time the period was changed "
lastPeriodChange: BigInt
" Timestamp as seconds of most recent action "
modified: BigInt!
" Block number at most recent action"
modifiedAtBlock: BigInt!
" Transaction hash at most recent action "
modifiedAtTransaction: Bytes!
" Dispute votes "
votes: [Vote!] @derivedFrom(field: "dispute")
}
type Juror @entity {
" <jurorAddress> "
id: ID!
" Juror's account address "
address: Bytes!
" Juror's total amount of tokens staked in subcourts "
stakedTokens: BigDecimal!
" Juror's total amount of tokens locked in disputes "
lockedTokens: BigDecimal
" Last stake timestamp as seconds "
lastStake: BigInt
" Block number in which last stake was made "
lastStakeBlock: BigInt
" Transaction hash in which last stake was made "
lastStakeTransaction: Bytes
" All token stakes made by this juror "
stakes: [Stake!] @derivedFrom(field: "juror")
" Juror votes "
votes: [Vote!] @derivedFrom(field: "juror")
}
type Stake @entity {
" <courtId>-<jurorAddress>-<transactionHash>-<logIndex> "
id: ID!
" Subcourt at the end of the stake path "
court: Court!
" Juror account address "
juror: Juror!
" Amount of token staked "
amount: BigDecimal!
" Stake timestamp as seconds "
timestamp: BigInt!
" Block number in which the stake was set "
block: BigInt!
" Transaction hash in which the stake was set "
transaction: Bytes!
}
type Vote @entity {
" <disputeId>-<round>-<voteId> "
id: ID!
" Dispute ID "
dispute: Dispute!
" Juror address "
juror: Juror!
" Round index "
round: BigInt!
" Vote ID "
voteId: BigInt!
" Creation timestamp as seconds "
created: BigInt!
" Block number in which the vote was created "
createdAtBlock: BigInt!
" Transaction hash in which the vote was created "
createdAtTransaction: Bytes!
}
type Reward @entity {
" <disputeId>-<jurorAddress>-<transactionHash>-<logIndex> "
id: ID!
" Dispute ID "
dispute: Dispute!
" Juror address "
juror: Juror!
" The amount of ETH a juror won (if positive) or lost (if negative) "
ethAmount: BigDecimal!
" The amount of tokens a juror won (if positive) or lost (if negative) "
tokenAmount: BigDecimal!
" Reward timestamp as seconds "
timestamp: BigInt!
" Block number in which the reward was shifted "
block: BigInt!
" Transaction hash in which the reward was shifted "
transaction: Bytes!
}
" Dispute period "
enum Period {
" Evidence can be submitted. This is also when drawing has to take place "
EVIDENCE
" Jurors commit a hashed vote. This is skipped for courts without hidden votes "
COMMIT
" Jurors reveal/cast their vote depending on whether the court has hidden votes or not "
VOTE
" The dispute can be appealed "
APPEAL
" Tokens are redistributed and the ruling is executed "
EXECUTION
}
enum Phase {
" Stake sum trees can be updated. Pass after `minStakingTime` passes and there is at least one dispute without jurors. "
STAKING
" Waiting for a random number. Pass as soon as it is ready. "
GENERATING
" Jurors can be drawn. Pass after all disputes have jurors or `maxDrawingTime` passes. "
DRAWING
}
#
# Pinakion
#
type PinakionTransfer @entity {
id: ID!
" Quantity of tokens transferred "
amount: BigDecimal!
" Address of the source account "
from: Bytes!
" Address of the destination account "
to: Bytes!
" Block number "
block: BigInt!
" Event timestamp "
timestamp: BigInt!
" Transaction hash "
transaction: Bytes!
}