`StableOracleDAI` calculates `getPriceUSD` with inverted base/rate tokens for Chainlink price
`StableOracleDAI::getPriceUSD()` calculates the average price between the Uniswap pool price for a pair and the Chainlink feed as part of its result.\\nThe problem is that it uses `WETH/DAI` as the base/rate tokens for the pool, and `DAI/ETH` for the Chainlink feed, which is the opposite.\\nThis will incur in a huge price difference that will impact on the amount of USSD tokens being minted, while requesting the price from this oracle.\\nIn `StableOracleDAI::getPrice()` the `price` from the Chainlink feed `priceFeedDAIETH` returns the `price` as DAI/ETH.\\nThis can be checked on Etherscan and the Chainlink Feeds Page.\\nAlso note the comment on the code is misleading, as it is refering to another pair:\\nchainlink price data is 8 decimals for WETH/USD\\n```\\n/// constructor\\n   priceFeedDAIETH = AggregatorV3Interface(\\n       0x773616E4d11A78F511299002da57A0a94577F1f4\\n   );\\n\\n/// getPrice()\\n   // chainlink price data is 8 decimals for WETH/USD, so multiply by 10 decimals to get 18 decimal fractional\\n   //(uint80 roundID, int256 price, uint256 startedAt, uint256 timeStamp, uint80 answeredInRound) = priceFeedDAIETH.latestRoundData();\\n   (, int256 price, , , ) = priceFeedDAIETH.latestRoundData();\\n```\\n\\nLink to code\\nOn the other hand, the price coming from the Uniswap pool `DAIWethPrice` returns the price as `WETH/DAI`.\\nNote that the relation WETH/DAI is given by the orders of the token addresses passed as arguments, being the first the base token, and the second the quote token.\\nAlso note that the variable name `DAIWethPrice` is misleading as well as the base/rate are the opposite (although this doesn't affect the code).\\n```\\n    uint256 DAIWethPrice = DAIEthOracle.quoteSpecificPoolsWithTimePeriod(\\n        1000000000000000000, // 1 Eth\\n        0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, // WETH (base token) // @audit\\n        0x6B175474E89094C44Da98b954EedeAC495271d0F, // DAI (quote token) // @audit\\n        pools, // DAI/WETH pool uni v3\\n        600 // period\\n    );\\n```\\n\\nLink to code\\nFinally, both values are used to calculate an average price of in `((DAIWethPrice + uint256(price) * 1e10) / 2)`.\\nBut as seen, one has price in `DAI/ETH` and the other one in `WETH/DAI`, which leads to an incorrect result.\\n```\\n    return\\n        (wethPriceUSD * 1e18) /\\n        ((DAIWethPrice + uint256(price) * 1e10) / 2);\\n```\\n\\nLink to code\\nThe average will be lower in this case, and the resulting price higher.\\nThis will be used by `USSD::mintForToken()` for calculating the amount of tokens to mint for the user, and thus giving them much more than they should.\\nAlso worth mentioning that `USSDRebalancer::rebalance()` also relies on the result of this price calculation and will make it perform trades with incorrect values.
Calculate the inverse of the `price` returned by the Chainlink feed so that it can be averaged with the pool `price`, making sure that both use the correct `WETH/DAI` and `ETH/DAI` base/rate tokens.
Users will receive far more USSD tokens than they should when they call `mintForToken()`, ruining the token value.\\nWhen performed the `USSDRebalancer::rebalance()`, all the calculations will be broken for the DAI oracle, leading to incorrect pool trades due to the error in `getPrice()`
```\\n/// constructor\\n   priceFeedDAIETH = AggregatorV3Interface(\\n       0x773616E4d11A78F511299002da57A0a94577F1f4\\n   );\\n\\n/// getPrice()\\n   // chainlink price data is 8 decimals for WETH/USD, so multiply by 10 decimals to get 18 decimal fractional\\n   //(uint80 roundID, int256 price, uint256 startedAt, uint256 timeStamp, uint80 answeredInRound) = priceFeedDAIETH.latestRoundData();\\n   (, int256 price, , , ) = priceFeedDAIETH.latestRoundData();\\n```\\n