When ask makers decide to abort their offers, takers who have already accepted the offer can use the abortBidTaker function to claim a refund of the amount they deposited. However, there is an issue with the function incorrectly calculating the deposited amount for the takers:
The deposited amount should be calculated as points in the stock * the value of each point
. However, the function is incorrectly calculates the value of each point as follows:
The current calculation is (stock points * offer points) / offer amount
, which is incorrect. The correct calculation should be (stock points * offer amount) / offer points
. The current incorrect calculation will result in a refund of 0 due to the representation of the offer amount with 18 decimals (amount
in the denominator >> points * offer.points
in the numerator).
The following test demonstrates the issue. To reproduce, copy and paste the test into test/PreMarkets.t.sol
:
Ask takers will receive a refund of 0 if the pre-offer is aborted due to the incorrect refund amount calculation.
Manual Review
Update the calculation of the deposit amount 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.