Skip to content

Commit cc1b358

Browse files
committed
minor optimizations
1 parent 2526290 commit cc1b358

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

contracts/modules/TransferManager/VRTM/VolumeRestrictionTM.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ contract VolumeRestrictionTM is VolumeRestrictionTMStorage, TransferManager {
992992
// allowedAmount, because of this if another transaction is performed it get reverted if we directly rely
993993
// on the SafeMath sub method. So to avoid revert here we are first checking whether the substration is valid or
994994
// not if not then return 0 as allowed amount otherwise the actual value of allowed amount.
995-
return _sumOfLastPeriod >_allowedAmount ? 0 : _allowedAmount.sub(_sumOfLastPeriod);
995+
return _sumOfLastPeriod >_allowedAmount ? 0 : _allowedAmount - _sumOfLastPeriod;
996996
}
997997

998998
function _updateStorage(
@@ -1124,7 +1124,7 @@ contract VolumeRestrictionTM is VolumeRestrictionTMStorage, TransferManager {
11241124
else if (allowedAmountToTransact == 0)
11251125
return currentBalance;
11261126
else
1127-
return (currentBalance.sub(allowedAmountToTransact));
1127+
return currentBalance > allowedAmountToTransact ? currentBalance - allowedAmountToTransact : 0;
11281128
}
11291129
else if (_partition == UNLOCKED) {
11301130
if (allowedAmountToTransact == 0 && fromTimestamp == 0 && dailyTime == 0)

0 commit comments

Comments
 (0)