@@ -25,6 +25,7 @@ contract ArbitrableExample is IArbitrableV2 {
2525 address public immutable governor;
2626 IArbitratorV2 public arbitrator; // Arbitrator is set in constructor.
2727 uint256 public disputeTemplates; // The number of dispute templates created.
28+ bytes public arbitratorExtraData; // Extra data to set up the arbitration.
2829 IERC20 public immutable weth; // The WETH token.
2930 mapping (uint256 => uint256 ) public externalIDtoLocalID; // Maps external (arbitrator side) dispute IDs to local dispute IDs.
3031 DisputeStruct[] public disputes; // Stores the disputes' info. disputes[disputeID].
@@ -37,9 +38,15 @@ contract ArbitrableExample is IArbitrableV2 {
3738 /// @param _arbitrator The arbitrator to rule on created disputes.
3839 /// @param _templateData The dispute template data.
3940 /// @param _weth The WETH token.
40- constructor (IArbitratorV2 _arbitrator , string memory _templateData , IERC20 _weth ) {
41+ constructor (
42+ IArbitratorV2 _arbitrator ,
43+ string memory _templateData ,
44+ bytes memory _arbitratorExtraData ,
45+ IERC20 _weth
46+ ) {
4147 governor = msg .sender ;
4248 arbitrator = _arbitrator;
49+ arbitratorExtraData = _arbitratorExtraData;
4350 weth = _weth;
4451 emit DisputeTemplate (disputeTemplates++ , "" , _templateData);
4552 }
@@ -58,47 +65,39 @@ contract ArbitrableExample is IArbitrableV2 {
5865 arbitrator = _arbitrator;
5966 }
6067
68+ function changeArbitratorExtraData (bytes calldata _arbitratorExtraData ) external {
69+ require (msg .sender == governor, "Not authorized: governor only. " );
70+ arbitratorExtraData = _arbitratorExtraData;
71+ }
72+
6173 // ************************************* //
6274 // * State Modifiers * //
6375 // ************************************* //
6476
6577 /// @dev Calls createDispute function of the specified arbitrator to create a dispute.
6678 /// Note that we don’t need to check that msg.value is enough to pay arbitration fees as it’s the responsibility of the arbitrator contract.
67- /// @param _templateId The identifier of the dispute template. Should not be used with _templateUri.
6879 /// @param _action The action that requires arbitration.
69- /// @param _arbitratorExtraData Extra data for the arbitrator.
7080 /// @return disputeID Dispute id (on arbitrator side) of the dispute created.
71- function createDispute (
72- uint256 _templateId ,
73- string calldata _action ,
74- bytes calldata _arbitratorExtraData
75- ) external payable returns (uint256 disputeID ) {
81+ function createDispute (string calldata _action ) external payable returns (uint256 disputeID ) {
7682 emit Action (_action);
7783
7884 uint256 numberOfRulingOptions = 2 ;
7985 uint256 localDisputeID = disputes.length ;
8086 disputes.push (DisputeStruct ({isRuled: false , ruling: 0 , numberOfRulingOptions: numberOfRulingOptions}));
8187
82- disputeID = arbitrator.createDispute {value: msg .value }(numberOfRulingOptions, _arbitratorExtraData );
88+ disputeID = arbitrator.createDispute {value: msg .value }(numberOfRulingOptions, arbitratorExtraData );
8389 externalIDtoLocalID[disputeID] = localDisputeID;
8490
8591 uint256 externalDisputeID = uint256 (keccak256 (abi.encodePacked (_action)));
86- emit DisputeRequest (arbitrator, disputeID, externalDisputeID, _templateId , "" );
92+ emit DisputeRequest (arbitrator, disputeID, externalDisputeID, disputeTemplates - 1 , "" );
8793 }
8894
8995 /// @dev Calls createDispute function of the specified arbitrator to create a dispute.
9096 /// Note that we don’t need to check that msg.value is enough to pay arbitration fees as it’s the responsibility of the arbitrator contract.
91- /// @param _templateId The identifier of the dispute template. Should not be used with _templateUri.
9297 /// @param _action The action that requires arbitration.
93- /// @param _arbitratorExtraData Extra data for the arbitrator.
9498 /// @param _feeInWeth Amount of fees in WETH for the arbitrator.
9599 /// @return disputeID Dispute id (on arbitrator side) of the dispute created.
96- function createDispute (
97- uint256 _templateId ,
98- string calldata _action ,
99- bytes calldata _arbitratorExtraData ,
100- uint256 _feeInWeth
101- ) external payable returns (uint256 disputeID ) {
100+ function createDispute (string calldata _action , uint256 _feeInWeth ) external payable returns (uint256 disputeID ) {
102101 emit Action (_action);
103102
104103 uint256 numberOfRulingOptions = 2 ;
@@ -108,11 +107,11 @@ contract ArbitrableExample is IArbitrableV2 {
108107 require (weth.safeTransferFrom (msg .sender , address (this ), _feeInWeth), "Transfer failed " );
109108 require (weth.increaseAllowance (address (arbitrator), _feeInWeth), "Allowance increase failed " );
110109
111- disputeID = arbitrator.createDispute (numberOfRulingOptions, _arbitratorExtraData , weth, _feeInWeth);
110+ disputeID = arbitrator.createDispute (numberOfRulingOptions, arbitratorExtraData , weth, _feeInWeth);
112111 externalIDtoLocalID[disputeID] = localDisputeID;
113112
114113 uint256 externalDisputeID = uint256 (keccak256 (abi.encodePacked (_action)));
115- emit DisputeRequest (arbitrator, disputeID, externalDisputeID, _templateId , "" );
114+ emit DisputeRequest (arbitrator, disputeID, externalDisputeID, disputeTemplates - 1 , "" );
116115 }
117116
118117 /// @dev To be called by the arbitrator of the dispute, to declare the winning ruling.
0 commit comments