Skip to content

Commit

Permalink
fix(appealCost): transfer the dispute if not exists like in appeal fu…
Browse files Browse the repository at this point in the history
…nction

also refactor out repetitive statements into a internal function
  • Loading branch information
0xferit committed Oct 17, 2018
1 parent a12a343 commit 64e45fc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions contracts/standard/proxy/ArbitratorVersioningProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ contract ArbitratorVersioningProxy is Arbitrator, Arbitrable, VersioningProxy {
*/
function appeal(uint _localDisputeID, bytes _extraData) public payable {
if (disputes[_localDisputeID].arbitrator != implementation) { // Arbitrator has been upgraded, create a new dispute in the new arbitrator
uint _choices = disputes[_localDisputeID].choices;
uint _externalDisputeID = Arbitrator(implementation).createDispute.value(msg.value)(_choices, _extraData);
disputes[_localDisputeID].arbitrator = Arbitrator(implementation);
disputes[_localDisputeID].externalDisputeID = _externalDisputeID;
transferDispute(_localDisputeID, _extraData);
}
else{
Arbitrator(implementation).appeal.value(msg.value)(disputes[_localDisputeID].externalDisputeID, _extraData);
Expand All @@ -87,9 +84,19 @@ contract ArbitratorVersioningProxy is Arbitrator, Arbitrable, VersioningProxy {
* @return _fee The appeal cost.
*/
function appealCost(uint _localDisputeID, bytes _extraData) public view returns(uint _fee) {
if (disputes[_localDisputeID].arbitrator != implementation) {
transferDispute(_localDisputeID, _extraData);
}
return Arbitrator(implementation).appealCost(disputes[_localDisputeID].externalDisputeID, _extraData);
}

function transferDispute(uint _localDisputeID, bytes _extraData) internal {
uint _choices = disputes[_localDisputeID].choices;
uint _externalDisputeID = Arbitrator(implementation).createDispute.value(msg.value)(_choices, _extraData);
disputes[_localDisputeID].arbitrator = Arbitrator(implementation);
disputes[_localDisputeID].externalDisputeID = _externalDisputeID;
}

/** @notice Get the current ruling of a dispute. This is useful for parties to know if they should appeal.
* @param _localDisputeID The ID of the dispute.
* @return _ruling The current ruling which will be given if there is no appeal or which has been given.
Expand Down

0 comments on commit 64e45fc

Please sign in to comment.