Using deprecated Chainlink function latestAnswer()
#405
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-655
satisfactory
satisfies C4 submission criteria; eligible for awards
Lines of code
https://github.com/code-423n4/2022-12-tigris/blob/588c84b7bb354d20cbca6034544c4faa46e6a80e/contracts/utils/TradingLibrary.sol#L113
Vulnerability details
Impact
According to Chainlink's documentation, the
latestAnswer()
function is deprecated.The following could happen:
Proof of Concept
Reference:
Chainlink - latestanswer
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 incomplete, for example:The text was updated successfully, but these errors were encountered: