@@ -6,11 +6,8 @@ import "./interfaces/MTicketProcessor.sol";
66import "./interfaces/MTicketBrokerCore.sol " ;
77import "./MixinContractRegistry.sol " ;
88import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol " ;
9- import "@openzeppelin/contracts/utils/math/SafeMath.sol " ;
109
1110abstract contract MixinTicketBrokerCore is MixinContractRegistry , MReserve , MTicketProcessor , MTicketBrokerCore {
12- using SafeMath for uint256 ;
13-
1411 struct Sender {
1512 uint256 deposit; // Amount of funds deposited
1613 uint256 withdrawRound; // Round that sender can withdraw deposit & reserve
@@ -28,7 +25,7 @@ abstract contract MixinTicketBrokerCore is MixinContractRegistry, MReserve, MTic
2825 // Checks if msg.value is equal to the given deposit and reserve amounts
2926 modifier checkDepositReserveETHValueSplit (uint256 _depositAmount , uint256 _reserveAmount ) {
3027 require (
31- msg .value == _depositAmount. add ( _reserveAmount) ,
28+ msg .value == _depositAmount + _reserveAmount,
3229 "msg.value does not equal sum of deposit amount and reserve amount "
3330 );
3431
@@ -38,7 +35,7 @@ abstract contract MixinTicketBrokerCore is MixinContractRegistry, MReserve, MTic
3835 // Process deposit funding
3936 modifier processDeposit (address _sender , uint256 _amount ) {
4037 Sender storage sender = senders[_sender];
41- sender.deposit = sender.deposit. add ( _amount) ;
38+ sender.deposit += _amount;
4239 if (_isUnlockInProgress (sender)) {
4340 _cancelUnlock (sender, _sender);
4441 }
@@ -136,17 +133,17 @@ abstract contract MixinTicketBrokerCore is MixinContractRegistry, MReserve, MTic
136133 // If ticket face value > sender's deposit then claim from
137134 // the sender's reserve
138135
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 );
142139
143140 sender.deposit = 0 ;
144141 } else {
145142 // If ticket face value <= sender's deposit then only deduct
146143 // from sender's deposit
147144
148145 amountToTransfer = _ticket.faceValue;
149- sender.deposit = sender.deposit. sub ( _ticket.faceValue) ;
146+ sender.deposit -= _ticket.faceValue;
150147 }
151148
152149 if (amountToTransfer > 0 ) {
@@ -176,7 +173,7 @@ abstract contract MixinTicketBrokerCore is MixinContractRegistry, MReserve, MTic
176173 require (! _isUnlockInProgress (sender), "unlock already initiated " );
177174
178175 uint256 currentRound = roundsManager ().currentRound ();
179- sender.withdrawRound = currentRound. add ( unlockPeriod) ;
176+ sender.withdrawRound = currentRound + unlockPeriod;
180177
181178 emit Unlock (msg .sender , currentRound, sender.withdrawRound);
182179 }
@@ -206,7 +203,7 @@ abstract contract MixinTicketBrokerCore is MixinContractRegistry, MReserve, MTic
206203 sender.deposit = 0 ;
207204 clearReserve (msg .sender );
208205
209- withdrawTransfer (payable (msg .sender ), deposit. add ( reserve) );
206+ withdrawTransfer (payable (msg .sender ), deposit + reserve);
210207
211208 emit Withdrawal (msg .sender , deposit, reserve);
212209 }
0 commit comments