Normal behavior:
AssetToken.updateExchangeRate() is intended to increase the asset token exchange rate whenever the protocol earns flash loan fees, proportionally distributing yield to all liquidity providers.
Issue:
updateExchangeRate() performs a division using totalSupply() without validating that the supply is non-zero. When the asset token has not yet been minted (i.e. totalSupply() == 0), the function deterministically reverts due to division by zero, permanently blocking deposits and flash loans for that asset.
Likelihood:
Reason 1: This occurs during normal protocol usage when a new token is added and the first deposit or flash loan interaction attempts to update the exchange rate.
Reason 2: Newly deployed AssetToken contracts always start with totalSupply() == 0.
Impact:
Impact 1: Deposits for the affected token permanently revert, preventing liquidity providers from supplying assets.
Impact 2: Flash loans for the affected token become impossible, rendering the market unusable (denial of service).
Each AssetToken starts with a total supply of zero when it is first deployed via setAllowedToken(). During normal protocol operation, ThunderLoan calls updateExchangeRate() whenever a fee is accrued (e.g., during deposits or flash loans). Because updateExchangeRate() divides by totalSupply() without checking whether it is non-zero, the function deterministically reverts for newly added tokens, blocking all interactions with that asset.
The revert occurs every time updateExchangeRate() is invoked while the supply is zero, making the asset market unusable until the contract logic is fixed or redeployed.
Safely handle the zero-supply case before performing the exchange rate calculation.
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.