Skip to content
This repository has been archived by the owner on Nov 26, 2023. It is now read-only.

Proxy - Oracle will return too expensive price of DAI because of excessive precision scaling #634

Closed
sherlock-admin opened this issue May 24, 2023 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented May 24, 2023

Proxy

high

Oracle will return too expensive price of DAI because of excessive precision scaling

Summary

Oracle will return too expensive price because of excessive precision scaling.

Vulnerability Detail

In StableOracleDAI.sol#L52 price is being multiplied by 1e10 -> uint256(price) * 1e10 assuming that Chainlink price feed returns 8 decimals. However checking the decimals of the oracle address used DAI/ETH decimals we see that it returns 18 decimals.

Impact

The price of DAI will not be representative of the real price of DAI - too expensive. Causing the protocol to pay way more for collateral while rebalancing. rebalance() calls two functions which use getPriceUSD() from StableOracleDAI contract.

Code Snippet

StableOracleDAI.sol#L52

Tool used

Manual Review

Recommendation

Change uint256(price) * 1e10 to uint256(price) removing * 1e10

Duplicate of #236

@github-actions github-actions bot closed this as completed Jun 5, 2023
@github-actions github-actions bot added High A valid High severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Jun 5, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant