Skip to content

Commit c6b7470

Browse files
committed
feat: added a simple dispute template, moved IMetaEvidence to the v1 folder
And removed intermediate interfaces
1 parent 5bc1ed7 commit c6b7470

File tree

8 files changed

+140
-39
lines changed

8 files changed

+140
-39
lines changed

contracts/src/arbitration/IArbitrable.sol

Lines changed: 0 additions & 26 deletions
This file was deleted.

contracts/src/arbitration/IArbitratorV2.sol

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
pragma solidity 0.8.18;
44

5-
import "./IArbitrableV2.sol";
5+
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
6+
import "./IArbitrable.sol";
67

78
/// @title Arbitrator
89
/// Arbitrator interface that implements the new arbitration standard.
@@ -21,22 +22,52 @@ interface IArbitratorV2 {
2122
/// @param _arbitrable The arbitrable receiving the ruling.
2223
/// @param _disputeID The identifier of the dispute in the Arbitrator contract.
2324
/// @param _ruling The ruling which was given.
24-
event Ruling(IArbitrableV2 indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);
25+
event Ruling(IArbitrable indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);
2526

26-
/// @dev Create a dispute.
27+
/// @dev To be emitted when an ERC20 token is added or removed as a method to pay fees.
28+
/// @param _token The ERC20 token.
29+
/// @param _accepted Whether the token is accepted or not.
30+
event AcceptedFeeToken(IERC20 indexed _token, bool indexed _accepted);
31+
32+
/// @dev Create a dispute and pay for the fees in the native currency, typically ETH.
33+
/// Must be called by the arbitrable contract.
34+
/// Must pay at least arbitrationCost(_extraData).
35+
/// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.
36+
/// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).
37+
/// @return disputeID The identifier of the dispute created.
38+
function createDispute(
39+
uint256 _numberOfChoices,
40+
bytes calldata _extraData
41+
) external payable returns (uint256 disputeID);
42+
43+
/// @dev Create a dispute and pay for the fees in a supported ERC20 token.
2744
/// Must be called by the arbitrable contract.
2845
/// Must pay at least arbitrationCost(_extraData).
29-
/// @param _choices Amount of choices the arbitrator can make in this dispute.
30-
/// @param _extraData Can be used to give additional info on the dispute to be created.
46+
/// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.
47+
/// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).
48+
/// @param _feeToken The ERC20 token used to pay fees.
49+
/// @param _feeAmount Amount of the ERC20 token used to pay fees.
3150
/// @return disputeID The identifier of the dispute created.
32-
function createDispute(uint256 _choices, bytes calldata _extraData) external payable returns (uint256 disputeID);
51+
function createDispute(
52+
uint256 _numberOfChoices,
53+
bytes calldata _extraData,
54+
IERC20 _feeToken,
55+
uint256 _feeAmount
56+
) external returns (uint256 disputeID);
3357

34-
/// @dev Compute the cost of arbitration.
58+
/// @dev Compute the cost of arbitration denominated in the native currency, typically ETH.
3559
/// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.
36-
/// @param _extraData Can be used to give additional info on the dispute to be created.
37-
/// @return cost Required cost of arbitration.
60+
/// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).
61+
/// @return cost The arbitration cost in ETH.
3862
function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);
3963

64+
/// @dev Compute the cost of arbitration denominated in `_feeToken`.
65+
/// It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.
66+
/// @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's court (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the specific dispute kit (last 32 bytes).
67+
/// @param _feeToken The ERC20 token used to pay fees.
68+
/// @return cost The arbitration cost in `_feeToken`.
69+
function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) external view returns (uint256 cost);
70+
4071
/// @dev Return the current ruling of a dispute.
4172
/// This is useful for parties to know if they should appeal.
4273
/// @param _disputeID The identifer of the dispute.

contracts/src/evidence/IMetaEvidence.sol renamed to contracts/src/kleros-v1/interfaces/IEvidenceV1.sol

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,42 @@
22

33
pragma solidity 0.8.18;
44

5-
import "../arbitration/IArbitrator.sol";
5+
/**
6+
* @authors: [@ferittuncer, @hbarcelos]
7+
* @reviewers: []
8+
* @auditors: []
9+
* @bounties: []
10+
* @deployments: []
11+
*/
12+
import "./IArbitratorV1.sol";
613

