Closed code423n4 closed 2 years ago
ye0lde
Gas savings
"> 0" is used in the following locations: https://github.com/code-423n4/2022-01-timeswap/blob/bf50d2a8bb93a5571f35f96bd74af54d9c92a210/Timeswap/Timeswap-V1-Convenience/contracts/libraries/SquareRoot.sol#L21 https://github.com/code-423n4/2022-01-timeswap/blob/bf50d2a8bb93a5571f35f96bd74af54d9c92a210/Timeswap/Timeswap-V1-Convenience/contracts/libraries/PayMath.sol#L27
Visual Studio Code, Remix
Change "> 0" to "!=0" for small gas savings.
Similar issue reported over here #172; hence closing this.
Handle
ye0lde
Vulnerability details
Impact
Gas savings
Proof of Concept
"> 0" is used in the following locations: https://github.com/code-423n4/2022-01-timeswap/blob/bf50d2a8bb93a5571f35f96bd74af54d9c92a210/Timeswap/Timeswap-V1-Convenience/contracts/libraries/SquareRoot.sol#L21 https://github.com/code-423n4/2022-01-timeswap/blob/bf50d2a8bb93a5571f35f96bd74af54d9c92a210/Timeswap/Timeswap-V1-Convenience/contracts/libraries/PayMath.sol#L27
Tools Used
Visual Studio Code, Remix
Recommended Mitigation Steps
Change "> 0" to "!=0" for small gas savings.