|
| 1 | +// SPDX-License-Identifier: MIT |
| 2 | +pragma solidity ^0.7.1; |
| 3 | + |
| 4 | +import "@kleros/erc-792/contracts/IArbitrable.sol"; |
| 5 | + |
| 6 | +/** |
| 7 | + * @dev Arbitrable interface for cross-chain arbitration. |
| 8 | + */ |
| 9 | +interface ICrossChainArbitrable is IArbitrable { |
| 10 | + /** |
| 11 | + * @notice Notifies that a dispute has been requested for an arbitrable item. |
| 12 | + * @param _arbitrableItemID The ID of the arbitrable item. |
| 13 | + * @param _plaintiff The address of the dispute requester. |
| 14 | + */ |
| 15 | + function notifyDisputeRequest(uint256 _arbitrableItemID, address _plaintiff) external; |
| 16 | + |
| 17 | + /** |
| 18 | + * @notice Cancels a dispute previously requested for an arbitrable item. |
| 19 | + * @param _arbitrableItemID The ID of the arbitrable item. |
| 20 | + */ |
| 21 | + function cancelDispute(uint256 _arbitrableItemID) external; |
| 22 | + |
| 23 | + /** |
| 24 | + * @notice Returns whether an arbitrable item is subject to a dispute or not. |
| 25 | + * @param _arbitrableItemID The ID of the arbitrable item. |
| 26 | + * @return The disputability status. |
| 27 | + */ |
| 28 | + function isDisputable(uint256 _arbitrableItemID) external view returns (bool); |
| 29 | + |
| 30 | + /** |
| 31 | + * @notice Returns the extra data for the arbitrator. |
| 32 | + * @param _arbitrableItemID The ID of the arbitrable item. |
| 33 | + * @return The arbitrator extra data. |
| 34 | + */ |
| 35 | + function getArbitratorExtraData(uint256 _arbitrableItemID) external view returns (bytes memory); |
| 36 | +} |
| 37 | + |
| 38 | +/** |
| 39 | + * @dev Arbitration Proxy on the side chain. |
| 40 | + */ |
| 41 | +interface IHomeBinaryArbitrationProxy { |
| 42 | + /** |
| 43 | + * @notice Relays the meta evidence to the Foreign Chain. |
| 44 | + * @dev Should be called by the arbitrable contract when the meta evidence is created. |
| 45 | + * @param _arbitrableItemID The ID of the arbitrable item on the arbitrable contract. |
| 46 | + * @param _metaEvidence The meta evidence. |
| 47 | + */ |
| 48 | + function relayMetaEvidence(uint256 _arbitrableItemID, string calldata _metaEvidence) external; |
| 49 | + |
| 50 | + /** |
| 51 | + * @notice Relays to the Foreign Chain that an arbitrable item is subject to a dispute. |
| 52 | + * @dev Should be called by the arbitrable contract when the arbitrable item can be disputed. |
| 53 | + * @param _arbitrableItemID The ID of the arbitrable item on the arbitrable contract. |
| 54 | + * @param _defendant The address of the defendant in case there is a dispute. |
| 55 | + * @param _deadline The absolute time until which the dispute can be created. |
| 56 | + */ |
| 57 | + function relayDisputable( |
| 58 | + uint256 _arbitrableItemID, |
| 59 | + address _defendant, |
| 60 | + uint256 _deadline |
| 61 | + ) external; |
| 62 | + |
| 63 | + /** |
| 64 | + * @notice Receives a dispute request for an arbitrable item from the Foreign Chain. |
| 65 | + * @dev Should only be called by the xDAI/ETH bridge. |
| 66 | + * @param _arbitrable The address of the arbitrable contract. |
| 67 | + * @param _arbitrableItemID The ID of the arbitrable item on the arbitrable contract. |
| 68 | + * @param _plaintiff The address of the dispute creator. |
| 69 | + */ |
| 70 | + function receiveDisputeRequest( |
| 71 | + ICrossChainArbitrable _arbitrable, |
| 72 | + uint256 _arbitrableItemID, |
| 73 | + address _plaintiff |
| 74 | + ) external; |
| 75 | + |
| 76 | + /** |
| 77 | + * @notice Relays to the Foreign Chain that a dispute has been accepted. |
| 78 | + * @dev This will likely be called by an external 3rd-party (i.e.: a bot), |
| 79 | + * since currently there cannot be a bi-directional cross-chain message. |
| 80 | + * @param _arbitrable The address of the arbitrable contract. |
| 81 | + * @param _arbitrableItemID The ID of the arbitrable item on the arbitrable contract. |
| 82 | + */ |
| 83 | + function relayDisputeAccepted(ICrossChainArbitrable _arbitrable, uint256 _arbitrableItemID) external; |
| 84 | + |
| 85 | + /** |
| 86 | + * @notice Relays to the Foreign Chain that a dispute has been rejected. |
| 87 | + * This can happen either because the deadline has passed during the cross-chain |
| 88 | + * message to notify of the dispute request being in course or if the arbitrable |
| 89 | + * contract changed the state for the item and made it non-disputable. |
| 90 | + * @dev This will likely be called by an external 3rd-party (i.e.: a bot), |
| 91 | + * since currently there cannot be a bi-directional cross-chain message. |
| 92 | + * @param _arbitrable The address of the arbitrable contract. |
| 93 | + * @param _arbitrableItemID The ID of the arbitrable item on the arbitrable contract. |
| 94 | + */ |
| 95 | + function relayDisputeRejected(ICrossChainArbitrable _arbitrable, uint256 _arbitrableItemID) external; |
| 96 | + |
| 97 | + /** |
| 98 | + * @notice Receives the dispute created on the Foreign Chain. |
| 99 | + * @dev Should only be called by the xDAI/ETH bridge. |
| 100 | + * @param _arbitrable The address of the arbitrable contract. |
| 101 | + * @param _arbitrableItemID The ID of the arbitrable item on the arbitrable contract. |
| 102 | + * @param _arbitrator The arbitrator address on the Foreign Chain. |
| 103 | + * @param _arbitratorDisputeID The ID of the dispute in the Foreign Chain arbitrator. |
| 104 | + */ |
| 105 | + function receiveDisputeCreated( |
| 106 | + ICrossChainArbitrable _arbitrable, |
| 107 | + uint256 _arbitrableItemID, |
| 108 | + address _arbitrator, |
| 109 | + uint256 _arbitratorDisputeID |
| 110 | + ) external; |
| 111 | + |
| 112 | + /** |
| 113 | + * @notice Receives the failed dispute creation on the Foreign Chain. |
| 114 | + * @dev Should only be called by the xDAI/ETH bridge. |
| 115 | + * @param _arbitrable The address of the arbitrable contract. |
| 116 | + * @param _arbitrableItemID The ID of the arbitrable item on the arbitrable contract. |
| 117 | + */ |
| 118 | + function receiveDisputeFailed(ICrossChainArbitrable _arbitrable, uint256 _arbitrableItemID) external; |
| 119 | + |
| 120 | + /** |
| 121 | + * @notice Receives the ruling for a dispute from the Foreign Chain. |
| 122 | + * @dev Should only be called by the xDAI/ETH bridge. |
| 123 | + * @param _arbitrable The address of the arbitrable contract on the Home Chain. |
| 124 | + * @param _arbitrableItemID The ID of the arbitrable item on the arbitrable contract. |
| 125 | + * @param _ruling The ruling given by the arbitrator. |
| 126 | + */ |
| 127 | + function receiveRuling( |
| 128 | + address _arbitrable, |
| 129 | + uint256 _arbitrableItemID, |
| 130 | + uint256 _ruling |
| 131 | + ) external; |
| 132 | +} |
| 133 | + |
| 134 | +/** |
| 135 | + * @dev Arbitration Proxy on the main chain. |
| 136 | + */ |
| 137 | +interface IForeignBinaryArbitrationProxy is IArbitrable { |
| 138 | + /** |
| 139 | + * @notice Receives the meta evidence from the Home Chain. |
| 140 | + * @dev Should only be called by the xDAI/ETH bridge. |
| 141 | + * @param _arbitrable The address of the arbitrable contract on the Home Chain. |
| 142 | + * @param _arbitrableItemID The ID of the arbitrable item on the arbitrable contract. |
| 143 | + * @param _metaEvidence The meta evidence. |
| 144 | + */ |
| 145 | + function receiveMetaEvidence( |
| 146 | + address _arbitrable, |
| 147 | + uint256 _arbitrableItemID, |
| 148 | + string calldata _metaEvidence |
| 149 | + ) external; |
| 150 | + |
| 151 | + /** |
| 152 | + * @notice Receives from the Home Chain that an arbitrable item is subject to a dispute. |
| 153 | + * @dev Should only be called by the xDAI/ETH bridge. |
| 154 | + * @param _arbitrable The address of the arbitrable contract on the Home Chain. |
| 155 | + * @param _arbitrableItemID The ID of the arbitrable item on the arbitrable contract. |
| 156 | + * @param _defendant The address of the defendant in case there is a dispute. |
| 157 | + * @param _deadline The absolute time until which the dispute can be created. |
| 158 | + * @param _arbitratorExtraData The extra data for the arbitrator. |
| 159 | + */ |
| 160 | + function receiveDisputable( |
| 161 | + address _arbitrable, |
| 162 | + uint256 _arbitrableItemID, |
| 163 | + address _defendant, |
| 164 | + uint256 _deadline, |
| 165 | + bytes calldata _arbitratorExtraData |
| 166 | + ) external; |
| 167 | + |
| 168 | + /** |
| 169 | + * @notice Receives from the Home Chain that the dispute has been accepted. |
| 170 | + * @dev Should only be called by the xDAI/ETH bridge. |
| 171 | + * @param _arbitrable The address of the arbitrable contract. |
| 172 | + * @param _arbitrableItemID The ID of the arbitrable item on the arbitrable contract. |
| 173 | + */ |
| 174 | + function receiveDisputeAccepted(address _arbitrable, uint256 _arbitrableItemID) external; |
| 175 | + |
| 176 | + /** |
| 177 | + * @notice Receives from the Home Chain that the dispute has been rejected. |
| 178 | + * @dev Should only be called by the xDAI/ETH bridge. |
| 179 | + * @param _arbitrable The address of the arbitrable contract. |
| 180 | + * @param _arbitrableItemID The ID of the arbitrable item on the arbitrable contract. |
| 181 | + */ |
| 182 | + function receiveDisputeRejected(address _arbitrable, uint256 _arbitrableItemID) external; |
| 183 | +} |
0 commit comments