Closed milancermak closed 7 months ago
I pinged Switchboard about the update issue, saying that now with 4844 in place, storage updates are really cheap. They said they might ramp up the update frequency 🤞
@tserg can you have one more look please? I rebased from main, updated the code to 2.6.3 (i.e added pub
everywhere) and gathered the externals code under src/external/
.
This PR adds support for reading price feeds from Switchboard oracle.
Switchboard as a product supports a lot of features, but we're only interested in basic price feed functionality. For this, the Switchboard team operates the functions pushing the data onchain. I think we can rely on that/them, although we should monitor it eventually somehow. As far as I remember, StarkWare will be using them as well somehow (to get the onchain STRK and ETH price or something like that)...
Anyway, there's not much docs for Switchboard for now. Best source is their repo, there's an intro article announcing their launch on Starknet and then there's the frontend showing price feeds.
The unusual thing about their price feeds is that they update the price only when the price diff is 0.5% for ETH and BTC and 1.5% for all the other tickers. Is this good enough for us? IDK 🤔 The implication here is that we don't have a good way to check if a price is stale or just hasn't moved much (that's why the
is_valid_price_update
fn is just a two simple "is non zero" checks), not sure how I feel about it.As of yet, they don't support STRK/USD and are not available on Sepolia - will ping the team about it.