Skip to content

Commit 6625985

Browse files
authored
Merge pull request #2 from kleros/master
Updating to the latest commit as of 8th June 2020
2 parents 713b737 + 659e758 commit 6625985

File tree

10 files changed

+88
-42
lines changed

10 files changed

+88
-42
lines changed

contracts/standard/arbitration/AppealableArbitrator.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* @auditors: []
66
* @bounties: []
77
* @deployments: []
8+
* @tools: [MythX]
89
*/
910

1011
pragma solidity ^0.4.24;

contracts/standard/arbitration/CentralizedArbitrator.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* @auditors: []
55
* @bounties: []
66
* @deployments: []
7+
* @tools: [MythX]
78
*/
89

910
pragma solidity ^0.4.15;

contracts/standard/arbitration/Linguo.sol

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
/**
22
* @authors: [@unknownunknown1]
3-
* @reviewers: [@ferittuncer*, @clesaege*, @satello*, @hbarcelos]
3+
* @reviewers: [@ferittuncer*, @clesaege*, @satello*, @hbarcelos, @mtsalenc]
44
* @auditors: []
55
* @bounties: []
66
* @deployments: []
7+
* @tools: [MythX]
78
*/
89

910
/* solium-disable security/no-block-members */
1011
/* solium-disable max-len*/
11-
pragma solidity ^0.4.24;
12+
pragma solidity ^0.4.26;
1213

