@@ -115,6 +115,24 @@ contract GeneralizedTCR is IArbitrable, IEvidence {
115
115
*/
116
116
event ItemSubmitted (bytes32 indexed _itemID , address indexed _submitter , bytes _data );
117
117
118
+ /**
119
+ * @dev Emitted when a party contributes to an appeal.
120
+ * @param _itemID The ID of the item with a dispute.
121
+ * @param _contributor The address making the contribution.
122
+ * @param _request The index disputed request.
123
+ * @param _round The index of the round receiving the contribution.
124
+ * @param _amount The amount of the contribution.
125
+ * @param _side The party receiving the contribution.
126
+ */
127
+ event AppealContribution (
128
+ bytes32 indexed _itemID ,
129
+ address indexed _contributor ,
130
+ uint indexed _request ,
131
+ uint _round ,
132
+ uint _amount ,
133
+ Party _side
134
+ );
135
+
118
136
/**
119
137
* @dev Constructs the arbitrable curated registry.
120
138
* @param _arbitrator The trusted arbitrator to resolve potential disputes.
@@ -234,12 +252,11 @@ contract GeneralizedTCR is IArbitrable, IEvidence {
234
252
*/
235
253
function fundAppeal (bytes32 _itemID , Party _side ) external payable {
236
254
require (_side == Party.Requester || _side == Party.Challenger); // solium-disable-line error-reason
237
- Item storage item = items[_itemID];
238
255
require (
239
- item .status == Status.RegistrationRequested || item .status == Status.ClearingRequested,
256
+ items[_itemID] .status == Status.RegistrationRequested || items[_itemID] .status == Status.ClearingRequested,
240
257
"The item must have a pending request. "
241
258
);
242
- Request storage request = item .requests[item .requests.length - 1 ];
259
+ Request storage request = items[_itemID] .requests[items[_itemID] .requests.length - 1 ];
243
260
require (request.disputed, "A dispute must have been raised to fund an appeal. " );
244
261
(uint appealPeriodStart , uint appealPeriodEnd ) = request.arbitrator.appealPeriod (request.disputeID);
245
262
require (
@@ -256,17 +273,30 @@ contract GeneralizedTCR is IArbitrable, IEvidence {
256
273
loser = Party.Requester;
257
274
require (! (_side== loser) || (now - appealPeriodStart < (appealPeriodEnd- appealPeriodStart)/ 2 ), "The loser must contribute during the first half of the appeal period. " );
258
275
259
- uint multiplier;
276
+ // Use array to get around stack limit.
277
+ // 0: multiplier
278
+ // 1: contribution
279
+ uint [2 ] memory values = [uint (0 ), uint (0 )];
260
280
if (_side == winner)
261
- multiplier = winnerStakeMultiplier;
281
+ values[ 0 ] = winnerStakeMultiplier;
262
282
else if (_side == loser)
263
- multiplier = loserStakeMultiplier;
283
+ values[ 0 ] = loserStakeMultiplier;
264
284
else
265
- multiplier = sharedStakeMultiplier;
285
+ values[ 0 ] = sharedStakeMultiplier;
266
286
267
287
uint appealCost = request.arbitrator.appealCost (request.disputeID, request.arbitratorExtraData);
268
- uint totalCost = appealCost.addCap ((appealCost.mulCap (multiplier)) / MULTIPLIER_DIVISOR);
269
- contribute (round, _side, msg .sender , msg .value , totalCost);
288
+ uint totalCost = appealCost.addCap ((appealCost.mulCap (values[0 ])) / MULTIPLIER_DIVISOR);
289
+ values[1 ] = contribute (round, _side, msg .sender , msg .value , totalCost);
290
+
291
+ emit AppealContribution (
292
+ _itemID,
293
+ msg .sender ,
294
+ items[_itemID].requests.length - 1 ,
295
+ request.rounds.length - 1 ,
296
+ values[1 ],
297
+ _side
298
+ );
299
+
270
300
if (round.paidFees[uint (_side)] >= totalCost)
271
301
round.hasPaid[uint (_side)] = true ;
272
302
@@ -552,7 +582,7 @@ contract GeneralizedTCR is IArbitrable, IEvidence {
552
582
* @param _amount The amount contributed.
553
583
* @param _totalRequired The total amount required for this side.
554
584
*/
555
- function contribute (Round storage _round , Party _side , address payable _contributor , uint _amount , uint _totalRequired ) internal {
585
+ function contribute (Round storage _round , Party _side , address payable _contributor , uint _amount , uint _totalRequired ) internal returns ( uint ) {
556
586
// Take up to the amount necessary to fund the current round at the current costs.
557
587
uint contribution; // Amount contributed.
558
588
uint remainingETH; // Remaining ETH to send back.
@@ -563,6 +593,8 @@ contract GeneralizedTCR is IArbitrable, IEvidence {
563
593
564
594
// Reimburse leftover ETH.
565
595
_contributor.send (remainingETH); // Deliberate use of send in order to not block the contract in case of reverting fallback.
596
+
597
+ return contribution;
566
598
}
567
599
568
600
/** @dev Execute the ruling of a dispute.
0 commit comments