@@ -5,12 +5,9 @@ pragma solidity ^0.8.24;
5
5
// TODO: standard interfaces should be placed in a separated repo (?)
6
6
import {IArbitrableV2, IArbitratorV2} from "../interfaces/IArbitrableV2.sol " ;
7
7
import "../interfaces/IDisputeTemplateRegistry.sol " ;
8
- import "../../libraries/CappedMath.sol " ;
9
8
10
9
/// @title Implementation of the Evidence Standard with Moderated Submissions
11
10
contract ModeratedEvidenceModule is IArbitrableV2 {
12
- using CappedMath for uint256 ;
13
-
14
11
// ************************************* //
15
12
// * Enums / Structs * //
16
13
// ************************************* //
@@ -205,8 +202,8 @@ contract ModeratedEvidenceModule is IArbitrableV2 {
205
202
ArbitratorData storage arbitratorData = arbitratorDataList[arbitratorDataList.length - 1 ];
206
203
207
204
uint256 arbitrationCost = arbitrator.arbitrationCost (arbitratorData.arbitratorExtraData);
208
- uint256 totalCost = arbitrationCost. mulCap ( totalCostMultiplier) / MULTIPLIER_DIVISOR;
209
- uint256 depositRequired = totalCost. mulCap ( initialDepositMultiplier) / MULTIPLIER_DIVISOR;
205
+ uint256 totalCost = (arbitrationCost * totalCostMultiplier) / MULTIPLIER_DIVISOR;
206
+ uint256 depositRequired = (totalCost * initialDepositMultiplier) / MULTIPLIER_DIVISOR;
210
207
211
208
Moderation storage moderation = evidenceData.moderations.push ();
212
209
// Overpaying is allowed.
@@ -245,12 +242,12 @@ contract ModeratedEvidenceModule is IArbitrableV2 {
245
242
ArbitratorData storage arbitratorData = arbitratorDataList[moderation.arbitratorDataID];
246
243
247
244
uint256 arbitrationCost = arbitrator.arbitrationCost (arbitratorData.arbitratorExtraData);
248
- uint256 totalCost = arbitrationCost. mulCap ( totalCostMultiplier) / MULTIPLIER_DIVISOR;
245
+ uint256 totalCost = (arbitrationCost * totalCostMultiplier) / MULTIPLIER_DIVISOR;
249
246
250
247
uint256 opposition = 3 - uint256 (_side);
251
248
uint256 depositRequired = moderation.paidFees[opposition] * 2 ;
252
249
if (depositRequired == 0 ) {
253
- depositRequired = totalCost. mulCap ( initialDepositMultiplier) / MULTIPLIER_DIVISOR;
250
+ depositRequired = (totalCost * initialDepositMultiplier) / MULTIPLIER_DIVISOR;
254
251
} else if (depositRequired > totalCost) {
255
252
depositRequired = totalCost;
256
253
}
@@ -317,7 +314,9 @@ contract ModeratedEvidenceModule is IArbitrableV2 {
317
314
) internal returns (uint256 ) {
318
315
uint256 contribution;
319
316
uint256 remainingETH;
320
- uint256 requiredAmount = _totalRequired.subCap (_moderation.paidFees[uint256 (_side)]);
317
+ uint256 requiredAmount = _moderation.paidFees[uint256 (_side)] >= _totalRequired
318
+ ? 0
319
+ : _totalRequired - _moderation.paidFees[uint256 (_side)];
321
320
(contribution, remainingETH) = calculateContribution (_amount, requiredAmount);
322
321
_moderation.contributions[_contributor][uint256 (_side)] += contribution;
323
322
_moderation.paidFees[uint256 (_side)] += contribution;
0 commit comments