-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
354 lines (340 loc) · 10.4 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
# KlerosLiquid entities
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
}
type Court @entity {
id: ID!
"Court Identificator (int), for ordering"
subcourtID: BigInt!
"Total of disputes handled by this court"
disputesNum: BigInt!
"Number of disputes closed that were appealed at least once"
disputesAppealed: BigInt!
"Number of disputes already closed"
disputesClosed: BigInt!
"Number of disputes without rulling"
disputesOngoing: BigInt!
"Number of Disputes in evidence period"
evidencePhaseDisputes: BigInt!,
"Number of Disputes in commit period"
commitPhaseDisputes: BigInt!,
"Number of Disputes in voting period"
votingPhaseDisputes: BigInt!,
"Number of Disputes in appeal period"
appealPhaseDisputes: BigInt!,
"List of disputes on this court"
disputes: [Dispute!]! @derivedFrom(field:"subcourtID")
"List of jurors of this court"
jurors: [Juror!]! @derivedFrom(field:"subcourtsIDs")
"Court childrens"
childs: [Court!]!
"Parent Court"
parent: Court
"Current policy for this Court"
policy: PolicyUpdate
"Number of active jurors in this court"
activeJurors: BigInt!
"Total amount of pnk staked in this court"
tokenStaked: BigInt!
"hiddenVotes property"
hiddenVotes: Boolean!
"minimum amount of tokens that can be staked"
minStake: BigInt!
"Alpha"
alpha: BigInt!
"Fee paid for coherent juror"
feeForJuror: BigInt!
"Number of jurors to jump to parent court"
jurorsForCourtJump: BigInt!
"Time perids of this court"
timePeriods: [BigInt!]!,
"Total ETH distributed in fees"
totalETHFees: BigInt!,
"tokens transfered from incoherent jurors to coherent juros"
totalTokenRedistributed: BigInt!,
"Coherency of the court votes. Coherent Votes / Total Votes * 100. 0 if no votes"
coherency: BigInt!,
"Percentage of disputes that were appealed [0-100]."
appealPercentage: BigInt!
"Number of votes in closed disputes"
numberOfVotes: BigInt!,
"Number of coherent votes in closed disputes"
numberOfCoherentVotes: BigInt!
}
type KlerosCounter @entity {
"id = ID"
id: ID!
"Amount of Courts available"
courtsCount: BigInt!,
"Total Disputes raised"
disputesCount: BigInt!,
"Total open disputes"
openDisputes: BigInt!,
"Total closed disputes"
closedDisputes: BigInt!,
"Number of Disputes in evidence period"
evidencePhaseDisputes: BigInt!,
"Number of Disputes in commit period"
commitPhaseDisputes: BigInt!,
"Number of Disputes in voting period"
votingPhaseDisputes: BigInt!,
"Number of Disputes in appeal period"
appealPhaseDisputes: BigInt!,
"Number of disputes closed that were appealed"
disputesAppealed: BigInt!,
"Percentage of Closed disputes that were appealed"
appealPercentage: BigInt!,
"Number of active jurors"
activeJurors: BigInt!,
"Number of inactive jurors"
inactiveJurors: BigInt!,
"list of jurors drawn at least once"
drawnJurors: BigInt!,
"Number of different arbitrables that have interacted with the Courts"
numberOfArbitrables: BigInt!
"Total tokens staked in this courts"
tokenStaked: BigInt!,
"Total ETH distributed in fees"
totalETHFees: BigInt!,
"Total Token (PNK) redistributed within jurors (from incoherent to coherent)"
totalTokenRedistributed: BigInt!,
"Total USD passed throug the contract in deposit and jurors fees"
totalUSDthroughContract: BigInt!
}
type StakeSet @entity {
id: ID!
address: Juror! # address
subcourtID: BigInt! # uint256
stake: BigInt! # uint128
newTotalStake: BigInt! # uint256
blocknumber: BigInt!
timestamp: BigInt!
gasCost: BigInt!
}
type Juror @entity {
"address, juror (person) maybe has multiple addresses."
id: ID!,
"Courts where the juror has stake"
subcourtsIDs: [Court!]!,
"Current Stakes for this juror"
currentStakes: [CourtStake!]! @derivedFrom(field:"juror"),
"all the setStakes event emited by this juror"
allStakes: [StakeSet!]! @derivedFrom(field:"address")
"Total staked across all the courts"
totalStaked: BigInt!,
"List of disputes where has at least one vote"
disputesAsJuror: [Dispute!]! @derivedFrom(field:"jurorsInvolved"),
"Number of disputes that has been participating as juror"
numberOfDisputesAsJuror: BigInt!,
"List of disputes raised by this wallet"
disputesAsCreator: [Dispute!]! @derivedFrom(field:"creator")
"Number of disputes created by this wallet"
numberOfDisputesCreated: BigInt!,
"All the votes of this juror"
votes: [Vote!]! @derivedFrom(field:"address")
"Amount of ETH rewarded as juror (+ it's gain, - it's loss)"
ethRewards: BigInt!
"Amount of Token (PNK) rewarded as juror (+ it's gain, - it's loss)"
tokenRewards: BigInt!
"Coherency of the juror votes. Coherent Votes / Total Votes * 100. 0 if no votes"
coherency: BigInt!,
"Number of coherent votes"
numberOfCoherentVotes: BigInt!
"Number of votes this juror has in closed disputes"
numberOfVotes: BigInt!
"Transfers of the rewards for this wallet"
tokenAndETHShifts: [TokenAndETHShift!]! @derivedFrom(field:"address")
"Total gas cost"
totalGasCost: BigInt!
}
type CourtStake @entity {
"address.toHex()-subcourtID.toString()"
id: ID!
"Court entity"
court: Court!
"Juror entity"
juror: Juror!
"Amount staked in this court for this juror"
stake: BigInt!
"Timestamp of the last stake"
timestamp: BigInt!
"blocknumber of the last stake"
blockNumber: BigInt!
"tx hash"
txid: Bytes!
}
type Arbitrable @entity {
"smart contract address"
id: ID!,
"List of disputes generated by the arbitrable"
disputes: [Dispute!]! @derivedFrom(field:"arbitrable"),
"Total Disputes raised"
disputesCount: BigInt!,
"Total open disputes"
openDisputes: BigInt!,
"Total closed disputes"
closedDisputes: BigInt!,
"Number of Disputes in evidence period"
evidencePhaseDisputes: BigInt!,
"Number of Disputes in commit period"
commitPhaseDisputes: BigInt!,
"Number of Disputes in voting period"
votingPhaseDisputes: BigInt!,
"Number of Disputes in appeal period"
appealPhaseDisputes: BigInt!,
"Amount of eth fees paid through the arbitrable"
ethFees: BigInt!,
}
type Dispute @entity {
id: ID!,
"Dispute Number"
disputeID: BigInt!,
"Arbitrable SC who raised the dispute"
arbitrable: Arbitrable!,
"wallet who raise the dispute"
creator: Juror!,
"Court where the dispute is handled"
subcourtID: Court!,
"Number of choices wihtin the dispute"
numberOfChoices: BigInt!,
"Current Period of the dispute"
period: Period!
"Timestamp when the dispute was raised"
startTime: BigInt!
"Timestamp of the last period change"
lastPeriodChange: BigInt!,
"Rounds in the dispute"
rounds: [Round!]! @derivedFrom(field:"dispute"),
"Number of rounds in the dispute"
numberOfRounds: BigInt!,
"Number of votes in the dispute"
numberOfVotes: BigInt!
"Number of coherent votes in the dispute"
numberOfCoherentVotes: BigInt!
"Coherency of the dispute votes. Coherent Votes / Total Votes * 100. 0 if no votes"
coherency: BigInt!,
"Boolean indicating if this dispute was appealed at least once"
appealed: Boolean!
"Is ruled the case?"
ruled: Boolean!,
"Current rulling"
currentRulling: BigInt!,
"List of jurors (wallets) involved in the dispute"
jurorsInvolved: [Juror!]!,
"Metaevidence of the dispute. Question and options"
metaevidente: String
"Transaction hash where this dispute was created"
txid: Bytes!
"Transfers made due to this dispute"
TokenAndETHShifts: [TokenAndETHShift!]! @derivedFrom(field:"disputeId")
}
type Round @entity {
"identifier, hash tx"
id: ID!,
"Dispute asociated to the round"
dispute: Dispute!,
"List of votes in the round"
votes: [Vote!]! @derivedFrom(field: "round")
"Amount of votes in the Round"
numberOfVotes: BigInt!,
"Amount of coherent votes in the Round"
numberOfCoherentVotes: BigInt!,
"Coherency of the round votes. Coherent Votes / Total Votes * 100. 0 if no votes"
coherency: BigInt!
"which choice wins in the round?"
winningChoice: BigInt!,
"Timestamp of the beggining of the round"
startTime: BigInt!
}
type Vote @entity {
"id of the vote: disputeId-voteid"
id: ID!,
"Dispute associated for this vote"
dispute: Dispute!,
"Round within the dispute where the vote is casted"
round: Round!,
"Vote identificator"
voteID: BigInt!,
"Address who was selected to vote"
address: Juror!,
"Choice selected, null if has not voted or revelead the vote"
choice: BigInt,
"Boolean to indicate if the vote was casted. If not, the choice 0 indicates pending"
voted: Boolean!,
"Salt of the vote"
salt: BigInt,
"timestamp of the vote casted"
timestamp: BigInt,
"commit hash, if hiddenVote in court is activated"
commit: Bytes
"gas units used for commit"
commitGasUsed: BigInt!
"gas price paid for commit"
commitGasPrice: BigInt!
"gas cost for commit (price*used)"
commitGasCost: BigInt!
"gas used for cast"
castGasUsed: BigInt!
"gas price paid for cast"
castGasPrice: BigInt!
"gas cost for cast (price*used)"
castGasCost: BigInt!
"total gas cost commit+cast"
totalGasCost: BigInt!
"was the vote coherent with the majority? initialized in false"
coherent: Boolean!
}
type NewPeriod @entity {
id: ID!
disputeId: BigInt!,
newPeriod: Period!
blockNumber: BigInt!,
}
type Draw @entity {
"drawID: disputeID-voteID"
id: ID!,
"address drawn in the vote"
address: Bytes!,
"dispute ID"
disputeId: BigInt!,
"appeal round"
roundNumber: BigInt!,
"vote ID of the vote in this dispute"
voteId: BigInt!,
"timestamp when the vote was drawn"
timestamp: BigInt!
}
type TokenAndETHShift @entity {
"tx_hash-log_index"
id: ID!,
"Dispute id related to the event"
disputeId: Dispute!,
"Amount of tokens redistributed in the event"
tokenAmount: BigInt!,
"Amount of ETH redistributed in the event"
ETHAmount: BigInt!,
"wallet of the Juror involved"
address: Juror!,
"block number"
blockNumber: BigInt!,
"timestamp of the tx"
timestamp: BigInt!
}
## PolicyUpdate entities
type PolicyUpdate @entity {
id: ID! # the court id
subcourtID: BigInt! # uint256
policy: String! # String
contractAddress: Bytes! # address
timestamp: BigInt! # uint256
blockNumber: BigInt! # unit256
}