repay Function Creates Confusion and Gas InefficiencyThe ThunderLoan contract includes a repay function that allows flash loan borrowers to repay their loans. However, this function is unnecessary because the flashloan function already checks the balance after the callback to ensure repayment.
Borrowers can simply transfer tokens back to the AssetToken contract without calling repay. The repay function adds no value and creates confusion about the correct way to repay flash loans.
The flashloan function checks the balance regardless of how tokens are repaid:
Likelihood:
Affects all flash loan integrators who study the interface
Creates confusion about intended repayment method
Gas inefficiency occurs whenever repay is used instead of direct transfer
Impact:
Borrowers waste gas calling repay when direct transfer would suffice
Code complexity increases with unused functionality
Potential for bugs if future changes assume repay must be called
Confusing for auditors and integrators
Both repayment methods work identically:
Remove the repay function entirely and update documentation to clarify that borrowers should simply ensure the AssetToken contract has sufficient balance by the end of the callback.
Update documentation to clarify:
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.