code-423n4 / 2022-06-putty-findings

5 stars 0 forks source link

Gas Optimizations #351

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago
  1. https://github.com/code-423n4/2022-06-putty/blob/3b6b844bc39e897bd0bbb69897f2deff12dc3893/contracts/src/PuttyV2.sol#L316 could use unchecked for calculation since overflow is impossible
  2. https://github.com/code-423n4/2022-06-putty/blob/3b6b844bc39e897bd0bbb69897f2deff12dc3893/contracts/src/PuttyV2.sol#L503 could use unchecked as underflow is impossible since feeAmount is lower than order.strike
  3. For all for loops, consider using this pattern for(uint256 i = 0; i < arr.length; ){ ... do something; unchecked{++i} }