Closed code423n4 closed 2 years ago
PPrieditis
TimeswapPair.pay(...) is using ids.length twice in a require statement and also in a loop. Caching would save storage reads.
Use a local variable in place of ids.length for lines: 1) https://github.com/code-423n4/2022-01-timeswap/blob/5960e07d39f2b4a60cfabde1bd51f4b1e62e7e85/Timeswap/Timeswap-V1-Core/contracts/TimeswapPair.sol#L351 2) https://github.com/code-423n4/2022-01-timeswap/blob/5960e07d39f2b4a60cfabde1bd51f4b1e62e7e85/Timeswap/Timeswap-V1-Core/contracts/TimeswapPair.sol#L359
Similar issue reported over here #151 and hence closing this
Handle
PPrieditis
Vulnerability details
Impact
TimeswapPair.pay(...) is using ids.length twice in a require statement and also in a loop. Caching would save storage reads.
Recommended Mitigation Steps
Use a local variable in place of ids.length for lines: 1) https://github.com/code-423n4/2022-01-timeswap/blob/5960e07d39f2b4a60cfabde1bd51f4b1e62e7e85/Timeswap/Timeswap-V1-Core/contracts/TimeswapPair.sol#L351 2) https://github.com/code-423n4/2022-01-timeswap/blob/5960e07d39f2b4a60cfabde1bd51f4b1e62e7e85/Timeswap/Timeswap-V1-Core/contracts/TimeswapPair.sol#L359