Bid offer maker receives no refund when the offer is partially filled.
When a maker creates a bid offer, they deposit collaterals for purchasing points.
The offer can be partially filled by a seller. When the offer is settled, the maker will receive point tokens on a pro rata basis. For example, Alice creates a bid offer, points
is and amount
is , Alice is required to deposit collateral tokens. If Bob fills the offer with points, then when the offer is settled, Alice will pay collaterals to receive 100e18 point tokens (suppose tokenPerPoint
is ). However, protocol does not refund the remaining collateral tokens to Alice, Alice hence lose the funds.
Please follow the steps to run the PoC:
Change Line 361 as below (this is to fix another issue in the code base: bid offer should be settled by the taker):
Change Line 387 as below (this is to fix another issue in the codebase: maker should receive point token instead of collateral token when the offer is settled):
Run the PoC in PreMarkets.t.sol:
User lose funds if their bid offer is partially settled.
Manual Review
When an bid offer is partially filled, the remaining collateral tokens should be refunded.
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.