1314
import "./Arbitrable.sol";
1415
import "../../libraries/CappedMath.sol";
@@ -81,8 +82,8 @@ contract Linguo is Arbitrable {
8182
event TaskCreated(uint indexed _taskID, address indexed _requester, uint _timestamp);
8283

8384
/** @dev To be emitted when a translator assigns the task to himself.
84-
* @param _taskID The ID of the newly created task.
85-
* @param _translator The address that assigned to the task.
85+
* @param _taskID The ID of the assigned task.
86+
* @param _translator The address that was assigned to the task.
8687
* @param _price The task price at the moment it was assigned.
8788
* @param _timestamp When the task was assigned.
8889
*/
@@ -110,9 +111,9 @@ contract Linguo is Arbitrable {
110111
*/
111112
event TaskResolved(uint indexed _taskID, string _reason, uint _timestamp);
112113

113-
/** @dev To be emitted when one of the parties successfully paid its appeal fees.
114+
/** @dev To be emitted when the appeal fees of one of the parties are fully funded.
114115
* @param _taskID The ID of the respective task.
115-
* @param _party The party that paid appeal fees.
116+
* @param _party The party that is fully funded.
116117
*/
117118
event HasPaidAppealFee(uint indexed _taskID, Party _party);
118119

@@ -180,21 +181,21 @@ contract Linguo is Arbitrable {
180181
challengeMultiplier = _challengeMultiplier;
181182
}
182183

183-
/** @dev Changes the percentage of arbitration fees that must be paid by parties if there was no winner and loser in previous round.
184+
/** @dev Changes the percentage of arbitration fees that must be paid by parties as a fee stake if there was no winner and loser in the previous round.
184185
* @param _sharedStakeMultiplier A new value of the multiplier of the appeal cost in case when there is no winner/loser in previous round. In basis point.
185186
*/
186187
function changeSharedStakeMultiplier(uint _sharedStakeMultiplier) public onlyGovernor {
187188
sharedStakeMultiplier = _sharedStakeMultiplier;
188189
}
189190

190-
/** @dev Changes the percentage of arbitration fees that must be paid by the party that won the previous round.
191+
/** @dev Changes the percentage of arbitration fees that must be paid as a fee stake by the party that won the previous round.
191192
* @param _winnerStakeMultiplier A new value of the multiplier of the appeal cost that the winner of the previous round has to pay. In basis points.
192193
*/
193194
function changeWinnerStakeMultiplier(uint _winnerStakeMultiplier) public onlyGovernor {
194195
winnerStakeMultiplier = _winnerStakeMultiplier;
195196
}
196197

197-
/** @dev Changes the percentage of arbitration fees that must be paid by the party that lost the previous round.
198+
/** @dev Changes the percentage of arbitration fees that must be paid as a fee stake by the party that lost the previous round.
198199
* @param _loserStakeMultiplier A new value of the multiplier of the appeal cost that the party that lost the previous round has to pay. In basis points.
199200
*/
200201
function changeLoserStakeMultiplier(uint _loserStakeMultiplier) public onlyGovernor {
@@ -242,10 +243,10 @@ contract Linguo is Arbitrable {
242243

243244
uint price = task.minPrice + (task.maxPrice - task.minPrice) * (now - task.lastInteraction) / task.submissionTimeout;
244245
uint arbitrationCost = arbitrator.arbitrationCost(arbitratorExtraData);
245-
uint deposit = arbitrationCost.addCap((translationMultiplier.mulCap(price)) / MULTIPLIER_DIVISOR);
246+
uint translatorDeposit = arbitrationCost.addCap((translationMultiplier.mulCap(price)) / MULTIPLIER_DIVISOR);
246247

247248
require(task.status == Status.Created, "Task has already been assigned or reimbursed.");
248-
require(msg.value >= deposit, "Not enough ETH to reach the required deposit value.");
249+
require(msg.value >= translatorDeposit, "Not enough ETH to reach the required deposit value.");
249250

250251
task.parties[uint(Party.Translator)] = msg.sender;
251252
task.status = Status.Assigned;
@@ -254,9 +255,9 @@ contract Linguo is Arbitrable {
254255
task.requester.send(remainder);
255256
// Update requester's deposit since we reimbursed him the difference between maximal and actual price.
256257
task.requesterDeposit = price;
257-
task.sumDeposit += deposit;
258+
task.sumDeposit += translatorDeposit;
258259

259-
remainder = msg.value - deposit;
260+
remainder = msg.value - translatorDeposit;
260261
msg.sender.send(remainder);
261262

262263
emit TaskAssigned(_taskID, msg.sender, price, now);
@@ -315,8 +316,9 @@ contract Linguo is Arbitrable {
315316

316317
/** @dev Challenges the translation of a specific task. Requires challenger's deposit.
317318
* @param _taskID The ID of the task.
319+
* @param _evidence A link to evidence using its URI. Ignored if not provided.
318320
*/
319-
function challengeTranslation(uint _taskID) external payable {
321+
function challengeTranslation(uint _taskID, string _evidence) external payable {
320322
Task storage task = tasks[_taskID];
321323

322324
uint arbitrationCost = arbitrator.arbitrationCost(arbitratorExtraData);
@@ -339,6 +341,10 @@ contract Linguo is Arbitrable {
339341

340342
emit Dispute(arbitrator, task.disputeID, _taskID, _taskID);
341343
emit TranslationChallenged(_taskID, msg.sender, now);
344+
345+
if (bytes(_evidence).length > 0)
346+
emit Evidence(arbitrator, _taskID, msg.sender, _evidence);
347+
342348
}
343349

344350
/** @dev Takes up to the total amount required to fund a side of an appeal. Reimburses the rest. Creates an appeal if all sides are fully funded.
@@ -463,8 +469,8 @@ contract Linguo is Arbitrable {
463469
withdrawFeesAndRewards(_beneficiary, _taskID, i);
464470
}
465471

466-
/** @dev Gives a ruling for a dispute. Must be called by the arbitrator.
467-
* The purpose of this function is to ensure that the address calling it has the right to rule on the contract.
472+
/** @dev Gives a ruling for a dispute. Can only be called by the arbitrator.
473+
* The purpose of this function is to ensure that the address calling it has the right to rule on the contract and to invert the ruling in the case a party loses from lack of appeal fees funding.
468474
* @param _disputeID ID of the dispute in the Arbitrator contract.
469475
* @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for "Refuse to arbitrate".
470476
*/

contracts/standard/arbitration/MultipleArbitrableTokenTransaction.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* @auditors: []
55
* @bounties: []
66
* @deployments: []
7+
* @tools: [MythX]
78
*/
89

910
/** @title Multiple Arbitrable ERC20 Token Transaction

contracts/standard/arbitration/MultipleArbitrableTransaction.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* @auditors: []
55
* @bounties: []
66
* @deployments: []
7+
* @tools: [MythX]
78
*/
89

910
pragma solidity ^0.4.24;

contracts/standard/permission/ArbitrableTokenList.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* @auditors: []
55
* @bounties: []
66
* @deployments: []
7+
* @tools: [MythX]
78
*/
89
/* solium-disable max-len*/
910
pragma solidity ^0.4.24;

contracts/standard/proxy/RealitioArbitratorProxy.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* @auditors: []
55
* @bounties: []
66
* @deployments: []
7+
* @tools: [MythX]
78
*/
89

910
pragma solidity ^0.4.24;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"openzeppelin-test-helpers": "^0.4.3",
5151
"pify": "^4.0.1",
5252
"standard-version": "^4.4.0",
53-
"truffle": "^4.1.13"
53+
"truffle": "4.1.16"
5454
},
5555
"dependencies": {
5656
"@kleros/kleros": "^0.1.2",

test/linguo.js

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ contract('Linguo', function(accounts) {
439439
// add a small amount because javascript can have small deviations up to several hundreds when operating with large numbers
440440
const challengerDeposit =
441441
(await linguo.getChallengeValue(0)).toNumber() + 1000
442-
await linguo.challengeTranslation(0, {
442+
await linguo.challengeTranslation(0, '', {
443443
from: challenger,
444444
value: challengerDeposit
445445
})
@@ -461,17 +461,51 @@ contract('Linguo', function(accounts) {
461461
// add a small amount because javascript can have small deviations up to several hundreds when operating with large numbers
462462
const challengerDeposit =
463463
(await linguo.getChallengeValue(0)).toNumber() + 1000
464-
const challengeTx = await linguo.challengeTranslation(0, {
465-
from: challenger,
466-
value: challengerDeposit
467-
})
464+
const challengeTx = await linguo.challengeTranslation(
465+
0,
466+
'ChallengeEvidence',
467+
{
468+
from: challenger,
469+
value: challengerDeposit
470+
}
471+
)
468472

469473
assert.equal(
470474
challengeTx.logs[1].event,
471475
'TranslationChallenged',
472476
'TranslationChallenged event was not emitted'
473477
)
474478

479+
assert.equal(
480+
challengeTx.logs[2].event,
481+
'Evidence',
482+
'Evidence event was not emitted'
483+
)
484+
485+
assert.equal(
486+
challengeTx.logs[2].args._arbitrator,
487+
arbitrator.address,
488+
'The Evidence event has wrong arbitrator'
489+
)
490+
491+
assert.equal(
492+
challengeTx.logs[2].args._evidenceGroupID.toNumber(),
493+
0,
494+
'The Evidence event has wrong evidenceGroupID'
495+
)
496+
497+
assert.equal(
498+
challengeTx.logs[2].args._party,
499+
challenger,
500+
'The Evidence event has wrong party address'
501+
)
502+
503+
assert.equal(
504+
challengeTx.logs[2].args._evidence,
505+
'ChallengeEvidence',
506+
'The Evidence event has wrong evidence string'
507+
)
508+
475509
// get task info again because of updated values
476510
task = await linguo.tasks(0)
477511
const taskInfo = await linguo.getTaskParties(0)
@@ -519,7 +553,7 @@ contract('Linguo', function(accounts) {
519553
const challengerDeposit =
520554
arbitrationFee + (challengeMultiplier * price) / MULTIPLIER_DIVISOR + 1000
521555
await expectThrow(
522-
linguo.challengeTranslation(0, {
556+
linguo.challengeTranslation(0, '', {
523557
from: challenger,
524558
value: challengerDeposit
525559
})
@@ -540,7 +574,7 @@ contract('Linguo', function(accounts) {
540574
// add a small amount because javascript can have small deviations up to several hundreds when operating with large numbers
541575
const challengerDeposit =
542576
(await linguo.getChallengeValue(0)).toNumber() + 1000
543-
await linguo.challengeTranslation(0, {
577+
await linguo.challengeTranslation(0, '', {
544578
from: challenger,
545579
value: challengerDeposit
546580
})
@@ -597,7 +631,7 @@ contract('Linguo', function(accounts) {
597631
// add a small amount because javascript can have small deviations up to several hundreds when operating with large numbers
598632
const challengerDeposit =
599633
(await linguo.getChallengeValue(0)).toNumber() + 1000
600-
await linguo.challengeTranslation(0, {
634+
await linguo.challengeTranslation(0, '', {
601635
from: challenger,
602636
value: challengerDeposit
603637
})
@@ -654,7 +688,7 @@ contract('Linguo', function(accounts) {
654688
// add a small amount because javascript can have small deviations up to several hundreds when operating with large numbers
655689
const challengerDeposit =
656690
(await linguo.getChallengeValue(0)).toNumber() + 1000
657-
await linguo.challengeTranslation(0, {
691+
await linguo.challengeTranslation(0, '', {
658692
from: challenger,
659693
value: challengerDeposit
660694
})
@@ -707,7 +741,7 @@ contract('Linguo', function(accounts) {
707741
// add a small amount because javascript can have small deviations up to several hundreds when operating with large numbers
708742
const challengerDeposit =
709743
(await linguo.getChallengeValue(0)).toNumber() + 1000
710-
await linguo.challengeTranslation(0, {
744+
await linguo.challengeTranslation(0, '', {
711745
from: challenger,
712746
value: challengerDeposit
713747
})
@@ -824,7 +858,7 @@ contract('Linguo', function(accounts) {
824858
// add a small amount because javascript can have small deviations up to several hundreds when operating with large numbers
825859
const challengerDeposit =
826860
(await linguo.getChallengeValue(0)).toNumber() + 1000
827-
await linguo.challengeTranslation(0, {
861+
await linguo.challengeTranslation(0, '', {
828862
from: challenger,
829863
value: challengerDeposit
830864
})
@@ -850,7 +884,7 @@ contract('Linguo', function(accounts) {
850884
// add a small amount because javascript can have small deviations up to several hundreds when operating with large numbers
851885
const challengerDeposit =
852886
(await linguo.getChallengeValue(0)).toNumber() + 1000
853-
await linguo.challengeTranslation(0, {
887+
await linguo.challengeTranslation(0, '', {
854888
from: challenger,
855889
value: challengerDeposit
856890
})
@@ -878,7 +912,7 @@ contract('Linguo', function(accounts) {
878912
// add a small amount because javascript can have small deviations up to several hundreds when operating with large numbers
879913
const challengerDeposit =
880914
(await linguo.getChallengeValue(0)).toNumber() + 1000
881-
await linguo.challengeTranslation(0, {
915+
await linguo.challengeTranslation(0, '', {
882916
from: challenger,
883917
value: challengerDeposit
884918
})
@@ -943,7 +977,7 @@ contract('Linguo', function(accounts) {
943977
// add a small amount because javascript can have small deviations up to several hundreds when operating with large numbers
944978
const challengerDeposit =
945979
(await linguo.getChallengeValue(0)).toNumber() + 1000
946-
await linguo.challengeTranslation(0, {
980+
await linguo.challengeTranslation(0, '', {
947981
from: challenger,
948982
value: challengerDeposit
949983
})
@@ -1044,7 +1078,7 @@ contract('Linguo', function(accounts) {
10441078
// add a small amount because javascript can have small deviations up to several hundreds when operating with large numbers
10451079
const challengerDeposit =
10461080
(await linguo.getChallengeValue(0)).toNumber() + 1000
1047-
await linguo.challengeTranslation(0, {
1081+
await linguo.challengeTranslation(0, '', {
10481082
from: challenger,
10491083
value: challengerDeposit
10501084
})
@@ -1127,7 +1161,7 @@ contract('Linguo', function(accounts) {
11271161
// add a small amount because javascript can have small deviations up to several hundreds when operating with large numbers
11281162
const challengerDeposit =
11291163
(await linguo.getChallengeValue(0)).toNumber() + 1000
1130-
await linguo.challengeTranslation(0, {
1164+
await linguo.challengeTranslation(0, '', {
11311165
from: challenger,
11321166
value: challengerDeposit
11331167
})

yarn.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7027,10 +7027,10 @@ sol-explore@1.6.1:
70277027
resolved "https://registry.yarnpkg.com/sol-explore/-/sol-explore-1.6.1.tgz#b59f073c69fe332560d5a10c32ba8ca7f2986cfb"
70287028
integrity sha1-tZ8HPGn+MyVg1aEMMrqMp/KYbPs=
70297029

7030-
solc@0.4.24:
7031-
version "0.4.24"
7032-
resolved "https://registry.yarnpkg.com/solc/-/solc-0.4.24.tgz#354f14b269b38cbaa82a47d1ff151723502b954e"
7033-
integrity sha512-2xd7Cf1HeVwrIb6Bu1cwY2/TaLRodrppCq3l7rhLimFQgmxptXhTC3+/wesVLpB09F1A2kZgvbMOgH7wvhFnBQ==
7030+
solc@0.4.26:
7031+
version "0.4.26"
7032+
resolved "https://registry.yarnpkg.com/solc/-/solc-0.4.26.tgz#5390a62a99f40806b86258c737c1cf653cc35cb5"
7033+
integrity sha512-o+c6FpkiHd+HPjmjEVpQgH7fqZ14tJpXhho+/bQXlXbliLIS/xjXb42Vxh+qQY1WCSTMQ0+a5vR9vi0MfhU6mA==
70347034
dependencies:
70357035
fs-extra "^0.30.0"
70367036
memorystream "^0.3.1"
@@ -7741,14 +7741,14 @@ truffle-interface-adapter@^0.2.5:
77417741
lodash "^4.17.13"
77427742
web3 "1.2.1"
77437743

7744-
truffle@^4.1.13:
7745-
version "4.1.14"
7746-
resolved "https://registry.yarnpkg.com/truffle/-/truffle-4.1.14.tgz#8d2c298e29abf9b1e486e44ff9faca6d34bb9030"
7747-
integrity sha512-e7tTLvKP3bN9dE7MagfWyFjy4ZgoEGbeujECy1me1ENBzbj/aO/+45gs72qsL3+3IkCNNcWNOJjjrm8BYZZNNg==
7744+
truffle@4.1.16:
7745+
version "4.1.16"
7746+
resolved "https://registry.yarnpkg.com/truffle/-/truffle-4.1.16.tgz#5cc160dcbbbcff6078e80ce328873d83247b084e"
7747+
integrity sha512-Ew0YSyy2802wqqe1Ko4kxo1FMffM+l9uEUXJ+GScwAAXFXwKWRC++eEa9pIIQdHcEj0rJo0jXhp65vS/LOcNwA==
77487748
dependencies:
77497749
mocha "^4.1.0"
77507750
original-require "1.0.1"
7751-
solc "0.4.24"
7751+
solc "0.4.26"
77527752

77537753
tslib@^1.9.0:
77547754
version "1.9.3"

0 commit comments

Comments
 (0)