The function DeliveryPlace::settleAskTaker()
is supposed to be called by the Taker
who has placed an Ask Order
; however, the caller validation specifies it to be called by the offerInfo.authority
in the normal case (if (status == MarketPlaceStatus.AskSettling)
), which is referring to the Maker
of the Bid Offer
but not the Taker
. Thus, the caller validation used is totally wrong.
The impacted lines of code are these.
Quoted here:
Instead of offerInfo.authority
, it should use stockInfo.authority
.
Even in the Line#329, the dev himself wrote:
With this flipped caller of the function, this function will be totally messed up. The intended settlement will never work, because the caller Maker
is actually the buyer side of the trade and he does not have any required token to settle. This trade goes to the direction of collateral liquidation even though the real Taker
may actually have the willingness and capability to deliver the settlement in a good way. This issue is absolutely H severity.
Manual Review
Revise the buggy code
to this code
Valid high severity, when taker offers are created pointing to a `offer`, the relevant `stockInfoMap` offers are created with the owner of the offer aka `authority`, set as the creater of the offer, as seen [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L245). Because of the wrong check within settleAskTaker, it will permanently DoS the final settlement functionality for taker offers for the maker that listed the original offer, essentially bricking the whole functionality of the market i.e. maker will always get refunded the original collateral, and takers will never be able to transact the original points put up by the maker. This occurs regardless of market mode.
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.