Use of deprecated oracle API in _normalizeAggregatorAnswer
Likelihood low, impact high.
The Chainlink latestAnswer function included in IAggregatorV3Interface and called in NFTVault#_normalizeAggregatorAnswer() is considered deprecated and no longer included in the Chainlink API documentation.
It's considered best practice to use the latestRoundData function instead. (API docs). latestAnswer returns only the value of the latest price, whereas latestRoundData returns additional information that can be used to validate whether a price is stale:
Lines of code
https://github.com/code-423n4/2022-04-jpegd/blob/e72861a9ccb707ced9015166fbded5c97c6991b6/contracts/vaults/NFTVault.sol#L459
Vulnerability details
Use of deprecated oracle API in
_normalizeAggregatorAnswer
Likelihood low, impact high.
The Chainlink
latestAnswer
function included inIAggregatorV3Interface
and called inNFTVault#_normalizeAggregatorAnswer()
is considered deprecated and no longer included in the Chainlink API documentation.It's considered best practice to use the
latestRoundData
function instead. (API docs).latestAnswer
returns only the value of the latest price, whereaslatestRoundData
returns additional information that can be used to validate whether a price is stale:NFTVault#459
:Example using
latestRoundData
:Stale prices may impact collateral value and credit limit calculations, incorrectly reporting a position as under- or overcollateralized.
See also OpenZeppelin's guidelines for safely using
latestRoundData
andlatestAnswer
, and consider the impact of a stale or reverting price feed.