Open ethanfrey opened 2 years ago
I'm actually not sure if this is a good idea. We could cache this for the same block safely, but do we want to cache this longer than one block? What do we achieve by that?
Blocked by #98
Happy to move to a post-1.0 milestone. This just reduces gas and could be rolled out any time.
I responded to #98. Let's only cache one block if we do this at all.
We don't need to update every query. At most once per block, maybe once every minute or two.
The Market should have a wrapper around price oracle queries, that will cache a result and the last time queried. The "cache_lifetime" should be set in Market instantiation, and if the last data is younger than this time, we just use the local cached value. If it is missing or older, we query the price oracle and store the new result.