slither
slither copied to clipboard
[Bug-Candidate]: dangerous-strict-equalities does not consider "or" or "else"
Describe the issue:
dangerous-strict-equalities
Does not consider "else" statements or "or" statements:
Code example to reproduce the issue:
function _safeTransfer(address token, address to, uint256 value) private {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'SomaSwap: TRANSFER_FAILED');
}
if (_totalSupply == 0) {
liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
// Here we mint to the factory instead of self, because the burn requires burning all of tokens on self
_mint(factory, MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
} else {
liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
}
Version:
0.8.3
Relevant log output:
SomaSwapPair._safeTransfer(address,address,uint256) (contracts/soma/SomaSwap/core/SomaSwapPair.sol#110-113) uses a dangerous strict equality:
- require(bool,string)(success && (data.length == 0 || abi.decode(data,(bool))),SomaSwap: TRANSFER_FAILED) (contracts/soma/SomaSwap/core/SomaSwapPair.sol#112)
SomaSwapPair.mint(address) (contracts/soma/SomaSwap/core/SomaSwapPair.sol#154-176) uses a dangerous strict equality:
- _totalSupply == 0 (contracts/soma/SomaSwap/core/SomaSwapPair.sol#163)