The function getInputAmountBasedOnOutput
in the TSwapPool contract incorrectly uses a scaling factor of 10000
instead of 1000
when calculating fees. This results in users being charged an excessively high fee.
Wrong scaling factor of 10000
being used in fee calculation.
Add this function in TSwapPool.t.sol
Actual input token amount is more than expected implying an extra fee of more than 0.3% being charged on user
The incorrect scaling factor results in users being charged a fee approximately 10 times higher than intended. This can lead to significant financial losses for users, as they received much lesser token than expected. This discrepancy can reduce trust in the protocol.
Manual review
Replace the magic numbers with defined constants to ensure the fee calculations are correct and consistent.
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.