lindy-labs / opus_contracts

Opus Source Code
https://opus.money
Other
0 stars 0 forks source link

refactor: oracles #570

Closed milancermak closed 7 months ago

milancermak commented 8 months ago

PR implements a pessimistic oracle based on Pragma's data as described in #503 with a fallback to Switchboard if Pragma fails.

In detail, the Pragma oracle reads spot and TWAP prices, compares them and returns the lower one. However, if spot Pragma price does not pass our validity checks, the oracle module returns an Err. In that case, Seer uses the fallback Switchboard oracle. It should always 🤞 return a price, because it is not calculated onchain (since that's how Switchboard works).

Supersedes #523. Better than #569. Resolves #378.