The AssetToken.updateExchangeRate function divides by totalSupply() to calculate the new exchange rate. When the total supply of AssetTokens is zero (before any liquidity providers deposit), this function will revert with a division by zero error.
This prevents flash loans from being executed when there are no AssetToken holders, even if underlying tokens exist in the contract.
Likelihood:
Occurs when attempting flash loans before any deposits are made
Occurs when all AssetTokens are redeemed and someone attempts a flash loan
Requires specific timing but is not attacker-dependent
Impact:
Flash loans become temporarily unavailable when total supply is zero
Protocol functionality is degraded during periods of no liquidity provider participation
Initial bootstrapping of the protocol is more complex
Denial of service during edge case scenarios
Add a check to handle the case when total supply is zero. When there are no AssetToken holders, fees should not update the exchange rate since there's no one to distribute the fees 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.