Closed code423n4 closed 2 years ago
OriDabush
removeLiquidity()
In Exchange.sol, in the removeLiquidity() function, you can use unchecked in order to save the gas wasting on overflow checks (you did the needed checks before).
New code suggestion:
unchecked { if (quoteTokenQtyToReturn > internalBalances.quoteTokenReserveQty) { internalBalances.quoteTokenReserveQty = 0; } else { internalBalances.quoteTokenReserveQty -= quoteTokenQtyToReturn; } }
dupe of #177
Handle
OriDabush
Vulnerability details
Exchange.sol (
removeLiquidity()
)In Exchange.sol, in the
removeLiquidity()
function, you can use unchecked in order to save the gas wasting on overflow checks (you did the needed checks before).New code suggestion: