@@ -6,11 +6,8 @@ import "./interfaces/MTicketProcessor.sol";
6
6
import "./interfaces/MTicketBrokerCore.sol " ;
7
7
import "./MixinContractRegistry.sol " ;
8
8
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol " ;
9
- import "@openzeppelin/contracts/utils/math/SafeMath.sol " ;
10
9
11
10
abstract contract MixinTicketBrokerCore is MixinContractRegistry , MReserve , MTicketProcessor , MTicketBrokerCore {
12
- using SafeMath for uint256 ;
13
-
14
11
struct Sender {
15
12
uint256 deposit; // Amount of funds deposited
16
13
uint256 withdrawRound; // Round that sender can withdraw deposit & reserve
@@ -28,7 +25,7 @@ abstract contract MixinTicketBrokerCore is MixinContractRegistry, MReserve, MTic
28
25
// Checks if msg.value is equal to the given deposit and reserve amounts
29
26
modifier checkDepositReserveETHValueSplit (uint256 _depositAmount , uint256 _reserveAmount ) {
30
27
require (
31
- msg .value == _depositAmount. add ( _reserveAmount) ,
28
+ msg .value == _depositAmount + _reserveAmount,
32
29
"msg.value does not equal sum of deposit amount and reserve amount "
33
30
);
34
31
@@ -38,7 +35,7 @@ abstract contract MixinTicketBrokerCore is MixinContractRegistry, MReserve, MTic
38
35
// Process deposit funding
39
36
modifier processDeposit (address _sender , uint256 _amount ) {
40
37
Sender storage sender = senders[_sender];
41
- sender.deposit = sender.deposit. add ( _amount) ;
38
+ sender.deposit += _amount;
42
39
if (_isUnlockInProgress (sender)) {
43
40
_cancelUnlock (sender, _sender);
44
41
}
@@ -136,17 +133,17 @@ abstract contract MixinTicketBrokerCore is MixinContractRegistry, MReserve, MTic
136
133
// If ticket face value > sender's deposit then claim from
137
134
// the sender's reserve
138
135
139
- amountToTransfer = sender.deposit. add (
140
- claimFromReserve (_ticket. sender, _ticket.recipient, _ticket.faceValue. sub (sender. deposit))
141
- );
136
+ amountToTransfer =
137
+ sender. deposit +
138
+ claimFromReserve (_ticket.sender, _ticket.recipient, _ticket.faceValue - sender.deposit );
142
139
143
140
sender.deposit = 0 ;
144
141
} else {
145
142
// If ticket face value <= sender's deposit then only deduct
146
143
// from sender's deposit
147
144
148
145
amountToTransfer = _ticket.faceValue;
149
- sender.deposit = sender.deposit. sub ( _ticket.faceValue) ;
146
+ sender.deposit -= _ticket.faceValue;
150
147
}
151
148
152
149
if (amountToTransfer > 0 ) {
@@ -176,7 +173,7 @@ abstract contract MixinTicketBrokerCore is MixinContractRegistry, MReserve, MTic
176
173
require (! _isUnlockInProgress (sender), "unlock already initiated " );
177
174
178
175
uint256 currentRound = roundsManager ().currentRound ();
179
- sender.withdrawRound = currentRound. add ( unlockPeriod) ;
176
+ sender.withdrawRound = currentRound + unlockPeriod;
180
177
181
178
emit Unlock (msg .sender , currentRound, sender.withdrawRound);
182
179
}
@@ -206,7 +203,7 @@ abstract contract MixinTicketBrokerCore is MixinContractRegistry, MReserve, MTic
206
203
sender.deposit = 0 ;
207
204
clearReserve (msg .sender );
208
205
209
- withdrawTransfer (payable (msg .sender ), deposit. add ( reserve) );
206
+ withdrawTransfer (payable (msg .sender ), deposit + reserve);
210
207
211
208
emit Withdrawal (msg .sender , deposit, reserve);
212
209
}
0 commit comments