In calculateAmountsFromFee, there is no validation to ensure the totalAmount is large enough to accommodate the fee. If fee is high or totalAmount is too low, it’s possible for feeAmount to equal or exceed totalAmount, leading to a netAmount of zero or even an underflow.
If the feeAmount equals or exceeds the totalAmount, the function may return unexpected results (e.g., a zero or negative net amount).
Add a validation to ensure totalAmount is sufficient to cover feeAmount. Alternatively, you could add logic to prevent cases where fee exceeds certain limits relative to totalAmount.
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.