forked from kleros/kleros-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
257 lines (226 loc) · 5.69 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
#########
# Enums #
#########
enum Period {
evidence
commit
vote
appeal
execution
}
##############
# Interfaces #
##############
interface DisputeKitDispute {
id: ID!
coreDispute: Dispute!
localRounds: [DisputeKitRound!]! @derivedFrom(field: "localDispute")
currentLocalRoundIndex: BigInt!
}
interface DisputeKitRound {
id: ID!
localDispute: DisputeKitDispute!
votes: [Vote!]! @derivedFrom(field: "localRound")
}
interface Vote {
id: ID!
coreDispute: Dispute!
localRound: DisputeKitRound!
juror: User!
}
interface Contribution {
id: ID!
coreDispute: Dispute!
contributor: User!
}
interface EvidenceGroup {
id: ID!
evidences: [Evidence!]! @derivedFrom(field: "evidenceGroup")
nextEvidenceIndex: BigInt!
}
interface Evidence {
id: ID!
evidence: String!
evidenceGroup: EvidenceGroup!
sender: User!
}
############
# Entities #
############
type User @entity {
id: ID! # address
tokens: [JurorTokensPerCourt!]! @derivedFrom(field: "juror")
totalStake: BigInt!
totalDelayed: BigInt!
shifts: [TokenAndETHShift!]! @derivedFrom(field: "juror")
draws: [Draw!]! @derivedFrom(field: "juror")
activeDisputes: BigInt!
disputes: [Dispute!]!
resolvedDisputes: [Dispute!]!
totalResolvedDisputes: BigInt!
totalDisputes: BigInt!
totalCoherent: BigInt!
votes: [Vote!]! @derivedFrom(field: "juror")
contributions: [Contribution!]! @derivedFrom(field: "contributor")
evidences: [Evidence!]! @derivedFrom(field: "sender")
penalties: [Penalty!]! @derivedFrom(field: "juror")
}
type Penalty @entity {
id: ID! # dispute.id-roundIndex-user.id
dispute: Dispute!
round: Round!
juror: User!
amount: BigInt!
numberDraws: BigInt!
degreeOfCoherency: BigInt!
}
type Arbitrable @entity {
id: ID! # address
disputes: [Dispute!]! @derivedFrom(field: "arbitrated")
totalDisputes: BigInt!
}
type TokenAndETHShift @entity {
id: ID! # user.id-dispute.id
juror: User!
dispute: Dispute!
tokenAmount: BigInt!
ethAmount: BigInt!
}
type JurorTokensPerCourt @entity {
id: ID! # user.id-court.id
juror: User!
court: Court!
staked: BigInt!
locked: BigInt!
delayed: BigInt!
}
type Court @entity {
id: ID!
policy: String
name: String
parent: Court
hiddenVotes: Boolean!
children: [Court!]! @derivedFrom(field: "parent")
minStake: BigInt!
alpha: BigInt!
feeForJuror: BigInt!
jurorsForCourtJump: BigInt!
timesPerPeriod: [BigInt!]!
supportedDisputeKits: [DisputeKit!]!
disputes: [Dispute!]! @derivedFrom(field: "court")
numberDisputes: BigInt!
stakedJurors: [JurorTokensPerCourt!]! @derivedFrom(field: "court")
numberStakedJurors: BigInt!
stake: BigInt!
delayedStake: BigInt!
paidETH: BigInt!
paidPNK: BigInt!
}
type Dispute @entity {
id: ID!
court: Court!
arbitrated: Arbitrable!
period: Period!
ruled: Boolean!
currentRuling: BigInt!
tied: Boolean!
overridden: Boolean!
lastPeriodChange: BigInt!
rounds: [Round!]! @derivedFrom(field: "dispute")
currentRound: Round!
currentRoundIndex: BigInt!
shifts: [TokenAndETHShift!]! @derivedFrom(field: "dispute")
disputeKitDispute: DisputeKitDispute @derivedFrom(field: "coreDispute")
}
type Round @entity {
id: ID! # dispute.id-dispute.rounds.length
disputeKit: DisputeKit!
tokensAtStakePerJuror: BigInt!
totalFeesForJurors: BigInt!
nbVotes: BigInt!
repartitions: BigInt!
penalties: BigInt!
drawnJurors: [Draw!]! @derivedFrom(field: "round")
dispute: Dispute!
}
type Draw @entity {
id: ID! # dispute.id-currentRound-voteID
dispute: Dispute!
round: Round!
juror: User!
voteID: BigInt!
}
type DisputeKit @entity {
id: ID!
address: Bytes
parent: DisputeKit
children: [DisputeKit!]! @derivedFrom(field: "parent")
needsFreezing: Boolean!
depthLevel: BigInt!
rounds: [Round!]! @derivedFrom(field: "disputeKit")
courts: [Court!]! @derivedFrom(field: "supportedDisputeKits")
}
type Counter @entity {
id: ID! # Will be the timestamp except for the counter which will be 0
stakedPNK: BigInt!
redistributedPNK: BigInt!
paidETH: BigInt!
activeJurors: BigInt!
cases: BigInt!
casesVoting: BigInt!
casesRuled: BigInt!
}
#####################
# ClassicDisputeKit #
#####################
type ClassicDispute implements DisputeKitDispute @entity {
id: ID! # disputeKit.id-coreDispute
coreDispute: Dispute!
localRounds: [DisputeKitRound!]! @derivedFrom(field: "localDispute")
currentLocalRoundIndex: BigInt!
numberOfChoices: BigInt!
jumped: Boolean!
extraData: Bytes!
}
type ClassicRound implements DisputeKitRound @entity {
id: ID! # disputeKit.id-coreDispute-dispute.rounds.length
localDispute: DisputeKitDispute!
votes: [Vote!]! @derivedFrom(field: "localRound")
winningChoice: BigInt!
counts: [BigInt!]!
tied: Boolean!
totalVoted: BigInt!
totalCommited: BigInt!
paidFees: [BigInt!]!
contributions: [ClassicContribution!]! @derivedFrom(field: "localRound")
feeRewards: BigInt!
fundedChoices: [BigInt!]!
}
type ClassicVote implements Vote @entity {
id: ID! # disputeKit.id-coreDispute-currentRound-juror
coreDispute: Dispute!
localRound: DisputeKitRound!
juror: User!
choice: BigInt!
justification: String!
}
type ClassicEvidenceGroup implements EvidenceGroup @entity {
id: ID!
evidences: [Evidence!]! @derivedFrom(field: "evidenceGroup")
nextEvidenceIndex: BigInt!
}
type ClassicEvidence implements Evidence @entity {
id: ID! # classicEvidenceGroup.id-nextEvidenceIndex
evidence: String!
evidenceGroup: EvidenceGroup!
sender: User!
}
type ClassicContribution implements Contribution @entity {
id: ID! # disputeKit.id-dispute.id-classicround.id-contributor-choice
contributor: User!
coreDispute: Dispute!
localRound: ClassicRound!
amount: BigInt!
choice: BigInt!
rewardWithdrawn: Boolean!
}