When a user wants to purchase points in a specific marketplace at a price they are willing to pay, they can create a BID Offer. Conversely, users who are ready to sell their points at that price can place an ASK Order. Once the Token Generation Event (TGE) occurs, it is the responsibility of the sellers to fulfill the deal and transfer the points to the buyer. Sellers are motivated to complete the transaction because they have posted collateral when they created the ASK Order, ensuring their commitment to the deal.
In code terms, Takers need to transfer the points token via settleAskTaker() function in DeliveryPlace.sol. Currently takers are not able to call this function due to wrong permission checks.
As correctly stated in the function's NatSpec, the caller must be the stock authority because the TAKER is responsible for settling the transaction. However, the check on line #361 is incorrect: _msgSender() != offerInfo.authority. In this case, offerInfo.authority refers to the MAKER, who is waiting for the TAKER to deliver the points. The logic should ensure that the correct entity (the TAKER) is being validated for the settlement process.
Using the protocol test file, I have added another test case which shows the described issue.
NOTE: need to add the following line: import {MarketPlaceStatus} from "../src/interfaces/ISystemConfig.sol";
This issue is of high severity because it prevents any ASK orders from being settled. As a result, Takers will be unable to complete their transactions, leading to the loss of their collateral. At the same time, Makers will not receive the points tokens they are expecting, which means they will also miss out on the newly airdropped tokens tied to those points. This creates significant financial losses for both Takers and Makers, severely disrupting the functionality of the marketplace.
Manual review, Foundry.
Instead of _msgSender() != offerInfo.authority, the correct check would be _msgSender() != stockInfo.authority.
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.