You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The for loop has no overflow risk of i. Use an unchecked block to save gas.
Proof of Concept
AuraVestedEscrow.sol
100: for (uint256 i = 0; i < _recipient.length; i++) {
ExtraRewardsDistributor.sol
233: for (uint256 i = epochIndex; i < tokenEpochs; i++) {
AuraLocker.sol
174: for (uint256 i = 0; i < rewardTokensLength; i++) {
306: for (uint256 i; i < rewardTokensLength; i++) {
410: for (uint256 i = nextUnlockIndex; i < length; i++) {
664: for (uint256 i = locksLength; i > 0; i--) {
696: for (uint256 i = nextUnlockIndex; i < locks.length; i++) {
726: for (uint256 i = epochIndex + 1; i > 0; i--) {
773: for (uint256 i = 0; i < userRewardsLength; i++) {
AuraClaimZap.sol
143: for (uint256 i = 0; i < rewardContracts.length; i++) {
147: for (uint256 i = 0; i < extraRewardContracts.length; i++) {
151: for (uint256 i = 0; i < tokenRewardContracts.length; i++) {
Recommendation
Use unchecked blocks to avoid overflow checks, or use ++i rather than i++ if you don't use unchecked blocks.
for (uint256 i = 0; i < length; ) {
...
unchecked {
++i;
}
}
The text was updated successfully, but these errors were encountered:
Save gas in for loops by unchecked arithmetic
The for loop has no overflow risk of
i
. Use an unchecked block to save gas.Proof of Concept
Recommendation
Use
unchecked
blocks to avoid overflow checks, or use++i
rather thani++
if you don't use unchecked blocks.The text was updated successfully, but these errors were encountered: