These are Compound Finance's former oracle contracts:
I say "former" because Compound switched to the Open Price Feed UniwapAnchoredView.sol oracle on Aug 17, 2020.
While studying this function:
function getUnderlyingPrice(CToken cToken) public view returns (uint) {
address cTokenAddress = address(cToken);
(bool isListed, ) = comptroller.markets(cTokenAddress);
if (!isListed) {
// not listed, worthless
return 0;
} else if (cTokenAddress == cEtherAddress) {
// ether always worth 1
return 1e18;
} else if (cTokenAddress == cUsdcAddress) {
// read from hand picked key
return v1PriceOracle.assetPrices(usdcOracleKey);
} else {
// read from v1 oracle
address underlying = CErc20(cTokenAddress).underlying();
return v1PriceOracle.assetPrices(underlying);
}
}
I started to wonder why did they choose ETH as the base unit of price reference? Their web interface tracks all values in USD.
What advantages are there in using ETH instead of USD?