Platform: Code4rena
Start Date: 26/05/2022
Pot Size: $75,000 USDT
Total HM: 31
Participants: 71
Period: 7 days
Judge: GalloDaSballo
Total Solo HM: 18
Id: 126
League: ETH
Rank: 71/71
Findings: 1
Award: $52.07
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: IllIllI
Also found by: 0x1f8b, 0x29A, 0xKitsune, 0xNazgul, 0xf15ers, 0xkatana, Cityscape, Dravee, ElKu, FSchmoede, Funen, GalloDaSballo, Hawkeye, Kaiziron, MiloTruck, Randyyy, RoiEvenHaim, Ruhum, SecureZeroX, SmartSek, TerrierLover, TomJ, Tomio, WatchPug, Waze, _Adam, asutorufos, c3phas, catchup, cogitoergosumsw, delfin454000, ellahi, fatherOfBlocks, gzeon, hansfriese, horsefacts, jonatascm, minhquanym, oyc_109, pauliax, reassor, robee, sach1r0, saian, sashik_eth, simon135, z3s
52.0655 USDT - $52.07
object
++ cost more then ++object
. (same for --)
object
+ 1 cost more then ++object
.
The default value of uint is 0. So there is no need to set false at index
variable.
uint256 index = 0 cost more then uint256 index.
The default value of bool is false. So there is no need to set false at assigned
variable.
bool assigned = false cost more then bool assigned.
lines 65 - 72 uint256 public periodFinish = 0; uint256 public rewardRate = 0; uint256 public queuedRewards = 0; uint256 public currentRewards = 0; uint256 public historicalRewards = 0;
fix - uint256 public periodFinish; uint256 public rewardRate; uint256 public queuedRewards; uint256 public currentRewards; uint256 public historicalRewards;
line 176 - for (uint256 i = 0; i < extraRewards.length; i++) { IRewards(extraRewards[i]).stake(msg.sender, _amount); }
fix - for (uint256 i; i < extraRewards.length; ++i) { IRewards(extraRewards[i]).stake(msg.sender, _amount); }
line 196 - for (uint256 i = 0; i < extraRewards.length; i++) { IRewards(extraRewards[i]).stake(_for, _amount); }
fix - for (uint256 i; i < extraRewards.length; ++i) { IRewards(extraRewards[i]).stake(_for, _amount); }
line 218 - for (uint256 i = 0; i < extraRewards.length; i++) { IRewards(extraRewards[i]).withdraw(msg.sender, amount); }
fix - for (uint256 i; i < extraRewards.length; ++i) { IRewards(extraRewards[i]).withdraw(msg.sender, amount); }
line 245 - for (uint256 i = 0; i < extraRewards.length; i++) { IRewards(extraRewards[i]).withdraw(msg.sender, amount); }
fix - for (uint256 i; i < extraRewards.length; ++i) { IRewards(extraRewards[i]).withdraw(msg.sender, amount); }
line 282 - for (uint256 i = 0; i < extraRewards.length; i++) { IRewards(extraRewards[i]).getReward(_account); }
fix - for (uint256 i; i < extraRewards.length; ++i) { IRewards(extraRewards[i]).getReward(_account); }
line 329 - for (uint256 i = 0; i < poolInfo.length; i++) { PoolInfo storage pool = poolInfo[i]; if (pool.shutdown) continue;
fix - for (uint256 i; i < poolInfo.length; ++i) { PoolInfo storage pool = poolInfo[i]; if (pool.shutdown) continue;
line 29 - uint256 public historicalRewards = 0;
fix - uint256 public historicalRewards;
line 71 - for (uint256 i = 0; i < length; i++) { balances[i] = IERC20(tokenInfo[i].token).balanceOf(staker); }
fix - for (uint256 i; i < length; ++i) { balances[i] = IERC20(tokenInfo[i].token).balanceOf(staker); }
line 78 - for (uint256 i = 0; i < length; i++) { address token = tokenInfo[i].token; uint256 newbalance = IERC20(token).balanceOf(staker); //stash if balance increased
fix - for (uint256 i; i < length; ++i) { address token = tokenInfo[i].token; uint256 newbalance = IERC20(token).balanceOf(staker); //stash if balance increased
line 137 - for (uint256 i = 0; i < maxRewards; i++) { address token = IGauge(gauge).reward_tokens(i);
fix - for (uint256 i; i < maxRewards; ++i) { address token = IGauge(gauge).reward_tokens(i);
line 140 - for (uint256 x = i; x < tokenCount; x++) { IRewardFactory(rewardFactory).removeActiveReward(tokenInfo[x].token, pid);
fix - for (uint256 x = i; x < tokenCount; ++x) { IRewardFactory(rewardFactory).removeActiveReward(tokenInfo[x].token, pid);
line 181 - for (uint256 i = 0; i < tokenCount; i++) { TokenInfo storage t = tokenInfo[i]; address token = t.token;
fix - for (uint256 i; i < tokenCount; ++i) { TokenInfo storage t = tokenInfo[i]; address token = t.token;
line 213 - for (uint256 i = 0; i < tokenCount; i++) { TokenInfo storage t = tokenInfo[i]; address token = t.token;
fix - for (uint256 i; i < tokenCount; ++i) { TokenInfo storage t = tokenInfo[i]; address token = t.token;
line 84 - for (uint256 i = 0; i < maxRewards; i++) { address token = IGauge(gauge).reward_tokens(i);
fix - for (uint256 i; i < maxRewards; ++i) { address token = IGauge(gauge).reward_tokens(i);
line 126 - for (uint256 i = 0; i < tokenCount; i++) { TokenInfo storage t = tokenInfo[i]; address token = t.token;
fix - for (uint256 i; i < tokenCount; ++i) { TokenInfo storage t = tokenInfo[i]; address token = t.token;
line 46 - uint256 pid = _pid + 1;
fix - uint256 pid = ++_pid;
line 49 - for (uint256 i = 0; i < length; i++) { if (activeList[i] == pid) return true; }
fix - for (uint256 i; i < length; ++i) { if (activeList[i] == pid) return true; }
line 63 - uint256 pid = _pid + 1;
fix - uint256 pid = ++_pid;
line 66 - for (uint256 i = 0; i < length; i++) {
fix - for (uint256 i; i < length; ++i) {
line 106 - bool public isShutdown = false;
fix - bool public isShutdown;
line 286 - for (uint256 i = 0; i < userRewards.length; i++) { address token = rewardTokens[i]; userRewards[i].token = token; userRewards[i].amount = _earned(_account, token, userBalance.locked); } return userRewards; }
fix - for (uint256 i; i < userRewards.length; ++i) { address token = rewardTokens[i]; userRewards[i].token = token; userRewards[i].amount = _earned(_account, token, userBalance.locked); } return userRewards; }
lines 315,360,387,406, - for (uint256 i = locks.length - 1; i + 1 != 0; i--) {
fix - for (uint256 i = locks.length - 1; ++i != 0; -- i) {
line 420 - uint256 min = 0;
fix - uint256 min;
line 425 - for (uint256 i = 0; i < 128; i++) {
fix - for (uint256 i; i < 128; ++i) {
line 463 - idx++;
line 463 - ++idx;
line 613 - uint256 reward;
fix - uint256 reward;
line 665 - nextUnlockIndex++;
fix - ++nextUnlockIndex;
line 720 - for (uint256 i; i < rewardTokens.length; i++) {
fix - for (uint256 i; i < rewardTokens.length; ++i) {
line 803 - for (uint256 i = 0; i < rewardTokens.length; i++) {
fix - for (uint256 i; i < rewardTokens.length; ++i) {
line 148 - for (uint256 i = 0; i < rewardTokens.length(); i++)
fix - for (uint256 i; i < rewardTokens.length(); ++i)
line 214,238,257,326 - for (uint256 i = 0; i < length; i++)
fix - for (uint256 i; i < length; ++i)
line 281 - for (uint256 i = 0; i < rewardTokens.length(); i++)
fix - for (uint256 i; i < rewardTokens.length(); ++i)
line 28 - uint256 public incentiveVeAsset = 0;
fix - uint256 public incentiveVeAsset;
line 74,75,78,79,80 - uint256 public periodFinish = 0; uint256 public rewardRate = 0; uint256 public queuedRewards = 0; uint256 public currentRewards = 0; uint256 public historicalRewards = 0;
fix - uint256 public periodFinish; uint256 public rewardRate; uint256 public queuedRewards; uint256 public currentRewards; uint256 public historicalRewards;
line 217 - for (uint256 i = 0; i < _tokenVote.length; i++)
fix - for (uint256 i; i < _tokenVote.length; ++i)
line 227 - uint256 _balance = 0;
fix - uint256 _balance;
#0 - GalloDaSballo
2022-07-18T23:26:49Z
Saves less than 500 gas