Skip to content

Commit 8d87605

Browse files
committed
optimize the code
1 parent 4c43cf5 commit 8d87605

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

contracts/libraries/VolumeRestrictionLib.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ library VolumeRestrictionLib {
8282
// if restriction is to check whether the current transaction is performed within the 24 hours
8383
// span after the last transaction performed by the user
8484
if (BokkyPooBahsDateTimeLibrary.diffSeconds(_lastTradedTimestamp, now) < 86400) {
85-
(uint256 lastTxYear, uint256 lastTxMonth, uint256 lastTxDay) = BokkyPooBahsDateTimeLibrary.timestampToDate(_lastTradedTimestamp);
86-
(uint256 currentTxYear, uint256 currentTxMonth, uint256 currentTxDay) = BokkyPooBahsDateTimeLibrary.timestampToDate(now);
85+
(,, uint256 lastTxDay) = BokkyPooBahsDateTimeLibrary.timestampToDate(_lastTradedTimestamp);
86+
(,, uint256 currentTxDay) = BokkyPooBahsDateTimeLibrary.timestampToDate(now);
8787
// This if statement is to check whether the last transaction timestamp (of `individualRestriction[_from]`
8888
// when `_isDefault` is true or defaultRestriction when `_isDefault` is false) is comes within the same day of the current
8989
// transaction timestamp or not.
90-
if (lastTxYear == currentTxYear && lastTxMonth == currentTxMonth && lastTxDay == currentTxDay) {
90+
if (lastTxDay == currentTxDay) {
9191
// Not allow to transact more than the current transaction restriction allowed amount
9292
if ((_sumOfLastPeriod.add(_amount)).add(_amountTradedLastDay) > _allowedAmount)
9393
return false;

0 commit comments

Comments
 (0)