Skip to content

Commit dede020

Browse files
committed
fix: manual fixes after rebasing onto feat/erc20-fees-on-arbitrator
1 parent 73eec68 commit dede020

File tree

9 files changed

+51
-43
lines changed

9 files changed

+51
-43
lines changed

contracts/src/arbitration/CentralizedArbitrator.sol

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
pragma solidity 0.8.18;
44

5-
import "./IArbitrator.sol";
5+
import {IArbitrableV2, IArbitratorV2} from "./IArbitratorV2.sol";
66

77
/// @title Centralized Arbitrator
8-
/// @dev This is a centralized arbitrator deciding alone on the result of disputes. It illustrates how IArbitrator interface can be implemented.
8+
/// @dev This is a centralized arbitrator deciding alone on the result of disputes. It illustrates how IArbitratorV2 interface can be implemented.
99
/// Note that this contract supports appeals. The ruling given by the arbitrator can be appealed by crowdfunding a desired choice.
10-
contract CentralizedArbitrator is IArbitrator {
10+
contract CentralizedArbitrator is IArbitratorV2 {
1111
// ************************************* //
1212
// * Enums / Structs * //
1313
// ************************************* //
@@ -19,7 +19,7 @@ contract CentralizedArbitrator is IArbitrator {
1919
}
2020

2121
struct DisputeStruct {
22-
IArbitrable arbitrated; // The address of the arbitrable contract.
22+
IArbitrableV2 arbitrated; // The address of the arbitrable contract.
2323
bytes arbitratorExtraData; // Extra data for the arbitrator.
2424
uint256 choices; // The number of choices the arbitrator can choose from.
2525
uint256 appealPeriodStart; // Time when the appeal funding becomes possible.
@@ -61,12 +61,12 @@ contract CentralizedArbitrator is IArbitrator {
6161
/// @dev To be emitted when a dispute can be appealed.
6262
/// @param _disputeID ID of the dispute.
6363
/// @param _arbitrable The contract which created the dispute.
64-
event AppealPossible(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);
64+
event AppealPossible(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);
6565

6666
/// @dev To be emitted when the current ruling is appealed.
6767
/// @param _disputeID ID of the dispute.
6868
/// @param _arbitrable The contract which created the dispute.
69-
event AppealDecision(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);
69+
event AppealDecision(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);
7070

7171
/// @dev Raised when a contribution is made, inside fundAppeal function.
7272
/// @param _disputeID ID of the dispute.
@@ -151,11 +151,7 @@ contract CentralizedArbitrator is IArbitrator {
151151
// * State Modifiers * //
152152
// ************************************* //
153153

154-
/// @dev Create a dispute. Must be called by the arbitrable contract.
155-
/// Must be paid at least arbitrationCost().
156-
/// @param _choices Amount of choices the arbitrator can make in this dispute.
157-
/// @param _extraData Can be used to give additional info on the dispute to be created.
158-
/// @return disputeID ID of the dispute created.
154+
/// @inheritdoc IArbitratorV2
159155
function createDispute(
160156
uint256 _choices,
161157
bytes calldata _extraData
@@ -164,7 +160,7 @@ contract CentralizedArbitrator is IArbitrator {
164160
disputeID = disputes.length;
165161
disputes.push(
166162
DisputeStruct({
167-
arbitrated: IArbitrable(msg.sender),
163+
arbitrated: IArbitrableV2(msg.sender),
168164
arbitratorExtraData: _extraData,
169165
choices: _choices,
170166
appealPeriodStart: 0,
@@ -175,10 +171,10 @@ contract CentralizedArbitrator is IArbitrator {
175171
);
176172

177173
disputeIDtoRoundArray[disputeID].push();
178-
emit DisputeCreation(disputeID, IArbitrable(msg.sender));
174+
emit DisputeCreation(disputeID, IArbitrableV2(msg.sender));
179175
}
180176

181-
/// @inheritdoc IArbitrator
177+
/// @inheritdoc IArbitratorV2
182178
function createDispute(
183179
uint256 /*_choices*/,
184180
bytes calldata /*_extraData*/,
@@ -373,4 +369,10 @@ contract CentralizedArbitrator is IArbitrator {
373369
}
374370
return (start, end);
375371
}
372+
373+
function currentRuling(
374+
uint256 /*_disputeID*/
375+
) public pure returns (uint256 /*ruling*/, bool /*tied*/, bool /*overridden*/) {
376+
revert("Not supported");
377+
}
376378
}

contracts/src/arbitration/IArbitratorV2.sol

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ interface IArbitratorV2 {
2929
/// @param _accepted Whether the token is accepted or not.
3030
event AcceptedFeeToken(IERC20 indexed _token, bool indexed _accepted);
3131

32+
<<<<<<< HEAD
3233
/// @dev Create a dispute and pay for the fees in the native currency, typically ETH.
34+
=======
35+
/// @dev Create a dispute.
36+
>>>>>>> c716852 (fix: manual fixes after rebasing onto feat/erc20-fees-on-arbitrator)
3337
/// Must be called by the arbitrable contract.
3438
/// Must pay at least arbitrationCost(_extraData).
3539
/// @param _numberOfChoices The number of choices the arbitrator can choose from in this dispute.
@@ -68,9 +72,10 @@ interface IArbitratorV2 {
6872
/// @return cost The arbitration cost in `_feeToken`.
6973
function arbitrationCost(bytes calldata _extraData, IERC20 _feeToken) external view returns (uint256 cost);
7074

71-
/// @dev Return the current ruling of a dispute.
72-
/// This is useful for parties to know if they should appeal.
73-
/// @param _disputeID The identifer of the dispute.
74-
/// @return ruling The ruling which has been given or the one which will be given if there is no appeal.
75-
function currentRuling(uint _disputeID) external view returns (uint ruling);
75+
/// @dev Gets the current ruling of a specified dispute.
76+
/// @param _disputeID The ID of the dispute.
77+
/// @return ruling The current ruling.
78+
/// @return tied Whether it's a tie or not.
79+
/// @return overridden Whether the ruling was overridden by appeal funding or not.
80+
function currentRuling(uint256 _disputeID) external view returns (uint256 ruling, bool tied, bool overridden);
7681
}

contracts/src/arbitration/IDisputeKit.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
pragma solidity 0.8.18;
1010

11-
import "./IArbitrator.sol";
11+
import "./IArbitratorV2.sol";
1212

1313
/// @title IDisputeKit
1414
/// An abstraction of the Dispute Kits intended for interfacing with KlerosCore.

contracts/src/arbitration/KlerosCore.sol

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88

99
pragma solidity 0.8.18;
1010

11-
import "./IArbitrator.sol";
11+
import {IArbitrableV2, IArbitratorV2} from "./IArbitratorV2.sol";
1212
import "./IDisputeKit.sol";
1313
import "./ISortitionModule.sol";
1414
import "../libraries/SafeERC20.sol";
1515

1616
/// @title KlerosCore
1717
/// Core arbitrator contract for Kleros v2.
1818
/// Note that this contract trusts the PNK token, the dispute kit and the sortition module contracts.
19-
contract KlerosCore is IArbitrator {
19+
contract KlerosCore is IArbitratorV2 {
2020
using SafeERC20 for IERC20;
2121

2222
// ************************************* //
@@ -46,7 +46,7 @@ contract KlerosCore is IArbitrator {
4646

4747
struct Dispute {
4848
uint96 courtID; // The ID of the court the dispute is in.
49-
IArbitrable arbitrated; // The arbitrable contract.
49+
IArbitrableV2 arbitrated; // The arbitrable contract.
5050
Period period; // The current period of the dispute.
5151
bool ruled; // True if the ruling has been executed, false otherwise.
5252
uint256 lastPeriodChange; // The last time the period was changed.
@@ -128,8 +128,8 @@ contract KlerosCore is IArbitrator {
128128
event StakeSet(address indexed _address, uint256 _courtID, uint256 _amount);
129129
event StakeDelayed(address indexed _address, uint256 _courtID, uint256 _amount, uint256 _penalty);
130130
event NewPeriod(uint256 indexed _disputeID, Period _period);
131-
event AppealPossible(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);
132-
event AppealDecision(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);
131+
event AppealPossible(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);
132+
event AppealDecision(uint256 indexed _disputeID, IArbitrableV2 indexed _arbitrable);
133133
event Draw(address indexed _address, uint256 indexed _disputeID, uint256 _roundID, uint256 _voteID);
134134
event CourtCreated(
135135
uint256 indexed _courtID,
@@ -490,7 +490,7 @@ contract KlerosCore is IArbitrator {
490490
_setStakeForAccount(_account, _courtID, _stake, _penalty);
491491
}
492492

493-
/// @inheritdoc IArbitrator
493+
/// @inheritdoc IArbitratorV2
494494
function createDispute(
495495
uint256 _numberOfChoices,
496496
bytes memory _extraData
@@ -500,7 +500,7 @@ contract KlerosCore is IArbitrator {
500500
return _createDispute(_numberOfChoices, _extraData, NATIVE_CURRENCY, msg.value);
501501
}
502502

503-
/// @inheritdoc IArbitrator
503+
/// @inheritdoc IArbitratorV2
504504
function createDispute(
505505
uint256 _numberOfChoices,
506506
bytes calldata _extraData,
@@ -526,7 +526,7 @@ contract KlerosCore is IArbitrator {
526526
disputeID = disputes.length;
527527
Dispute storage dispute = disputes.push();
528528
dispute.courtID = courtID;
529-
dispute.arbitrated = IArbitrable(msg.sender);
529+
dispute.arbitrated = IArbitrableV2(msg.sender);
530530
dispute.lastPeriodChange = block.timestamp;
531531

532532
IDisputeKit disputeKit = disputeKitNodes[disputeKitID].disputeKit;
@@ -546,7 +546,7 @@ contract KlerosCore is IArbitrator {
546546
sortitionModule.createDisputeHook(disputeID, 0); // Default round ID.
547547

548548
disputeKit.createDispute(disputeID, _numberOfChoices, _extraData, round.nbVotes);
549-
emit DisputeCreation(disputeID, IArbitrable(msg.sender));
549+
emit DisputeCreation(disputeID, IArbitrableV2(msg.sender));
550550
}
551551

552552
/// @dev Passes the period of a specified dispute.

contracts/src/evidence/EvidenceModule.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@
1010
pragma solidity 0.8.18;
1111

1212
// TODO: standard interfaces should be placed in a separated repo (?)
13-
import "../arbitration/IArbitrator.sol";
13+
import "../arbitration/IArbitratorV2.sol";
1414

1515
/// @title Implementation of the Evidence Standard for cross-chain submissions
1616
contract EvidenceModule {
17-
IArbitrator public arbitrator;
17+
IArbitratorV2 public arbitrator;
1818

1919
event Evidence(
20-
IArbitrator indexed _arbitrator,
20+
IArbitratorV2 indexed _arbitrator,
2121
uint256 indexed _evidenceGroupID,
2222
address indexed _party,
2323
string _evidence
2424
);
2525

26-
constructor(IArbitrator _arbitrator) {
26+
constructor(IArbitratorV2 _arbitrator) {
2727
arbitrator = _arbitrator;
2828
}
2929

contracts/src/evidence/IEvidence.sol

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
pragma solidity 0.8.18;
44

5-
import "../arbitration/IArbitrator.sol";
6-
75
/// @title IEvidence
86
interface IEvidence {
97
/// @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).
10-
/// @param _externalDisputeID Unique identifier for this dispute outside Kleros. It's the submitter responsability to submit the right evidence group ID.
8+
/// @param _externalDisputeID Unique identifier for this dispute outside Kleros. It's the submitter responsability to submit the right external dispute ID.
119
/// @param _party The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party.
1210
/// @param _evidence IPFS path to evidence, example: '/ipfs/Qmarwkf7C9RuzDEJNnarT3WZ7kem5bk8DZAzx78acJjMFH/evidence.json'
1311
event Evidence(uint256 indexed _externalDisputeID, address indexed _party, string _evidence);

contracts/src/gateway/ForeignGateway.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,11 @@ contract ForeignGateway is IForeignGateway {
218218
/// @inheritdoc IReceiverGateway
219219
function senderGateway() external view override returns (address) {
220220
return homeGateway;
221-
}
221+
}
222222

223-
function currentRuling(uint _disputeID) external view returns (uint ruling) {
223+
function currentRuling(
224+
uint256 /*_disputeID*/
225+
) public pure returns (uint256 /*ruling*/, bool /*tied*/, bool /*overridden*/) {
224226
revert("Not supported");
225227
}
226228

contracts/src/kleros-v1/kleros-liquid-xdai/xKlerosLiquidV2.sol

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -631,14 +631,15 @@ contract xKlerosLiquidV2 is Initializable, ITokenController, IArbitratorV2 {
631631
/// @dev Gets the current ruling of a specified dispute.
632632
/// @param _disputeID The ID of the dispute.
633633
/// @return ruling The current ruling.
634-
function currentRuling(uint256 _disputeID) public view returns (uint256 ruling) {
634+
/// @return tied Whether it's a tie or not.
635+
/// @return overridden Whether the ruling was overridden by appeal funding or not.
636+
function currentRuling(uint256 _disputeID) public view returns (uint256 ruling, bool tied, bool /*overridden*/) {
635637
Dispute storage dispute = disputes[_disputeID];
636638
if (dispute.voteCounters.length == 0) {
637639
ruling = disputesRuling[_disputeID];
638640
} else {
639-
ruling = dispute.voteCounters[dispute.voteCounters.length - 1].tied
640-
? 0
641-
: dispute.voteCounters[dispute.voteCounters.length - 1].winningChoice;
641+
tied = dispute.voteCounters[dispute.voteCounters.length - 1].tied;
642+
ruling = tied ? 0 : dispute.voteCounters[dispute.voteCounters.length - 1].winningChoice;
642643
}
643644
}
644645

contracts/test/integration/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ describe("Integration tests", async () => {
9696
expect(result.locked).to.equal(0);
9797
logJurorBalance(result);
9898
});
99-
const tx = await arbitrable.functions["createDispute(uint256,bytes,uint256,uint256)"](2, "0x00", 0, 0, {
99+
const tx = await arbitrable.functions["createDispute(uint256,string,bytes)"](0, "future of france", "0x00", {
100100
value: arbitrationCost,
101101
});
102102
const trace = await network.provider.send("debug_traceTransaction", [tx.hash]);

0 commit comments

Comments
 (0)