Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use negate(!) rather than == false #138

Open
code423n4 opened this issue Dec 10, 2021 · 0 comments
Open

Use negate(!) rather than == false #138

code423n4 opened this issue Dec 10, 2021 · 0 comments
Labels
bug Something isn't working G (Gas Optimization)

Comments

@code423n4
Copy link
Contributor

Handle

0x0x0x

Vulnerability details

Concept

Negation(!) is a better optimized implementation of applying == false. It requires less gas and also the recommended approach to compute the negation.

In other words: x == false and !x compute the same result, but !x costs less gas.

Scope

./Auction.sol:37:        require(auctionOngoing == false, 'ongoing auction');
./Basket.sol:92:        require(auction.auctionOngoing() == false);
./Basket.sol:109:        require(auction.auctionOngoing() == false);
./Basket.sol:221:            if (auction.auctionOngoing() == false) {
./Basket.sol:259:        require(auction.auctionOngoing() == false);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working G (Gas Optimization)
Projects
None yet
Development

No branches or pull requests

1 participant