AssetToken.updateExchangeRate() computes the new exchange rate by dividing by totalSupply():
When totalSupply() == 0 (no LPs have deposited, or all LPs have redeemed), this triggers Panic(0x12) — an EVM arithmetic division-by-zero panic.
flashloan() calls updateExchangeRate(fee) at line 194 before checking anything about LP supply:
This is distinct from the existing L-04 finding (which covers the fee == 0 case causing newRate == oldRate and reverting on the strict <= monotonicity check). This finding covers a separate code path — a raw EVM arithmetic panic from division by zero, triggered by an empty LP pool regardless of the fee amount.
There are two realistic scenarios where totalSupply() is zero:
Fresh token setup: Owner calls setAllowedToken(token, true) creating a new AssetToken. Before any LP deposits, someone attempts a flash loan (the AssetToken may hold tokens from a direct transfer or leftover from re-allowing a previously disallowed token).
LP exodus: All LPs call redeem(), burning all shares. totalSupply() returns to 0. The AssetToken may still hold residual dust from rounding. Any flash loan attempt now panics.
Likelihood: Low — requires a token to be allowed but have zero outstanding AssetToken supply. Uncommon in normal operation but reachable during protocol initialization or LP migration events.
Impact: High — any flashloan() call reverts with an unhelpful Panic(0x12) instead of a descriptive error. The token's entire flash loan functionality is bricked until someone deposits. If tokens are stuck in the AssetToken (from rounding dust or direct transfers), they become inaccessible.
Output: flashloan() reverts with Panic(0x12) (division by zero) when assetToken.totalSupply() == 0. The 100e18 tokens in the AssetToken are inaccessible via flash loan.
Guard updateExchangeRate() against zero supply. When no LPs exist, the fee has no one to distribute to:
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.