/
for_continue_increment.sol
65 lines (51 loc) · 1.6 KB
/
for_continue_increment.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
pragma solidity ^0.8.18;
contract Target{
function positive(uint256 inp) public returns (uint256) {
for (uint256 i; i < 10; ) {
if (inp < 2) {
continue;
}
/* logic */
unchecked {
++i;
}
}
return 0;
}
function negative(uint256 inp) public returns (uint256) {
for (uint256 i; i < 10; ) {
unchecked {
++i;
}
if (inp < 2) {
continue;
}
/* logic */
}
return 0;
}
/*
Hit live on chain: bulkRegister(), bulkWithdraw() https://etherscan.io/address/0xeb9014610d4daC128f9DA00C397Ce9119Ee777F5
Hit from a Sherlock audit: https://github.com/sherlock-audit/2023-02-olympus/blob/main/src/policies/lending/WstethLiquidityVault.sol#L192-L216
function _accumulateExternalRewards() internal override returns (uint256[] memory) {
uint256 numExternalRewards = externalRewardTokens.length;
auraPool.rewardsPool.getReward(address(this), true);
uint256[] memory rewards = new uint256[](numExternalRewards);
for (uint256 i; i < numExternalRewards; ) {
ExternalRewardToken storage rewardToken = externalRewardTokens[i];
uint256 newBalance = ERC20(rewardToken.token).balanceOf(address(this));
// This shouldn't happen but adding a sanity check in case
if (newBalance < rewardToken.lastBalance) {
emit LiquidityVault_ExternalAccumulationError(rewardToken.token);
continue;
}
rewards[i] = newBalance - rewardToken.lastBalance;
rewardToken.lastBalance = newBalance;
unchecked {
++i;
}
}
return rewards;
}
*/
}