|
| 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 | +} |
0 commit comments