OrderBook::amendSellOrder()
functionThe amendSellOrder()
function allows sellers to update the amount, price, and duration of their existing orders. If the new amount is greater than the current amount, the contract will transfer the difference from the seller. If it's less, it refunds the difference to the seller.
However, this function:
Performs a safeTransferFrom without checking if the caller (msg.sender) has:
Sufficient ERC20 allowance given to the contract.
Sufficient token balance to cover the delta.
Violates the Checks-Effects-Interactions
(CEI) pattern by updating storage only after an external token transfer.
Likelihood:
This issue occurs whenever a seller calls amendSellOrder()
without setting allowance or not holding sufficient token balance.
It leads to an immediate revert, potentially confusing the user or breaking integrations.
Malicious sellers may exploit this flow in the future if ERC20 behavior is extended (e.g. with fallback() enabled tokens or non-standard token mechanics).
Impact:
Sellers cannot update their orders without pre-approving allowance off-chain.
Poor UX and degraded protocol reliability.
Violating CEI opens theoretical reentrancy risk if non-standard tokens are allowed in the future.
A user without prior allowance calls amendSellOrder()
:
And if reentrancy was possible (non-ERC20 safe token):
Not exploitable in the current context due to standard ERC20 safety.
But degrades user experience, introduces functionality failure, and violates CEI best practices.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.