Because the abortBidTaker function calculates depositAmount incorrectly, the accounting for the token amount to be refunded to the corresponding stock's authority becomes incorrect. For instance, when the calculated depositAmount is incorrectly lower than what it should be, the token amount refunded to the corresponding stock's authority would be incorrectly lower than what he is entitled to.
The following abortBidTaker function executes uint256 depositAmount = stockInfo.points.mulDiv(preOfferInfo.points, preOfferInfo.amount, Math.Rounding.Floor), which is equivalent to depositAmount = stockInfo.points * preOfferInfo.points / preOfferInfo.amount in mathematic expression. However, since such mathematic expression does not result in a portion of preOfferInfo.amount, the calculated depositAmount does not make sense and is incorrect. Because the OfferLibraries.getDepositAmount function call uses the incorrect depositAmount to calculate transferAmount, such transferAmount is also incorrect. When the tokenManager.addTokenBalance function is called with the incorrect transferAmount for TokenBalanceType.MakerRefund, the accounting for the token amount to be refunded to the corresponding stock's authority becomes incorrect as well.
The token amount to be refunded to the corresponding stock's authority is incorrect when the abortBidTaker function is called. For example, when the calculated depositAmount is incorrectly lower than what it should be, the token amount refunded to the corresponding stock's authority would be incorrectly lower than what he is entitled to.
Manual Review
The calculation of depositAmount in the abortBidTaker function needs to be corrected in which the correct depositAmount would be a portion of preOfferInfo.amount.
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.