You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 26, 2023. It is now read-only.
sherlock-admin opened this issue
May 23, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
Note: because the code does not specify the exact calculation that each price represents. I'm basing my inferences on variable names, so it might be wrong.
wethPriceUSD: GUESS weth price in usd unit.
DAIWethPrice: GUESS dai price in weth unit.
price: IS dai price in weth unit, 18 decimals.
If the above conditions are true, the correct DAI price should be (wethPriceUSD * 1e18) * ((DAIWethPrice + uint256(price)) / 2);
wethPriceUSD: GUESS weth price in usd unit.
DAIWethPrice: GUESS weth price in dai unit.
price: IS dai price in weth unit, 18 decimals.
If the above conditions are true, the correct DAI price should be (wethPriceUSD * 1e18) / ((DAIWethPrice + 1e18 / uint256(price)) / 2);
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
kutugu
high
StableOracleDAI price calculation error
Summary
StableOracleDAI price calculation error
Vulnerability Detail
Note: because the code does not specify the exact calculation that each price represents. I'm basing my inferences on variable names, so it might be wrong.
wethPriceUSD
: GUESS weth price in usd unit.DAIWethPrice
: GUESS dai price in weth unit.price
: IS dai price in weth unit, 18 decimals.If the above conditions are true, the correct DAI price should be
(wethPriceUSD * 1e18) * ((DAIWethPrice + uint256(price)) / 2);
wethPriceUSD
: GUESS weth price in usd unit.DAIWethPrice
: GUESS weth price in dai unit.price
: IS dai price in weth unit, 18 decimals.If the above conditions are true, the correct DAI price should be
(wethPriceUSD * 1e18) / ((DAIWethPrice + 1e18 / uint256(price)) / 2);
Impact
High. Oracle price calculation error.
Code Snippet
StableOracleDAI
Tool used
Manual Review
Recommendation
Use correct calculation
Duplicate of #236
The text was updated successfully, but these errors were encountered: