Use the compared expression itself in place of comparison with a boolean literal.
The expression can be replaced as is when the expression is expected to evaluate to true and negation can be used when the expression is expected to have a false value.
Handle
ye0lde
Vulnerability details
Impact
Gas savings and code clarity
Proof of Concept
Below are several occurrences of comparison with literal boolean values of true or false: https://github.com/code-423n4/2021-12-defiprotocol/blob/205d3766044171e325df6a8bf2e79b37856eece1/contracts/contracts/Auction.sol#L37
https://github.com/code-423n4/2021-12-defiprotocol/blob/205d3766044171e325df6a8bf2e79b37856eece1/contracts/contracts/Basket.sol#L92 https://github.com/code-423n4/2021-12-defiprotocol/blob/205d3766044171e325df6a8bf2e79b37856eece1/contracts/contracts/Basket.sol#L259
Tools Used
Visual Studio Code, Remix
Recommended Mitigation Steps
Use the compared expression itself in place of comparison with a boolean literal. The expression can be replaced as is when the expression is expected to evaluate to true and negation can be used when the expression is expected to have a false value.