In the closeBidTaker
function, there's a potential logical flaw in the control flow. The function first checks if offerInfo.usedPoints > offerInfo.settledPoints
, and only then checks the offerStatus
. This order of operations could lead to unexpected behavior, as the offerStatus
check is nested within the points comparison.
This logical issue could result in incorrect calculation of the collateralFee
. Depending on the offer's status and the points comparison, the wrong branch of code might be executed, leading to an incorrect fee calculation. This could potentially be exploited by malicious actors to manipulate the collateral fees in their favor, or it could simply lead to unintended behavior that disrupts the normal operation of the contract.
In this scenario, if offerInfo.usedPoints <= offerInfo.settledPoints
, the collateralFee
will always be 0, regardless of the offer's status. This could lead to incorrect fee calculations and potential loss of funds.
Reorder the checks to prioritize the offer status before comparing points:
Add explicit handling for all possible combinations of offer status and points comparison to ensure all cases are properly accounted for.
Consider adding additional checks and require statements to validate the state of the offer before proceeding with calculations.
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.