When normalizing the TWAP price we divide it by 1e6 and then multiply by 1e18. The division can round to zero.
If the TWAP price falls below 1e6, it rounds down to zero during division. The protocol aims to add more assets in the future. It's noteworthy that stablecoins (and their derivatives) frequently trade below their peg, resulting in their value being rounded down to zero.
When the TWAP price is zero, the inverse
is not defined. Hence any transaction will revert.
VS Code
To fix this, reverse the order of operations - multiply before dividing.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.