In uniswap to fetch the current price I simply fetch the reserves and then the price is given by TOKEN_RESERVES / WETH_RESERVES
. I want to compare the price deviation from the chainlink price. However I am struggling with how chainlink formats its price calculation. How should I deal with decimals since token might or might not have 18 decimals?
We can fetch chainlink price using:
(, int256 price, , , ) = priceFeed.latestRoundData();
But how can I compare with the Uniswap price format?