Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4c7e74a

Browse files
feat: added partial implementation of binary arbitration proxies
1 parent 54438bc commit 4c7e74a

23 files changed

+1291
-14349
lines changed

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Buidler output
2+
artifacts/
3+
cache/
14

25
# Created by https://www.toptal.com/developers/gitignore/api/vim,node,visualstudiocode,yarn
36
# Edit at https://www.toptal.com/developers/gitignore?templates=vim,node,visualstudiocode,yarn

‎packages/realitio-proxies/buidler.config.js‎ renamed to ‎buidler.config.4.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ task("accounts", "Prints the list of accounts", async (_, {ethers}) => {
2121
module.exports = {
2222
// This is a sample solc configuration that specifies which version of solc to use
2323
solc: {
24-
version: "0.7.2",
24+
version: "0.4.24",
2525
optimizer: {
2626
enabled: true,
2727
runs: 200,
2828
},
2929
},
3030
paths: {
31-
sources: "./contracts",
31+
sources: "./contracts/0.4.x",
3232
},
3333
};

‎buidler.config.js‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const {usePlugin, task} = require("@nomiclabs/buidler/config");
2+
3+
usePlugin("@nomiclabs/buidler-waffle");
4+
usePlugin("@nomiclabs/buidler-ethers");
5+
usePlugin("@nomiclabs/buidler-web3");
6+
7+
// This is a sample Buidler task. To learn how to create your own go to
8+
// https://buidler.dev/guides/create-task.html
9+
task("accounts", "Prints the list of accounts", async (_, {ethers}) => {
10+
const accounts = await ethers.getSigners();
11+
12+
for (const account of accounts) {
13+
console.log(await account.getAddress());
14+
}
15+
});
16+
17+
module.exports = {
18+
solc: {
19+
version: "0.7.2",
20+
optimizer: {
21+
enabled: true,
22+
runs: 200,
23+
},
24+
},
25+
paths: {
26+
sources: "./contracts/0.7.x",
27+
},
28+
};

‎contracts/0.4.x/TestArbitrator.sol‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
pragma solidity ^0.4.24;
2+
3+
import "@kleros/kleros-interaction/contracts/standard/arbitration/EnhancedAppealableArbitrator.sol";
4+
5+
// solhint-disable-next-line no-empty-blocks
6+
contract TestArbitrator is EnhancedAppealableArbitrator {
7+
8+
}
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
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

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /