The DeliveryPlace contract's closeBidTaker
function will always to fail for all stocks created directly from offers due to an incorrect assumption about the preOffer
field. This renders the function unusable for a significant portion of potential use cases, effectively locking users out of closing their bid positions. When a user attempts to close a bid taker position using closeBidTaker, the function first retrieves the stock information. For directly created offers, the stockInfo.preOffer is address(0x0). The function immediately reverts due to the InvalidStock check, preventing any further execution. This occurs regardless of the offer's validity or the user's authorization to close the position.
https://github.com/Cyfrin/2024-08-tadle/blob/main/src/core/PreMarkets.sol#L295
In the offer creation process, stocks are created with their preOffer field set to address(0x0).
The closeBidTaker function in the DeliveryPlace contract contains the following check:
This check assumes that all valid stocks must have a non-zero preOffer address, which contradicts how stocks are initially created.
Proof Of Code
Run
Users are unable to close bid taker positions for directly created offers.
It could lead to an accumulation of "zombie" offers that can't be closed or settled.
Manual code review
Modify the closeBidTaker
function to handle stocks with preOffer
set to address(0x0)
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.