@@ -43,6 +43,8 @@ contract ForeignGateway is IForeignGateway {
4343 address arbitrable
4444 );
4545
46+ event ArbitrationCostModified (uint96 indexed _subcourtID , uint256 _feeForJuror );
47+
4648 // ************************************* //
4749 // * Storage * //
4850 // ************************************* //
@@ -51,7 +53,7 @@ contract ForeignGateway is IForeignGateway {
5153 uint256 public immutable override senderChainID;
5254 address public immutable override senderGateway;
5355 uint256 internal localDisputeID = 1 ; // The disputeID must start from 1 as the KlerosV1 proxy governor depends on this implementation. We now also depend on localDisputeID not ever being zero.
54- uint256 [] internal feeForJuror; // feeForJuror[subcourtID]
56+ mapping ( uint96 => uint256 ) public feeForJuror; // feeForJuror[subcourtID], it mirrors the value on KlerosCore.
5557 address public governor;
5658 IFastBridgeReceiver public fastBridgeReceiver;
5759 IFastBridgeReceiver public depreciatedFastbridge;
@@ -79,13 +81,11 @@ contract ForeignGateway is IForeignGateway {
7981 constructor (
8082 address _governor ,
8183 IFastBridgeReceiver _fastBridgeReceiver ,
82- uint256 [] memory _feeForJuror ,
8384 address _senderGateway ,
8485 uint256 _senderChainID
8586 ) {
8687 governor = _governor;
8788 fastBridgeReceiver = _fastBridgeReceiver;
88- feeForJuror = _feeForJuror;
8989 senderGateway = _senderGateway;
9090 senderChainID = _senderChainID;
9191 }
@@ -113,26 +113,17 @@ contract ForeignGateway is IForeignGateway {
113113 */
114114 function changeSubcourtJurorFee (uint96 _subcourtID , uint256 _feeForJuror ) external onlyByGovernor {
115115 feeForJuror[_subcourtID] = _feeForJuror;
116- }
117-
118- /**
119- * @dev Creates the `feeForJuror` property value for a new subcourt.
120- * @param _feeForJuror The new value for the `feeForJuror` property value.
121- */
122- function createSubcourtJurorFee (uint256 _feeForJuror ) external onlyByGovernor {
123- feeForJuror.push (_feeForJuror);
116+ emit ArbitrationCostModified (_subcourtID, _feeForJuror);
124117 }
125118
126119 // ************************************* //
127120 // * State Modifiers * //
128121 // ************************************* //
129122
130- function createDispute (uint256 _choices , bytes calldata _extraData )
131- external
132- payable
133- override
134- returns (uint256 disputeID )
135- {
123+ function createDispute (
124+ uint256 _choices ,
125+ bytes calldata _extraData
126+ ) external payable override returns (uint256 disputeID ) {
136127 require (msg .value >= arbitrationCost (_extraData), "Not paid enough for arbitration " );
137128
138129 disputeID = localDisputeID++ ;
@@ -166,7 +157,6 @@ contract ForeignGateway is IForeignGateway {
166157
167158 function arbitrationCost (bytes calldata _extraData ) public view override returns (uint256 cost ) {
168159 (uint96 subcourtID , uint256 minJurors ) = extraDataToSubcourtIDMinJurors (_extraData);
169-
170160 cost = feeForJuror[subcourtID] * minJurors;
171161 }
172162
@@ -214,19 +204,17 @@ contract ForeignGateway is IForeignGateway {
214204 // * Internal * //
215205 // ************************ //
216206
217- function extraDataToSubcourtIDMinJurors (bytes memory _extraData )
218- internal
219- view
220- returns (uint96 subcourtID , uint256 minJurors )
221- {
207+ function extraDataToSubcourtIDMinJurors (
208+ bytes memory _extraData
209+ ) internal view returns (uint96 subcourtID , uint256 minJurors ) {
222210 // Note that here we ignore DisputeKitID
223211 if (_extraData.length >= 64 ) {
224212 assembly {
225213 // solium-disable-line security/no-inline-assembly
226214 subcourtID := mload (add (_extraData, 0x20 ))
227215 minJurors := mload (add (_extraData, 0x40 ))
228216 }
229- if (subcourtID >= feeForJuror. length ) subcourtID = 0 ;
217+ if (feeForJuror[ subcourtID] == 0 ) subcourtID = 0 ;
230218 if (minJurors == 0 ) minJurors = MIN_JURORS;
231219 } else {
232220 subcourtID = 0 ;
0 commit comments