The deposit funds when createTaker() is called will be frozen by abortBidTaker() in the PreMarkets.sol.
When createTaker() user calls abortBidTaker(), depositAmount of funds will be frozen or exceed in the PreMarkets.sol(https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L671-L675).
The formula of depositAmount calculation as follow is wrong.
depositAmount = stockInfo.points * preOfferInfo.points / preOfferInfo.amount
Let's analyze the below test code.
After user1 calls abortBidTaker(), user1's userTokenBalanceMap[address][tokenAddress][MakerRefund] is 0. So user1 couldn't withdraw nothing from the contract.
Manual Review
The code in the (https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L671-L675) must be changed as follows.
Valid high severity, due to incorrect computation of `depositAmount` within `abortBidTaker`, when aborting bid offers created by takers, the collateral refund will be completely wrong for the taker, and depending on the difference between the value of `points` and `amount`, it can possibly even round down to zero, causing definite loss of funds. If not, if points were worth less than the collateral, this could instead be used to drain the CapitalPool contract instead.
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.