incorrect calculation of remaining amount
When the offer status is Virgin, the calculation is correct: the remaining amount is the full offer amount.
However, when the offer status is not Virgin (which in this case would be Canceled), the calculation is incorrect.
The current calculation for the non-Virgin case is:
remainingAmount = offerInfo.amount * (usedPoints / points)
This is wrong because it calculates the amount that has been used, not the amount remaining
To calculate the remaining amount correctly, we need to subtract the used amount from the total amount. The correct calculation should be:
remainingAmount = offerInfo.amount.mulDiv(
offerInfo.points - offerInfo.usedPoints,
offerInfo.points,
Math.Rounding.Floor
);
incorrect calculation of remaining amount
Manual Review
remainingAmount = offerInfo.amount.mulDiv(
offerInfo.points - offerInfo.usedPoints,
offerInfo.points,
Math.Rounding.Floor
);
Valid high, for cancelled offers, the unused collateral should be returned back to the maker. The `remainingAmount` is calculated wrongly with regards to usedPoints instead of unused points. Note: See comments under 826 and 907 for invalidation reasons
Valid high, for cancelled offers, the unused collateral should be returned back to the maker. The `remainingAmount` is calculated wrongly with regards to usedPoints instead of unused points. Note: See comments under 826 and 907 for invalidation reasons
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.