Skip to content

Commit

Permalink
Added some unchecked scopes in safe places
Browse files Browse the repository at this point in the history
  • Loading branch information
asselstine committed Oct 14, 2021
1 parent 293e224 commit 100180f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion contracts/libraries/TwabLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ library TwabLib {
require(_accountDetails.balance >= _amount, _revertMessage);

(accountDetails, twab, isNew) = _nextTwab(_account.twabs, _accountDetails, _currentTime);
accountDetails.balance = _accountDetails.balance - _amount;
unchecked {
accountDetails.balance = _accountDetails.balance - _amount;
}
}

/** @notice Calculates the average balance held by a user for a given time frame.
Expand Down
5 changes: 4 additions & 1 deletion contracts/prize-strategy/PrizeSplit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ abstract contract PrizeSplit is IPrizeSplit, Ownable {

// Remove old prize splits configs. Match storage _prizesSplits.length with the passed newPrizeSplits.length
while (_prizeSplits.length > newPrizeSplitsLength) {
uint256 _index = _prizeSplits.length - 1;
uint256 _index;
unchecked {
_index = _prizeSplits.length - 1;
}
_prizeSplits.pop();
emit PrizeSplitRemoved(_index);
}
Expand Down

0 comments on commit 100180f

Please sign in to comment.