Closed sherlock-admin closed 1 year ago
The getAssetPrice() function returns how much USDC each 1e18 token corresponds to. You can see that this is also used in the code. https://github.com/sherlock-audit/2023-04-jojo/blob/main/JUSDV1/src/Impl/JUSDView.sol#L49 https://github.com/sherlock-audit/2023-04-jojo/blob/main/JUSDV1/src/Impl/JUSDView.sol#L111
0x52
medium
uniswapPriceAdaptor will function incorrectly if quote token isn't 18 dp
Summary
The precision of the uniswapPriceAdaptor matches the decimals of the quote token which will cause the price returned to be incorrect
Vulnerability Detail
https://github.com/sherlock-audit/2023-04-jojo/blob/main/JUSDV1/src/oracle/UniswapPriceAdaptor.sol#L48-L55
Above we see that uniswapPriceAdaptor uses the quoteAllAvailablePoolsWithTimePeriod function.
https://github.com/Mean-Finance/uniswap-v3-oracle/blob/6888b16a6eefb82226b2086ed6d42f8bf4e10b69/solidity/contracts/StaticOracle.sol#L53-L61
https://github.com/Mean-Finance/uniswap-v3-oracle/blob/6888b16a6eefb82226b2086ed6d42f8bf4e10b69/solidity/contracts/StaticOracle.sol#L158-L174
Above we can see that the Uniswap oracle used returns the raw tick for the price. This means that it will return the price of the base token to the same precision as the quote token. Since USDC seems to be the quote token of choice and is 6 dp, this is very problematic, since it is expected throughout the code that the oracle is 18 dp in precision.
Impact
Code Snippet
https://github.com/sherlock-audit/2023-04-jojo/blob/main/JUSDV1/src/oracle/UniswapPriceAdaptor.sol#L48-L55
Tool used
Manual Review
Recommendation
Adjust uniswapPriceFeed by the decimals of the quote token so that it is 18 dp