Submitted by ronnyx2017
When the tryPrice() function revert, for example oracle timeout, the Asset.lotPrice will use a decayed historical value:
And the delta time is from the last price saved time. If the delta time is greater than oracle timeout,  historical price starts decaying.
But the last price might be saved at the last second of the last oracle timeout period. So the Asset.lotPrice will double the oracle timeout in the worst case.
The Asset.lotPrice will double the oracle timeout in the worst case. When the rewards need to be sold or basket is rebalancing, if the price oracle is offline temporarily, the Asset.lotPrice will use the last saved price in max two oracle timeout before the historical value starts to decay. It increases the sale/buy price of the asset.
The lastSave is updated in the refresh() function, and its set to the current block.timestamp instead of the updateTime from the chainlink feed:
But in the OracleLib, the oracle time is checked for the delta time of block.timestamp - updateTime:
So if the last oracle feed updateTime is block.timestamp - priceTimeout, the timeout check will be passed and lastSave will be updated to block.timestamp. And the lotPrice will start to decay from lastSave + priceTimeout. However when it starts, its been 2 * priceTimeout since the last oracle price update.
Starts lotPrice decay immediately or updated the lastSave to updateTime instead of block.timestamp.
Context
tbrent (Reserve) disputed and commented:
cccz (judge) commented:
