The settleAskTaker
function should be calleable by the stock authority (Taker) when the TGE has passed an the market is in AskSettling
status or by the owner of the contract otherwise, but currently, this function allows the offer authority (Maker) to settle an Ask Taker order.
When the TGE has passed the market enter the AskSettling
status, in this state, all Ask Maker and all Ask Taker orders can be settled by calling the function settleAskMaker
and settleAskTaker
respectively, base on the code and the natspec documentation of the code, the offer authority
is in charge of settle his own Ask Maker orders by calling the settleAskMaker
function, and the stock authority
should be in charge of settling his Ask Taker orders by calling the settleAskTaker
function, but this last statement is not implemented correctly in the current code.
As you can see in the next code and in its comment, the offerInfo.authority
can settle his ask maker order when the market is in AskSettling
status, if the market is in another state only the owner of the contract can settle an ask maker order.
But in the settleAskMaker
function the stock authority
should be in charge of settling his Ask Taker order when the market is in AskSettling
status, as the comment says, but instead the offer authority is in charge, which is incorrect and should be corrected, so the correct authority has the settlement right over his ask taker order.
To show that the stock authority
is not allowed to settle his own Ask Taker Order, I added this test to the PreMarkets.t.sol contract, as you can see the test revert when it's called by the stock authority
user.
The settleAskTaker
function is being settle by the wrong authority, this allow the maker to be in charge of the settlement instead of the taker who should be the entity in charge of the settlement.
Manual Code Review.
Change the offerInfo.authority
for the stockInfo.authority
in the settleAskTaker
function, so the correct authority is in charge of settle the Ask Taker Order.
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.