[I-02] Event Ordering — FlashLoan Event Emitted Before External Calls
ThunderLoan.sol
The FlashLoan event is emitted before the external call to receiverAddress.functionCall() and before the repayment balance check. In the checks-effects-interactions pattern, events should ideally be emitted after all state changes and external interactions have completed and been verified. Emitting the event early means it logs a flash loan that may ultimately revert (if repayment fails), which can confuse off-chain log parsers.
Likelihood: Low
The event ordering only matters for off-chain consumers processing events from reverted transactions (which is uncommon but possible in some indexer configurations).
Impact: Low
Off-chain systems may temporarily record flash loans that ultimately reverted, though most indexers handle reverts correctly.
Severity: Informational
A flash loan that fails the repayment check still emits the FlashLoan event in the transaction trace (even though the transaction reverts). An aggressive log parser that processes events before checking transaction status would record a phantom flash loan.
Move the FlashLoan event emission to after the repayment balance check. This ensures the event only appears in successful (non-reverted) transactions and the logged data reflects the final verified state.
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.