Skip to content

Commit 2ab87b4

Browse files
committed
Merge branch 'feat/court-name-and-redeploy' of github.com:kleros/kleros-v2 into feat/court-name-and-redeploy
2 parents 8a7394e + b161b44 commit 2ab87b4

18 files changed

+817
-353
lines changed

subgraph/schema.graphql

Lines changed: 170 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,127 +1,160 @@
1+
#########
2+
# Enums #
3+
#########
4+
15
enum Period {
2-
Evidence
3-
Commit
4-
Vote
5-
Appeal
6-
Execution
6+
evidence
7+
commit
8+
vote
9+
appeal
10+
execution
711
}
812

9-
type Court @entity {
13+
##############
14+
# Interfaces #
15+
##############
16+
17+
interface DisputeKitDispute {
1018
id: ID!
11-
policy: String
12-
name: String
13-
hiddenVotes: Boolean!
14-
parent: Court
15-
children: [Court!]! @derivedFrom(field: "parent")
16-
minStake: BigInt!
17-
alpha: BigInt!
18-
feeForJuror: BigInt!
19-
jurorsForCourtJump: BigInt!
20-
timesPerPeriod: [BigInt!]!
21-
supportedDisputeKits: [DisputeKit!]!
22-
disputes: [Dispute!]! @derivedFrom(field: "courtID")
23-
numberDisputes: BigInt!
24-
stakedJurors: [JurorTokensPerCourt!]! @derivedFrom(field: "court")
25-
numberStakedJurors: BigInt!
26-
tokens: [JurorTokensPerCourt!]! @derivedFrom(field: "court")
27-
stake: BigInt!
28-
paidETH: BigInt!
29-
paidPNK: BigInt!
19+
coreDispute: Dispute!
20+
localRounds: [DisputeKitRound!]! @derivedFrom(field: "localDispute")
21+
currentLocalRoundIndex: BigInt!
22+
}
23+
24+
interface DisputeKitRound {
25+
id: ID!
26+
localDispute: DisputeKitDispute!
27+
}
28+
29+
interface Vote {
30+
id: ID!
31+
coreDispute: Dispute!
32+
localRound: DisputeKitRound!
33+
juror: User!
34+
}
35+
36+
interface Contribution {
37+
id: ID!
38+
coreDispute: Dispute!
39+
contributor: User!
40+
}
41+
42+
interface EvidenceGroup {
43+
id: ID!
44+
evidences: [Evidence!]! @derivedFrom(field: "evidenceGroup")
45+
nextEvidenceIndex: BigInt!
46+
}
47+
48+
interface Evidence {
49+
id: ID!
50+
evidence: String!
51+
evidenceGroup: EvidenceGroup!
52+
sender: User!
3053
}
3154

32-
type Juror @entity {
33-
id: ID! # Set to address
55+
############
56+
# Entities #
57+
############
58+
59+
type User @entity {
60+
id: ID! # address
3461
tokens: [JurorTokensPerCourt!]! @derivedFrom(field: "juror")
3562
totalStake: BigInt!
3663
shifts: [TokenAndETHShift!]! @derivedFrom(field: "juror")
3764
draws: [Draw!]! @derivedFrom(field: "juror")
3865
votes: [Vote!]! @derivedFrom(field: "juror")
66+
contributions: [Contribution!]! @derivedFrom(field: "contributor")
67+
evidences: [Evidence!]! @derivedFrom(field: "sender")
68+
}
69+
70+
type Arbitrated @entity {
71+
id: ID! # address
72+
disputes: [Dispute!]! @derivedFrom(field: "arbitrated")
73+
totalDisputes: BigInt!
3974
}
4075

4176
type TokenAndETHShift @entity {
42-
id: ID! # Set to `${juror.id}-${dispute.id}`
43-
juror: Juror!
77+
id: ID! # user.id-dispute.id
78+
juror: User!
4479
dispute: Dispute!
4580
tokenAmount: BigInt!
4681
ethAmount: BigInt!
4782
}
4883

4984
type JurorTokensPerCourt @entity {
50-
id: ID! # Set to `${juror.id}-${court.id}`
51-
juror: Juror!
85+
id: ID! # user.id-court.id
86+
juror: User!
5287
court: Court!
5388
staked: BigInt!
5489
locked: BigInt!
5590
}
5691

57-
type EvidenceGroup @entity {
92+
type Court @entity {
5893
id: ID!
59-
evidences: [Evidence!]! @derivedFrom(field: "evidenceGroup")
60-
lastEvidenceID: BigInt!
94+
policy: String
95+
name: String
96+
hiddenVotes: Boolean!
97+
parent: Court
98+
hiddenVotes: Boolean!
99+
children: [Court!]! @derivedFrom(field: "parent")
100+
minStake: BigInt!
101+
alpha: BigInt!
102+
feeForJuror: BigInt!
103+
jurorsForCourtJump: BigInt!
104+
timesPerPeriod: [BigInt!]!
105+
supportedDisputeKits: [DisputeKit!]!
106+
disputes: [Dispute!]! @derivedFrom(field: "court")
107+
numberDisputes: BigInt!
108+
stakedJurors: [JurorTokensPerCourt!]! @derivedFrom(field: "court")
109+
numberStakedJurors: BigInt!
110+
stake: BigInt!
111+
paidETH: BigInt!
112+
paidPNK: BigInt!
113+
policy: String
61114
}
62115

63-
type Evidence @entity {
64-
id: ID! # Set to `${evidenceGroupID}-${id}`
65-
evidence: String!
66-
evidenceGroup: EvidenceGroup!
67-
sender: Bytes!
116+
type Dispute @entity {
117+
id: ID!
118+
court: Court!
119+
arbitrated: Arbitrated!
120+
period: Period!
121+
ruled: Boolean!
122+
lastPeriodChange: BigInt!
123+
rounds: [Round!]! @derivedFrom(field: "dispute")
124+
currentRound: Round!
125+
currentRoundIndex: BigInt!
126+
shifts: [TokenAndETHShift!]! @derivedFrom(field: "dispute")
127+
disputeKitDispute: DisputeKitDispute @derivedFrom(field: "coreDispute")
68128
}
69129

70130
type Round @entity {
71-
id: ID! # Set to `${dispute.id}-${currentRound}`
72-
dispute: Dispute!
73-
disputeKitID: DisputeKit!
131+
id: ID! # dispute.id-dispute.rounds.length
132+
disputeKit: DisputeKit!
74133
tokensAtStakePerJuror: BigInt!
75134
totalFeesForJurors: BigInt!
76135
nbVotes: BigInt!
77-
totalVoted: BigInt!
78136
repartitions: BigInt!
79137
penalties: BigInt!
80138
drawnJurors: [Draw!]! @derivedFrom(field: "round")
81-
votes: [Vote!]! @derivedFrom(field: "round")
82-
currentDecision: BigInt
83-
}
84-
85-
type Vote @entity {
86-
id: ID! # Set to `${coreDisputeID}-${coreRoundID}-${jurorAddress}`
87139
dispute: Dispute!
88-
round: Round!
89-
juror: Juror!
90-
choice: BigInt
91-
justification: String
92140
}
93141

94142
type Draw @entity {
95-
id: ID! # Set to `${dispute.id}-${currentRound}-${voteID}`
143+
id: ID! # dispute.id-currentRound-voteID
96144
dispute: Dispute!
97145
round: Round!
98-
juror: Juror!
146+
juror: User!
99147
voteID: BigInt!
100148
}
101149

102-
type Dispute @entity {
103-
id: ID!
104-
courtID: Court!
105-
arbitrated: Bytes!
106-
period: Period!
107-
ruled: Boolean!
108-
lastPeriodChange: BigInt!
109-
rounds: [Round!]! @derivedFrom(field: "dispute")
110-
draws: [Draw!]! @derivedFrom(field: "dispute")
111-
votes: [Vote!]! @derivedFrom(field: "dispute")
112-
currentRound: Int!
113-
shifts: [TokenAndETHShift!]! @derivedFrom(field: "dispute")
114-
gatewayDispute: GatewayDispute! @derivedFrom(field: "homeDispute")
115-
}
116-
117150
type DisputeKit @entity {
118151
id: ID!
119152
address: Bytes
120153
parent: DisputeKit
121154
children: [DisputeKit!]! @derivedFrom(field: "parent")
122155
needsFreezing: Boolean!
123156
depthLevel: BigInt!
124-
rounds: [Round!]! @derivedFrom(field: "disputeKitID")
157+
rounds: [Round!]! @derivedFrom(field: "disputeKit")
125158
courts: [Court!]! @derivedFrom(field: "supportedDisputeKits")
126159
}
127160

@@ -135,7 +168,7 @@ type GatewayDispute @entity {
135168
}
136169

137170
type OutgoingBatch @entity {
138-
id: ID! # Set to messageHash
171+
id: ID! # messageHash
139172
size: BigInt!
140173
epoch: BigInt!
141174
batchMerkleRoot: String!
@@ -151,3 +184,68 @@ type Counter @entity {
151184
casesVoting: BigInt!
152185
casesRuled: BigInt!
153186
}
187+
188+
#####################
189+
# ClassicDisputeKit #
190+
#####################
191+
192+
type ClassicDispute implements DisputeKitDispute @entity {
193+
id: ID! # disputeKit.id-coreDispute
194+
coreDispute: Dispute!
195+
localRounds: [DisputeKitRound!]! @derivedFrom(field: "localDispute")
196+
currentLocalRoundIndex: BigInt!
197+
198+
numberOfChoices: BigInt!
199+
jumped: Boolean!
200+
extraData: Bytes!
201+
}
202+
203+
type ClassicRound implements DisputeKitRound @entity {
204+
id: ID! # disputeKit.id-coreDispute-dispute.rounds.length
205+
localDispute: DisputeKitDispute!
206+
207+
votes: [ClassicVote!]!
208+
winningChoice: BigInt!
209+
counts: [BigInt!]!
210+
tied: Boolean!
211+
totalVoted: BigInt!
212+
totalCommited: BigInt!
213+
paidFees: [BigInt!]!
214+
contributions: [ClassicContribution!]! @derivedFrom(field: "localRound")
215+
feeRewards: BigInt!
216+
fundedChoices: [BigInt!]!
217+
}
218+
219+
type ClassicVote implements Vote @entity {
220+
id: ID! # disputeKit.id-coreDispute-currentRound-juror
221+
coreDispute: Dispute!
222+
localRound: DisputeKitRound!
223+
juror: User!
224+
225+
choice: BigInt!
226+
justification: String!
227+
}
228+
229+
type ClassicEvidenceGroup implements EvidenceGroup @entity {
230+
id: ID!
231+
evidences: [Evidence!]! @derivedFrom(field: "evidenceGroup")
232+
nextEvidenceIndex: BigInt!
233+
}
234+
235+
type ClassicEvidence implements Evidence @entity {
236+
id: ID! # classicEvidenceGroup.id-nextEvidenceIndex
237+
evidence: String!
238+
evidenceGroup: EvidenceGroup!
239+
sender: User!
240+
}
241+
242+
type ClassicContribution implements Contribution @entity {
243+
id: ID! # disputeKit.id-dispute.id-classicround.id-contributor-choice
244+
contributor: User!
245+
coreDispute: Dispute!
246+
247+
localRound: ClassicRound!
248+
amount: BigInt!
249+
choice: BigInt!
250+
rewardWithdrawn: Boolean!
251+
}

0 commit comments

Comments
 (0)