At Riften Labs, we’re testing out an on-chain oracle contract. It’s currently in use on Cauldron dangerzone (hoover a token) to fetch the USD price of BCH.
The contract we’ve deployed fetches the price from oracles.cash and embeds it into a NFT commitment (I hope you don’t mind General Protocols). This allows us to both:
- Read the price off the blockchain using electrum to use in a user interface, like we do on Cauldron
- Fetch the price in other contracts by taking it as input and using introspection
The code for this is in
Additionally, there is a contract (
aggregated.cash) that takes 3 other oracle contracts as input and publishes the median price of the three. It can also be chained to get “median of median” of more entities:
The goal is to have multiple independent oracles and be able to get a price within a contract that is resistant to one or more of the entities “going rouge”.
Hoping for some review and feedback. The code and more info at Riften Labs / Moria / oracle-contract · GitLab