You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -52,23 +52,21 @@ contract KlerosCore is IArbitrator {
52
52
IDisputeKit disputeKit; // ID of the dispute kit that this dispute was assigned to.
53
53
Period period; // The current period of the dispute.
54
54
bool ruled; // True if the ruling has been executed, false otherwise.
55
-
uint256 currentRound; // The index of the current appeal round. Note that 0 represents the default dispute round. Former votes.length - 1.
56
55
uint256 lastPeriodChange; // The last time the period was changed.
57
56
uint256 nbVotes; // The total number of votes the dispute can possibly have in the current round. Former votes[_appeal].length.
58
-
mapping(uint256=>address[]) drawnJurors; // Addresses of the drawn jurors in the form `drawnJurors[_appeal]`.
59
57
Round[] rounds;
60
58
}
61
59
62
60
struct Round {
63
-
uint256 tokensAtStakePerJuror; // The amount of tokens at stake for each juror in the form `tokensAtStakePerJuror[appeal]`.
64
-
uint256 totalFeesForJurors; // The total juror fees paid in the form `totalFeesForJurors[appeal]`.
65
-
uint256 repartitions; // A counter of vote reward repartitions made in each round in the form `repartitionsInEachRound[appeal]`.
66
-
uint256 penalties; // The amount of tokens collected from penalties in each round in the form `penaltiesInEachRound[appeal]`.
61
+
uint256 tokensAtStakePerJuror; // The amount of tokens at stake for each juror in this round.
62
+
uint256 totalFeesForJurors; // The total juror fees paid in this round.
63
+
uint256 repartitions; // A counter of reward repartitions made in this round.
64
+
uint256 penalties; // The amount of tokens collected from penalties in this round.
65
+
address[] drawnJurors; // Addresses of the jurors that were drawn in this round.
67
66
}
68
67
69
68
struct Juror {
70
69
uint96[] subcourtIDs; // The IDs of subcourts where the juror's stake path ends. A stake path is a path from the forking court to a court the juror directly staked in using `_setStake`.
71
-
// TODO: Relations of staked and locked tokens (currently unfinished).
72
70
mapping(uint96=>uint256) stakedTokens; // The number of tokens the juror has staked in the subcourt in the form `stakedTokens[subcourtID]`.
73
71
mapping(uint96=>uint256) lockedTokens; // The number of tokens the juror has locked in the subcourt in the form `lockedTokens[subcourtID]`.
74
72
}
@@ -90,7 +88,7 @@ contract KlerosCore is IArbitrator {
90
88
Court[] public courts; // The subcourts.
91
89
92
90
//TODO: disputeKits forest.
93
-
IDisputeKit[]public disputeKits; // All supported dispute kits.
91
+
mapping(uint256=>IDisputeKit)public disputeKits; // All supported dispute kits.
94
92
95
93
Dispute[] public disputes; // The disputes.
96
94
mapping(address=> Juror) internal jurors; // The jurors.
@@ -150,7 +148,7 @@ contract KlerosCore is IArbitrator {
150
148
governor = _governor;
151
149
pinakion = _pinakion;
152
150
jurorProsecutionModule = _jurorProsecutionModule;
153
-
disputeKits.push(_disputeKit);
151
+
disputeKits[0] =_disputeKit;
154
152
155
153
// Create the Forking court.
156
154
courts.push(
@@ -210,12 +208,12 @@ contract KlerosCore is IArbitrator {
210
208
211
209
/** @dev Add a new supported dispute kit module to the court.
212
210
* @param _disputeKitAddress The address of the dispute kit contract.
211
+
* @param _disputeKitID The ID assigned to the added dispute kit.
213
212
*/
214
-
function addNewDisputeKit(IDisputeKit _disputeKitAddress) external onlyByGovernor {
215
-
// TODO: the dispute kit data structure. For now keep it a simple array.
213
+
function addNewDisputeKit(IDisputeKit _disputeKitAddress, uint8_disputeKitID) external onlyByGovernor {
214
+
// TODO: the dispute kit data structure. For now keep it a simple mapping.
216
215
// Also note that in current state this function doesn't take into account that the added address is actually new.
217
-
require(disputeKits.length<=256); // Can't be more than 256 because the IDs are used in a bitfield.
218
-
disputeKits.push(_disputeKitAddress);
216
+
disputeKits[_disputeKitID] = _disputeKitAddress;
219
217
}
220
218
221
219
/** @dev Creates a subcourt under a specified parent court.
@@ -227,6 +225,7 @@ contract KlerosCore is IArbitrator {
227
225
* @param _jurorsForCourtJump The `jurorsForCourtJump` property value of the subcourt.
228
226
* @param _timesPerPeriod The `timesPerPeriod` property value of the subcourt.
229
227
* @param _sortitionSumTreeK The number of children per node of the subcourt's sortition sum tree.
228
+
* @param _supportedDisputeKits Bitfield that contains the IDs of the dispute kits that this court will support.
230
229
*/
231
230
function createSubcourt(
232
231
uint96_parent,
@@ -236,7 +235,8 @@ contract KlerosCore is IArbitrator {
236
235
uint256_feeForJuror,
237
236
uint256_jurorsForCourtJump,
238
237
uint256[4] memory_timesPerPeriod,
239
-
uint256_sortitionSumTreeK
238
+
uint256_sortitionSumTreeK,
239
+
uint256_supportedDisputeKits
240
240
) external onlyByGovernor {
241
241
require(
242
242
courts[_parent].minStake <= _minStake,
@@ -255,7 +255,7 @@ contract KlerosCore is IArbitrator {
255
255
feeForJuror: _feeForJuror,
256
256
jurorsForCourtJump: _jurorsForCourtJump,
257
257
timesPerPeriod: _timesPerPeriod,
258
-
supportedDisputeKits: 1
258
+
supportedDisputeKits: _supportedDisputeKits
259
259
})
260
260
);
261
261
@@ -317,7 +317,7 @@ contract KlerosCore is IArbitrator {
317
317
318
318
/** @dev Adds/removes particular dispute kits to a subcourt's bitfield of supported dispute kits.
319
319
* @param _subcourtID The ID of the subcourt.
320
-
* @param _disputeKitIDs IDs of dispute kits in the disputeKits array, which support should be added/removed.
320
+
* @param _disputeKitIDs IDs of dispute kits which support should be added/removed.
321
321
* @param _enable Whether add or remove the dispute kits from the subcourt.
322
322
*/
323
323
function setDisputeKits(
@@ -346,7 +346,7 @@ contract KlerosCore is IArbitrator {
346
346
* @param _stake The new stake.
347
347
*/
348
348
function setStake(uint96_subcourtID, uint256_stake) external {
uint256 coherentCount = dispute.disputeKit.getCoherentCount(_disputeID, _appeal); // Total number of jurors that are eligible to a reward in this round.
520
524
521
525
address account; // Address of the juror.
@@ -539,14 +543,25 @@ contract KlerosCore is IArbitrator {
0 commit comments