Skip to content

Commit 5332653

Browse files
committed
feat: interfaces for the arbitrator, arbitrables and evidence v2
1 parent dd61932 commit 5332653

File tree

3 files changed

+122
-0
lines changed

3 files changed

+122
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// SPDX-License-Identifier: MIT
2+
3+
pragma solidity ^0.8;
4+
5+
import "./IArbitratorV2.sol";
6+
7+
/**
8+
* @title IArbitrableV2
9+
* Arbitrable interface.
10+
* When developing arbitrable contracts, we need to:
11+
* - Define the action taken when a ruling is received by the contract.
12+
* - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);
13+
*/
14+
interface IArbitrableV2 {
15+
/**
16+
* @dev To be emitted when a dispute is created to link the correct meta-evidence to the disputeID.
17+
* @param _arbitrator The arbitrator of the contract.
18+
* @param _disputeID ID of the dispute in the Arbitrator contract.
19+
* @param _externalDisputeID Unique identifier from the dispute creator that is linked to this dispute.
20+
* @param _disputeContextUri IPFS path to dispute context, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/disputecontext.json'
21+
*/
22+
event Dispute(
23+
IArbitrableV2 indexed _arbitrator,
24+
uint256 indexed _disputeID,
25+
uint256 _externalDisputeID,
26+
string _disputeContextUri
27+
);
28+
29+
/**
30+
* @dev To be raised when a ruling is given.
31+
* @param _arbitrator The arbitrator giving the ruling.
32+
* @param _disputeID ID of the dispute in the Arbitrator contract.
33+
* @param _ruling The ruling which was given.
34+
*/
35+
event Ruling(IArbitratorV2 indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);
36+
37+
/**
38+
* @dev Give a ruling for a dispute. Must be called by the arbitrator.
39+
* The purpose of this function is to ensure that the address calling it has the right to rule on the contract.
40+
* @param _disputeID ID of the dispute in the Arbitrator contract.
41+
* @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for "Not able/wanting to make a decision".
42+
*/
43+
function rule(uint256 _disputeID, uint256 _ruling) external;
44+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// SPDX-License-Identifier: MIT
2+
3+
pragma solidity ^0.8;
4+
5+
import "./IArbitrableV2.sol";
6+
7+
/**
8+
* @title Arbitrator
9+
* Arbitrator interface that implements the new arbitration standard.
10+
* Unlike the ERC-792 this standard doesn't have anything related to appeals, so each arbitrator can implement an appeal system that suits it the most.
11+
* When developing arbitrator contracts we need to:
12+
* - Define the functions for dispute creation (createDispute). Don't forget to store the arbitrated contract and the disputeID (which should be unique, may nbDisputes).
13+
* - Define the functions for cost display (arbitrationCost).
14+
* - Allow giving rulings. For this a function must call arbitrable.rule(disputeID, ruling).
15+
*/
16+
interface IArbitratorV2 {
17+
/**
18+
* @dev To be emitted when a dispute is created.
19+
* @param _disputeID Identifier of the dispute.
20+
* @param _arbitrable The contract which created the dispute.
21+
*/
22+
event DisputeCreation(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);
23+
24+
/**
25+
* @dev To be raised when a ruling is given.
26+
* @param _arbitrable The arbitrable receiving the ruling.
27+
* @param _disputeID Identifier of the dispute in the Arbitrator contract.
28+
* @param _ruling The ruling which was given.
29+
*/
30+
event Ruling(IArbitrableV2 indexed _arbitrable, uint256 indexed _disputeID, uint256 _ruling);
31+
32+
/**
33+
* @dev Create a dispute. Must be called by the arbitrable contract.
34+
* Must pay at least arbitrationCost(_extraData).
35+
* @param _choices Amount of choices the arbitrator can make in this dispute.
36+
* @param _extraData Can be used to give additional info on the dispute to be created.
37+
* @return disputeID Identifier of the dispute created.
38+
*/
39+
function createDispute(uint256 _choices, bytes calldata _extraData) external payable returns (uint256 disputeID);
40+
41+
/**
42+
* @dev Compute the cost of arbitration. 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.
43+
* @param _extraData Can be used to give additional info on the dispute to be created.
44+
* @return cost Required cost of arbitration.
45+
*/
46+
function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);
47+
48+
/**
49+
* @dev Return the current ruling of a dispute. This is useful for parties to know if they should appeal.
50+
* @param _disputeID ID of the dispute.
51+
* @return ruling The ruling which has been given or the one which will be given if there is no appeal.
52+
*/
53+
function currentRuling(uint _disputeID) external view returns (uint ruling);
54+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// SPDX-License-Identifier: MIT
2+
3+
pragma solidity ^0.8.0;
4+
5+
import "../arbitration/IArbitratorV2.sol";
6+
7+
/** @title IEvidence
8+
* ERC-1497: Evidence Standard
9+
*/
10+
interface IEvidenceV2 {
11+
/**
12+
* @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).
13+
* @param _arbitrator The arbitrator of the contract.
14+
* @param _externalDisputeID Unique identifier from the dispute creator that is linked to this dispute.
15+
* @param _party The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party.
16+
* @param _evidenceUri IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'
17+
*/
18+
event Evidence(
19+
IArbitratorV2 indexed _arbitrator,
20+
uint256 indexed _externalDisputeID,
21+
address indexed _party,
22+
string _evidenceUri
23+
);
24+
}

0 commit comments

Comments
 (0)