Bid/buy offer owner receives full collateralToken along with pointsToken while settling askTaker using settleAskTaker() due to wrong calculation of collateralFee as it doesn't take account of settledPoint
A user/seller can settle his askTaker using deliveryPlace:settleAskTaker(), passing the amount of _settledPoints which he wanted to settle. Now if _settledPoints are not equal to stockInfo.points then bider/buyer receives the makerRefund.
Now the problem is, when calculating makerRefund it doesn't take account of _settledPoints, which means if seller settles 0 point or even 1 point less than stockInfo.points then buyer will receives the full collateralToken back along with pointsToken which seller settled.
Suppose a user bid offer for 1000 points at 1000e18 collateralToken. A seller created ask taker for 1000 points. Now seller failed to settle askTaker for 1000 points, instead he settles it for 500 points. Now buyer should get 500e18 collateralToken back along with 500 pointsToken. But buyer receives full 1000e18 collateralToken along with 500 pointsToken.
//Here is PoC which shows the above situations
Note: settleAskTaker() has owner verification issue as it checks msg.sender with offerInfo.authority instead of stockInfo.authority, fix it. Also while adding pointsToken to buyer address, it uses collateralToken address instead of pointsToken address, fix it also. I've submitted both issue separately.
Buyer receives full collateralAmount if seller fails to settle full points
Manual Review
Consider taking _settledPoints into account while calculating makerRefund for buyer
Valid High, afaik, partial settlements are a valid flow and so when closing bid offers by takers and/or when settling offers by makers, we should return a proportionate amount of funds based on points settled. This issues could be related to issue #1008, but seems to be describing a different issue.
Valid high, in settleAskTaker/settleAskMaker, if the original offer maker performs a partial final settlement, the existing checks [here](https://github.com/Cyfrin/2024-08-tadle/blob/main/src/core/DeliveryPlace.sol#L356-L358) and [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/DeliveryPlace.sol#L230-L232) will cause an revert when attempting to complete a full settlement, resulting in their collateral being locked and requiring a rescue from the admin. To note, although examples in the documentation implies settlement in a single click, it is not stated that partial settlements are not allowed, so I believe it is a valid user flow.
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.