DisputeKitClassic
Inherits: BaseDisputeKit, IEvidence
State Variables
WINNER_STAKE_MULTIPLIER
uint256 public constant WINNER_STAKE_MULTIPLIER = 10000;
LOSER_STAKE_MULTIPLIER
uint256 public constant LOSER_STAKE_MULTIPLIER = 20000;
LOSER_APPEAL_PERIOD_MULTIPLIER
uint256 public constant LOSER_APPEAL_PERIOD_MULTIPLIER = 5000;
ONE_BASIS_POINT
uint256 public constant ONE_BASIS_POINT = 10000;
disputes
Dispute[] public disputes;
coreDisputeIDToLocal
mapping(uint256 => uint256) public coreDisputeIDToLocal;
Functions
notJumped
modifier notJumped(uint256 _coreDisputeID);
constructor
Constructor.
constructor(address _governor, KlerosCore _core) BaseDisputeKit(_governor, _core);
Parameters
Name | Type | Description |
---|---|---|
_governor | address | The governor's address. |
_core | KlerosCore | The KlerosCore arbitrator. |
changeGovernor
Changes the governor
storage variable.
function changeGovernor(address payable _governor) external onlyByGovernor;
Parameters
Name | Type | Description |
---|---|---|
_governor | address payable | The new value for the governor storage variable. |
changeCore
Changes the core
storage variable.
function changeCore(address _core) external onlyByGovernor;
Parameters
Name | Type | Description |
---|---|---|
_core | address | The new value for the core storage variable. |
createDispute
Creates a local dispute and maps it to the dispute ID in the Core contract. Note: Access restricted to Kleros Core only.
function createDispute(uint256 _coreDisputeID, uint256 _numberOfChoices, bytes calldata _extraData, uint256 _nbVotes)
external
override
onlyByCore;
Parameters
Name | Type | Description |
---|---|---|
_coreDisputeID | uint256 | The ID of the dispute in Kleros Core. |
_numberOfChoices | uint256 | Number of choices of the dispute |
_extraData | bytes | Additional info about the dispute, for possible use in future dispute kits. |
_nbVotes | uint256 | Number of votes for this dispute. |
draw
Draws the juror from the sortition tree. The drawn address is picked up by Kleros Core. Note: Access restricted to Kleros Core only.
function draw(uint256 _coreDisputeID)
external
override
onlyByCore
notJumped(_coreDisputeID)
returns (address drawnAddress);
Parameters
Name | Type | Description |
---|---|---|
_coreDisputeID | uint256 | The ID of the dispute in Kleros Core. |
Returns
Name | Type | Description |
---|---|---|
drawnAddress | address | The drawn address. |
castCommit
Sets the caller's commit for the specified votes. It can be called multiple times during the
commit period, each call overrides the commits of the previous one.
O(n)
where
n
is the number of votes.
function castCommit(uint256 _coreDisputeID, uint256[] calldata _voteIDs, bytes32 _commit)
external
notJumped(_coreDisputeID);
Parameters
Name | Type | Description |
---|---|---|
_coreDisputeID | uint256 | The ID of the dispute in Kleros Core. |
_voteIDs | uint256[] | The IDs of the votes. |
_commit | bytes32 | The commit. Note that justification string is a part of the commit. |
castVote
Sets the caller's choices for the specified votes.
O(n)
where
n
is the number of votes.
function castVote(
uint256 _coreDisputeID,
uint256[] calldata _voteIDs,
uint256 _choice,
uint256 _salt,
string memory _justification
) external notJumped(_coreDisputeID);
Parameters
Name | Type | Description |
---|---|---|
_coreDisputeID | uint256 | The ID of the dispute in Kleros Core. |
_voteIDs | uint256[] | The IDs of the votes. |
_choice | uint256 | The choice. |
_salt | uint256 | The salt for the commit if the votes were hidden. |
_justification | string | Justification of the choice. |
fundAppeal
Manages contributions, and appeals a dispute if at least two choices are fully funded. Note that the surplus deposit will be reimbursed.
function fundAppeal(uint256 _coreDisputeID, uint256 _choice) external payable notJumped(_coreDisputeID);
Parameters
Name | Type | Description |
---|---|---|
_coreDisputeID | uint256 | Index of the dispute in Kleros Core. |
_choice | uint256 | A choice that receives funding. |
withdrawFeesAndRewards
Allows those contributors who attempted to fund an appeal round to withdraw any reimbursable fees or rewards after the dispute gets resolved.
function withdrawFeesAndRewards(
uint256 _coreDisputeID,
address payable _beneficiary,
uint256 _coreRoundID,
uint256 _choice
) external returns (uint256 amount);
Parameters
Name | Type | Description |
---|---|---|
_coreDisputeID | uint256 | Index of the dispute in Kleros Core contract. |
_beneficiary | address payable | The address whose rewards to withdraw. |
_coreRoundID | uint256 | The round in the Kleros Core contract the caller wants to withdraw from. |
_choice | uint256 | The ruling option that the caller wants to withdraw from. |
Returns
Name | Type | Description |
---|---|---|
amount | uint256 | The withdrawn amount. |
submitEvidence
Submits evidence for a dispute.
function submitEvidence(uint256 _externalDisputeID, string calldata _evidence) external;
Parameters
Name | Type | Description |
---|---|---|
_externalDisputeID | uint256 | Unique identifier for this dispute outside Kleros. It's the submitter responsability to submit the right evidence group ID. |
_evidence | string | IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'. |
getFundedChoices
function getFundedChoices(uint256 _coreDisputeID) public view returns (uint256[] memory fundedChoices);
currentRuling
Gets the current ruling of a specified dispute.
function currentRuling(uint256 _coreDisputeID)
external
view
override
returns (uint256 ruling, bool tied, bool overridden);
Parameters
Name | Type | Description |
---|---|---|
_coreDisputeID | uint256 | The ID of the dispute in Kleros Core. |
Returns
Name | Type | Description |
---|---|---|
ruling | uint256 | The current ruling. |
tied | bool | Whether it's a tie or not. |
overridden | bool | Whether the ruling was overridden by appeal funding or not. |
getDegreeOfCoherence
Gets the degree of coherence of a particular voter. This function is called by Kleros Core in order to determine the amount of the reward.
function getDegreeOfCoherence(uint256 _coreDisputeID, uint256 _coreRoundID, uint256 _voteID)
external
view
override
returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
_coreDisputeID | uint256 | The ID of the dispute in Kleros Core, not in the Dispute Kit. |
_coreRoundID | uint256 | The ID of the round in Kleros Core, not in the Dispute Kit. |
_voteID | uint256 | The ID of the vote. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The degree of coherence in basis points. |
getCoherentCount
Gets the number of jurors who are eligible to a reward in this round.
function getCoherentCount(uint256 _coreDisputeID, uint256 _coreRoundID) external view override returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
_coreDisputeID | uint256 | The ID of the dispute in Kleros Core, not in the Dispute Kit. |
_coreRoundID | uint256 | The ID of the round in Kleros Core, not in the Dispute Kit. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The number of coherent jurors. |
areCommitsAllCast
Returns true if all of the jurors have cast their commits for the last round.
function areCommitsAllCast(uint256 _coreDisputeID) external view override returns (bool);
Parameters
Name | Type | Description |
---|---|---|
_coreDisputeID | uint256 | The ID of the dispute in Kleros Core. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | Whether all of the jurors have cast their commits for the last round. |
areVotesAllCast
Returns true if all of the jurors have cast their votes for the last round.
function areVotesAllCast(uint256 _coreDisputeID) external view override returns (bool);
Parameters
Name | Type | Description |
---|---|---|
_coreDisputeID | uint256 | The ID of the dispute in Kleros Core. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | Whether all of the jurors have cast their votes for the last round. |
isVoteActive
Returns true if the specified voter was active in this round.
function isVoteActive(uint256 _coreDisputeID, uint256 _coreRoundID, uint256 _voteID)
external
view
override
returns (bool);
Parameters
Name | Type | Description |
---|---|---|
_coreDisputeID | uint256 | The ID of the dispute in Kleros Core, not in the Dispute Kit. |
_coreRoundID | uint256 | The ID of the round in Kleros Core, not in the Dispute Kit. |
_voteID | uint256 | The ID of the voter. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | Whether the voter was active or not. |
getRoundInfo
function getRoundInfo(uint256 _coreDisputeID, uint256 _coreRoundID, uint256 _choice)
external
view
override
returns (
uint256 winningChoice,
bool tied,
uint256 totalVoted,
uint256 totalCommited,
uint256 nbVoters,
uint256 choiceCount
);
getVoteInfo
function getVoteInfo(uint256 _coreDisputeID, uint256 _coreRoundID, uint256 _voteID)
external
view
override
returns (address account, bytes32 commit, uint256 choice, bool voted);
_postDrawCheck
Checks that the chosen address satisfies certain conditions for being drawn.
function _postDrawCheck(uint256 _coreDisputeID, address _juror) internal view override returns (bool);
Parameters
Name | Type | Description |
---|---|---|
_coreDisputeID | uint256 | ID of the dispute in the core contract. |
_juror | address | Chosen address. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | Whether the address can be drawn or not. |
Events
DisputeCreation
event DisputeCreation(uint256 indexed _coreDisputeID, uint256 _numberOfChoices, bytes _extraData);
CommitCast
event CommitCast(uint256 indexed _coreDisputeID, uint256[] _voteIDs, bytes32 _commit);
Contribution
event Contribution(
uint256 indexed _coreDisputeID,
uint256 indexed _coreRoundID,
uint256 _choice,
address indexed _contributor,
uint256 _amount
);
Withdrawal
event Withdrawal(
uint256 indexed _coreDisputeID,
uint256 indexed _coreRoundID,
uint256 _choice,
address indexed _contributor,
uint256 _amount
);
ChoiceFunded
event ChoiceFunded(uint256 indexed _coreDisputeID, uint256 indexed _coreRoundID, uint256 indexed _choice);
Structs
Dispute
struct Dispute {
Round[] rounds;
uint256 numberOfChoices;
bool jumped;
mapping(uint256 => uint256) coreRoundIDToLocal;
bytes extraData;
}
Round
struct Round {
Vote[] votes;
uint256 winningChoice;
mapping(uint256 => uint256) counts;
bool tied;
uint256 totalVoted;
uint256 totalCommitted;
mapping(uint256 => uint256) paidFees;
mapping(uint256 => bool) hasPaid;
mapping(address => mapping(uint256 => uint256)) contributions;
uint256 feeRewards;
uint256[] fundedChoices;
uint256 nbVotes;
}
Vote
struct Vote {
address account;
bytes32 commit;
uint256 choice;
bool voted;
}