diff --git a/contracts/standard/proxy/ArbitratorVersioningProxy.sol b/contracts/standard/proxy/ArbitratorVersioningProxy.sol index 64613b4c..a6c82af0 100644 --- a/contracts/standard/proxy/ArbitratorVersioningProxy.sol +++ b/contracts/standard/proxy/ArbitratorVersioningProxy.sol @@ -1,6 +1,6 @@ pragma solidity ^0.4.15; -import "https://github.com/kleros/kleros/contracts/KlerosPOC.sol"; +import "kleros/contracts/KlerosPOC.sol"; import "./VersioningProxy.sol"; diff --git a/contracts/standard/proxy/SimpleArbitratorVersioningProxy.sol b/contracts/standard/proxy/SimpleArbitratorVersioningProxy.sol index e9f60f4d..a7e4c8e4 100644 --- a/contracts/standard/proxy/SimpleArbitratorVersioningProxy.sol +++ b/contracts/standard/proxy/SimpleArbitratorVersioningProxy.sol @@ -1,6 +1,6 @@ pragma solidity ^0.4.15; -import "https://github.com/kleros/kleros/contracts/KlerosPOC.sol"; +import "kleros/contracts/KlerosPOC.sol"; import "./VersioningProxy.sol"; @@ -10,25 +10,16 @@ import "./VersioningProxy.sol"; * @notice A simpler ArbitratorVersioningProxy that only exposes methods in the Arbitrator spec. */ contract SimpleArbitratorVersioningProxy is VersioningProxy { - /* Enums */ - - - - /* Structs */ - - - - /* Events */ - - - /* Storage */ - + mapping (uint256 => address) public disputes; /* Modifiers */ - + modifier onlyIfDisputeExists { + require(disputes[_disputeID] != address(0)); + _; + } /* Constructor */ @@ -36,7 +27,7 @@ import "./VersioningProxy.sol"; * @notice Constructs the arbitrator versioning proxy with the first arbitrator contract version address and tags it v0.0.1. * @param firstAddress The address of the first arbitrator contract version. */ - function ArbitratorVersioningProxy(address firstAddress) VersioningProxy(false, "0.0.1", firstAddress) public {} + function SimpleArbitratorVersioningProxy(address firstAddress) VersioningProxy(false, "0.0.1", firstAddress) public {} /* Fallback */ @@ -46,36 +37,36 @@ import "./VersioningProxy.sol"; */ function() private {} - /* External */ - - - - /* External Views */ - - - /* Public */ + function createDispute(bytes _extraData) public payable returns(uint256 disputeID) { + uint256 disputeID = KlerosPOC(stable._address).createDispute(_extraData); + disputes[disputeID] = stable._address; // Remember arbitrator + return disputeID; + } + function appeal(uint _disputeID, bytes _extraData) public payable onlyIfDisputeExists returns(uint256 disputeID) { + if (disputes[_disputeID] != stable._address) // Arbitrator has been upgraded, create a new dispute in the new arbitrator + return createDispute(_extraData); + + return KlerosPOC(stable._address).appeal(_disputeID, _extraData); + } /* Public Views */ + function arbitrationCost(bytes _extraData) public view returns(uint256 fees) { + return KlerosPOC(stable._address).arbitrationCost(_extraData); + } + function appealCost(uint256 _disputeID, bytes _extraData) public view returns(uint256 fees) { + return KlerosPOC(stable._address).appealCost(_disputeID, _extraData); + } - /* Internal */ - - - - /* Internal Views */ - - - - /* Private */ - - - - /* Private Views */ - - + function currentRuling(uint _disputeID) public view onlyIfDisputeExists returns (uint ruling) { + return KlerosPOC(disputes[_disputeID]).currentRuling(_disputeID); + } + function disputeStatus(uint _disputeID) public view onlyIfDisputeExists returns (DisputeStatus status) { + return KlerosPOC(disputes[_disputeID]).disputeStatus(_disputeID); + } }