Submitted by 4B, also found by Bauchibred and Evo
Whenever block.timestamp - lastUpdate > updateWaitWindow and needs to update the price, it will return a stale price because it will fetch the price from the lastUpdate not the currentUpdate.
In the update() function these are the lines well find:
From the code, we can see that the currentPrice is the last thing updated.
Whenever the updateWindow reaches or passes for us to fetch a new price, the safePrice is updated first, which is the value from the lastUpdate which is stale.
It can be argued that its a design decision meaning the updateWindow is just time it needs to fetch a new price, but it doesnt mean the price is old. However, the updateWindow can be passed and not updated right after meaning the price is two times back because it wasnt updated right away.
Revisit the logic to be able to fetch fresh price whenever there need to be a new price fetched.
Oracle
0xtj24 (LoopFi) acknowledged and commented:
Koolex (judge) commented:
