The fee is calculated on WETH conversion, and in flashloan it is expected as token
The above behaviour has 2 implications:
a flashloan with a token that has very small value to WETH will have a insignificant fee, that will not be 3% (as the initial state of the contract) from the borrowed amount
a flashloan with a token that has a big value to WETH( let's assume 1 token = 100 WETH) will require a extremely high fee. In this case, if we borrow 1 token, the returned fee is 3 -> valueOfBorrow = (1 * 100) / 1; fee = (100 * 3) / 100 = 3. So, after flashloaning 1 token, the user will have to return 4 tokens( 1amount + 3fee)
Low
Manual
Drop the conversion to WETH, and use following implemention:
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.