code-423n4 / 2021-12-defiprotocol-findings

0 stars 0 forks source link

For uint `> 0` can be replaced with ` != 0` for gas optimization #139

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

0x0x0x

Vulnerability details

Impact

!= 0 is a cheaper operation compared to > 0, when dealing with uint.

Occurrences


./Basket.sol:68:        require(_tokens.length > 0);
./Basket.sol:77:            require(_weights[i] > 0);
./Basket.sol:93:        require(amount > 0);
./Basket.sol:110:        require(amount > 0);
./Basket.sol:292:            require(tokenAmount > 0);
./Factory.sol:53:        require(newBondPercentDiv > 0);