Platform: Code4rena
Start Date: 20/01/2022
Pot Size: $80,000 USDC
Total HM: 5
Participants: 37
Period: 7 days
Judge: Jack the Pug
Total Solo HM: 1
Id: 76
League: ETH
Rank: 30/37
Findings: 1
Award: $28.93
🌟 Selected for report: 2
🚀 Solo Findings: 0
defsec
For the arithmetic operations that will never over/underflow, using the unchecked directive (Solidity v0.8 has default overflow/underflow checks) can save some gas from the unnecessary internal over/underflow checks.
https://github.com/code-423n4/2022-01-sherlock/blob/main/contracts/SherClaim.sol#L42
None
Consider applying unchecked arithmetic where overflow/underflow is not possible.
defsec
Reading array length at each iteration of the loop takes 6 gas (3 for mload and 3 to place memory_offset) in the stack.
Caching the array length in the stack saves around 3 gas per iteration.
https://github.com/code-423n4/2022-01-sherlock/blob/main/contracts/SherBuy.sol#L186
None
Consider to cache array length.
11.8662 USDC - $11.87
defsec
++i is more gas efficient than i++ in loops forwarding.
https://github.com/code-423n4/2022-01-sherlock/blob/main/contracts/SherBuy.sol#L186
Code Review
It is recommend to use unchecked{++i} and change i declaration to uint256.
#0 - jack-the-pug
2022-03-15T01:09:47Z
Dup #111