Judge has assessed an item in Issue #903 as 3 risk. The relevant finding follows:
L-2. Use SafeCast Library
Description
Downcasting from uint256/int256 in Solidity does not revert on overflow. This can easily result in undesired exploitation or bugs, since developers usually assume that overflows raise errors. SafeCast restores this intuition by reverting the transaction when such an operation overflows.
Instances
virtualBaseTokenReserves += uint128(netInputAmount - feeAmount - protocolFeeAmount);
virtualNftReserves -= uint128(weightSum);
virtualBaseTokenReserves -= uint128(netOutputAmount + protocolFeeAmount + feeAmount);
virtualNftReserves += uint128(weightSum);
Recommendation
It is better to use safe casting library.
Judge has assessed an item in Issue #903 as 3 risk. The relevant finding follows:
L-2. Use SafeCast Library Description Downcasting from uint256/int256 in Solidity does not revert on overflow. This can easily result in undesired exploitation or bugs, since developers usually assume that overflows raise errors. SafeCast restores this intuition by reverting the transaction when such an operation overflows.
Instances virtualBaseTokenReserves += uint128(netInputAmount - feeAmount - protocolFeeAmount); virtualNftReserves -= uint128(weightSum); virtualBaseTokenReserves -= uint128(netOutputAmount + protocolFeeAmount + feeAmount); virtualNftReserves += uint128(weightSum); Recommendation It is better to use safe casting library.