When a user creates a taker on an offer, if instead of aborting their bid taker, they choose to close the bid taker, the user ends up with more money than they initially put in.
There is an error in the calculation of the refund amount, which causes a user to receive the equivalent of the collateral instead of the amount they initially staked for createTaker when they close a bid taker turbo instead of aborting it.
Add the code below to the Test contract PreMarketsTest: PreMarketsTest.t.sol.
Run the command
We get the result
The user can exploit this flaw to drain funds from the capital pool. The higher the collateral level, the more money the user can walk away with compared to what they initially invested.
forge and manul review
The closeBidTaker function should include a check to verify if it is a Turbo offer and disregard the collateral in such cases.
Valid high severity, this allows resellers listing offers via `listOffer/relistOffer` to game the system. Based on the inherent design of Turbo mode not requiring takers making ask offers for the original maker offer to deposit collateral, the wrong refund of collateral to takers even when they did not deposit collateral due to turbo mode during settleAskMaker allows possible draining of pools.
Valid high, for unsettled ask offers by the original maker, the initial remaining maker collateral is already refunded as seen [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L624-L629)
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.