714
/// @title IMetaEvidence
815
/// ERC-1497: Evidence Standard excluding evidence emission as it will be handled by the arbitrator.
9-
interface IMetaEvidence {
16+
interface IEvidenceV1 {
1017
/// @dev To be emitted when meta-evidence is submitted.
1118
/// @param _metaEvidenceID Unique identifier of meta-evidence.
1219
/// @param _evidence IPFS path to metaevidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/metaevidence.json'
1320
event MetaEvidence(uint256 indexed _metaEvidenceID, string _evidence);
1421

22+
/// @dev To be raised when evidence is submitted. Should point to the resource (evidences are not to be stored on chain due to gas considerations).
23+
/// @param _arbitrator The arbitrator of the contract.
24+
/// @param _evidenceGroupID Unique identifier of the evidence group the evidence belongs to.
25+
/// @param _party The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party.
26+
/// @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'
27+
event Evidence(
28+
IArbitratorV1 indexed _arbitrator,
29+
uint256 indexed _evidenceGroupID,
30+
address indexed _party,
31+
string _evidence
32+
);
33+
1534
/// @dev To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.
1635
/// @param _arbitrator The arbitrator of the contract.
1736
/// @param _disputeID ID of the dispute in the Arbitrator contract.
1837
/// @param _metaEvidenceID Unique identifier of meta-evidence.
1938
/// @param _evidenceGroupID Unique identifier of the evidence group that is linked to this dispute.
2039
event Dispute(
21-
IArbitrator indexed _arbitrator,
40+
IArbitratorV1 indexed _arbitrator,
2241
uint256 indexed _disputeID,
2342
uint256 _metaEvidenceID,
2443
uint256 _evidenceGroupID

contracts/test/integration/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe("Integration tests", async () => {
6565

6666
it("Resolves a dispute on the home chain with no appeal", async () => {
6767
const arbitrationCost = ONE_TENTH_ETH.mul(3);
68-
const [bridger, challenger, relayer] = await ethers.getSigners();
68+
const [, , relayer] = await ethers.getSigners();
6969

7070
await pnk.approve(core.address, ONE_THOUSAND_PNK.mul(100));
7171

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"$schema": "../NewDisputeTemplate.schema.json",
3+
"title": "Let's do this",
4+
"description": "We want to do this: %s",
5+
"question": "Does it comply with the policy?",
6+
"answers": [
7+
{
8+
"title": "Yes",
9+
"description": "Select this if you agree that it must be done."
10+
},
11+
{
12+
"title": "No",
13+
"description": "Select this if you do not agree that it must be done."
14+
}
15+
],
16+
"policyURI": "/ipfs/Qmdvk...rSD6cE/policy.pdf",
17+
"frontendUrl": "https://kleros-v2.netlify.app/#/cases/%s/overview",
18+
"arbitratorChainID": "421613",
19+
"arbitratorAddress": "0xD08Ab99480d02bf9C092828043f611BcDFEA917b",
20+
"category": "Others",
21+
"specification": "KIP001",
22+
"lang": "en_US"
23+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"title": "Let's do this",
3+
"description": "We want to do this: airdrop magic money",
4+
"question": "Does it comply with the policy?",
5+
"type": "single-select",
6+
"answers": [
7+
{
8+
"id": "0x00",
9+
"title": "Invalid/Refuse to Arbitrate",
10+
"reserved": true
11+
},
12+
{
13+
"id": "0x01",
14+
"title": "Yes",
15+
"description": "Select this if you agree that it must be done.",
16+
"reserved": false
17+
},
18+
{
19+
"id": "0x02",
20+
"title": "No",
21+
"description": "Select this if you do not agree that it must be done.",
22+
"reserved": false
23+
}
24+
],
25+
"policyURI": "/ipfs/Qmdvk...rSD6cE/policy.pdf",
26+
"frontendUrl": "https://kleros-v2.netlify.app/#/cases/%s/overview",
27+
"arbitrableChainID": "10200", // Chiado
28+
"arbitrableAddress": "0x22f40371b1d1bd7e6229e33b832cbe00d0b991b2",
29+
"arbitratorChainID": "421613", // ArbitrumGoerli
30+
"arbitratorAddress": "0xD08Ab99480d02bf9C092828043f611BcDFEA917b", // KlerosCore
31+
"category": "Others",
32+
"specification": "KIP001",
33+
"lang": "en_US",
34+
"metadata": {
35+
"aliases": {
36+
"submitter": "0x5B0EdFcD1038746Cc1C1eE3aCdb31feD910B13f4"
37+
}
38+
},
39+
"externalDisputeID": "13", // hash(action)
40+
"arbitrableDisputeID": "3",
41+
"arbitratorDisputeID": "4564",
42+
"disputeTemplateID": "1",
43+
"disputeTemplateHash": "0xD1u9...2254"
44+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
airdrop magic money
2+
3
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"externalDisputeID": "ea6ed15a0867e22f40371b1d1bd7e6229e33b832cbe00d0b991b2da19d4f951a",
3+
"arbitrableDisputeID": "3",
4+
"templateID": "1"
5+
}
6+
7+
// action = "airdrop magic money"
8+
// externalDisputeID = hash(action) = 0xea6ed15a0867e22f40371b1d1bd7e6229e33b832cbe00d0b991b2da19d4f951a

0 commit comments

Comments
 (0)