code-423n4 / 2022-01-elasticswap-findings

1 stars 0 forks source link

Use != 0 instead of > 0 for Unsigned Integer Comparison #98

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

byterocket

Vulnerability details

Impact

Issue Information: G003

Findings:

contracts/Exchange.sol::113 => if (tokenQtys.liquidityTokenFeeQty > 0) {
contracts/Exchange.sol::176 => require(this.totalSupply() > 0, "Exchange: INSUFFICIENT_LIQUIDITY");
contracts/Exchange.sol::178 => _baseTokenQtyMin > 0 && _quoteTokenQtyMin > 0,
contracts/Exchange.sol::235 => if (liquidityTokenFeeQty > 0) {
contracts/Exchange.sol::267 => _baseTokenQty > 0 && _minQuoteTokenQty > 0,
contracts/Exchange.sol::304 => _quoteTokenQty > 0 && _minBaseTokenQty > 0,
libraries/MathLib.sol::125 => require(_tokenAQty > 0, "MathLib: INSUFFICIENT_QTY");
libraries/MathLib.sol::127 => _tokenAReserveQty > 0 && _tokenBReserveQty > 0,
libraries/MathLib.sol::266 => baseTokenQtyDecayChange > 0,
libraries/MathLib.sol::336 => quoteTokenQtyDecayChange > 0,
libraries/MathLib.sol::347 => require(quoteTokenDecay > 0, "MathLib: NO_QUOTE_DECAY");
libraries/MathLib.sol::388 => if (_totalSupplyOfLiquidityTokens > 0) {
libraries/MathLib.sol::496 => _baseTokenQtyDesired > 0,
libraries/MathLib.sol::500 => _quoteTokenQtyDesired > 0,
libraries/MathLib.sol::606 => _baseTokenReserveQty > 0 &&
libraries/MathLib.sol::607 => _internalBalances.baseTokenReserveQty > 0,
libraries/MathLib.sol::664 => _baseTokenQty > 0 && _quoteTokenQtyMin > 0,

Tools used

c4udit

0xean commented 2 years ago

dupe of #161