getCalculatedFee scales the fee by the token's WETH price, producing a value denominated in WETH. The flash-loan repayment check, however, adds that WETH-scaled fee to startingBalance, which is a raw balance of the borrowed token. The two are only equivalent when the token's price equals 1e18 (i.e. the token is WETH itself).
Likelihood:
Affects every flash loan of any token other than WETH — that is the normal case, not an edge case.
Impact:
For cheap tokens (price below 1e18) the charged fee falls far below the intended 0.3%, leaking protocol revenue. For expensive tokens (price above 1e18) the required repayment becomes larger than 0.3% and can exceed what a legitimate borrower can return, reverting valid loans. The fee is correct only for WETH.
Quote the fee for a high-priced token and observe it diverges from 0.3% of the token amount.
Charge the fee as a percentage of the token amount directly, or collect the fee in WETH consistently with how it is computed.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.