User receive pointsToken as well his collateralToken back when he close his bidTaker ie deliveryPlace:closeBidTaker() due to wrong calculation of userCollateralFee in closeBidTaker()
Buyer receives pointsToken when they close their bidTaker using deliveryPlace:closeBidTaker(). If offerOwner settled the offer with less settledPoints than offerInfo.usedPoints then buyer receives the remainingCash ie collateralToken
Now the problem is with the calculation of userCollateralFee. As result, user receives the pointsToken as well all his collateralToken back
//Here is how this works(simple example)
Suppose a user1 created an ask offer using createOffer() for 1000 points with 1000e18 amount(collateralToken) at 10000(100%) collateralRate, which means user1 will pay 1000e18 collateralToken to capitalPool
User2 bought all 1000 points paying 1000e18(buyAmount) + tradeTax + platformFee
Owner updated the marketPlace with tokenPerPoints = 1e18
User1 settled the offer using settleAskMaker() with only 500 settledPoints instead of 1000 settledPoints
User2 close his bidTaker using closeBidTaker(), which calculates the remainingCash because settledPoints are less than usedPoints
User2 should receive 500 pointsToken(500 settlePoints * 1e18 tokenPerPoints) & 500e18 collateralToken as remainingCash because he got only half of the pointsToken ie 500 pointsToken instead of 1000 pointsToken.
But user2 receives full 1000e18 collateralToken(which he paid to buy 1000 points) along with 500 pointsToken
//Here is coded PoC, which clearly shows above situation
Buyer receives full collateralToken as well as pointsToken
Manual Review
Rewrite the userCollateralFee which should consider the pointsToken that buyer received & subtract the equivalent amount of collateralToken from the buyer's amount
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.