ravikiran.web3
high
StableOracle address is not assigned in StableOracleDAI contract, leading to incorrect DAI usd price.
StableOracle address is set to a zero address with a comment, "TO DO". This will impact the computation of price for DAI.
In the computation of USD price for DAI, the logic is using the usd price returned from StableOracle. But the stable orcale is pointing to Zero address leading to incorrect computation of DAI USD price.
This will impact the computation of collateral values and also directly impacts the rebalancing logic.
constructor() { priceFeedDAIETH = AggregatorV3Interface( 0x773616E4d11A78F511299002da57A0a94577F1f4 ); DAIEthOracle = IStaticOracle( 0x982152A6C7f732Ec7C9EA998dDD9Ebde00Dfa16e ); ethOracle = IStableOracle(0x0000000000000000000000000000000000000000);// TODO: WETH oracle price }
function getPriceUSD() external view override returns (uint256) { address[] memory pools = new address; pools[0] = 0x60594a405d53811d3BC4766596EFD80fd545A270; uint256 DAIWethPrice = DAIEthOracle.quoteSpecificPoolsWithTimePeriod( 1000000000000000000, // 1 Eth 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, // WETH (base token) 0x6B175474E89094C44Da98b954EedeAC495271d0F, // DAI (quote token) pools, // DAI/WETH pool uni v3 600 // period ); uint256 wethPriceUSD = ethOracle.getPriceUSD(); // chainlink price data is 8 decimals for WETH/USD, so multiply by 10 decimals to get 18 decimal fractional //(uint80 roundID, int256 price, uint256 startedAt, uint256 timeStamp, uint80 answeredInRound) = priceFeedDAIETH.latestRoundData(); (, int256 price, , , ) = priceFeedDAIETH.latestRoundData();
return
(wethPriceUSD * 1e18) /
((DAIWethPrice + uint256(price) * 1e10) / 2);
}
Manual Review
Assign the correct address so that oracle can feed correct DAI/USD prices for the StableOracleDAI.