LibOracle base price in ETH obtained from Chainlink feed does not account for USDC having 6 decimals
For the TWAP we see that it rightly adjusts for USDC having 6 decimals
However, when the price is obtained for Chainlink no such adjustments are made to account for 6 decimals USDC; only update done is to account for price feed 8 decimals using int256 internal constant BASE_ORACLE_DECIMALS = 10 ** 10;
It is also common for this adjustment to be done in function function estimateWETHInUSDC() However looking into the function shows no such adjustments
TWAPFacet.sol
This results in incorrect ETH_USD prices which result in errors in the accounting of the protocol, can lead to inappropriate collateral ratios, unfair and wrong margin calls etc
Manual Analysis
Adjust price appropriately by applying a factor related to USDC == uint256 internal constant DECIMAL_USDC = 10 ** 6;
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.