According to Chainlink's documentation, the latestAnswer function is deprecated. This function does not error if no answer has been reached but returns 0, causing an incorrect price fed to the UniswapV3Oracle.
Use the latestRoundData function to get the price instead. Add checks on the return data with proper revert messages if the price is stale or the round is uncomplete, for example:
Handle
shw
Vulnerability details
Impact
According to Chainlink's documentation, the
latestAnswer
function is deprecated. This function does not error if no answer has been reached but returns 0, causing an incorrect price fed to theUniswapV3Oracle
.Proof of Concept
Referenced code: UniswapV3Oracle.sol#L94
Referenced documentation: Chainlink - Deprecated API Reference Chainlink - Migration Instructions Chainlink - API Reference
Recommended Mitigation Steps
Use the
latestRoundData
function to get the price instead. Add checks on the return data with proper revert messages if the price is stale or the round is uncomplete, for example: