DittoETH

Ditto
DeFiFoundryOracle
55,000 USDC
View results
Submission Details
Severity: low
Valid

Division before multiplication for price

Summary

When normalizing the TWAP price we divide it by 1e6 and then multiply by 1e18. The division can round to zero.

Vulnerability Details

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.

Impact

When the TWAP price is zero, the inverse

uint256 twapPriceInv = twapPriceInEther.inv();

is not defined. Hence any transaction will revert.

Tools Used

VS Code

Recommendations

To fix this, reverse the order of operations - multiply before dividing.

Updates

Lead Judging Commences

0xnevi Lead Judge almost 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-535

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.