DittoETH

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

Minor Precision loss in ```baseOracleCircuitBreaker```

Summary

While calculating the twap price in terms of ether division before multiplication is used which will result in the loss of precision.This seems to be intended but this can cause a small impact on the price of the USD in terms of ETH.

Vulnerability Details

See summary

Impact

Small amount of USD will be lost while converting the value in ETH denominations.

for example if the price of 1 ETH = 1902991929. the if we do the maths

1902991929 / 1000000 = 1902 * 1e18 = 1902e18

Here we have a small loss of .9 USD.

Tools Used

manual

Recommendations

Use multiplication before division.

In this case the simple fix will be

uint256 twapPriceInEther = (twapPrice * 1 ether) / Constants.DECIMAL_USDC;

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.