Skip to content
A highly reliable oracle aggregator for Ethereum-based DeFi apps that need financial data from the outside world.
Branch: master
Clone or download
Pull request Compare This branch is even with mikedeshazer:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
contracts added experimental support for Stocks and ETFs, updated readme Dec 2, 2019
examples added experimental support for Stocks and ETFs, updated readme Dec 2, 2019
.DS_Store readme updated Dec 3, 2019

OrFeed Smart Contract

Decentralized Price Feed for Crypto, Forex, Stocks, ETFs and more.

A highly reliable oracle for Ethereum-based DeFi apps that need financial data from the outside world.

OrFeed Logo


The Reality Stone on the Blockchain blog post

How OrFeed Was Conceived blog post


Youtube video tutorial

Getting Started

At the top of your smart contract or in a referenced file in your dApp project, include this interface.

interface OrFeedInterface {
  function getExchangeRate ( string fromSymbol, string toSymbol, string venue, uint256 amount ) external view returns ( uint256 );
  function getTokenDecimalCount ( address tokenAddress ) external view returns ( uint256 );
  function getTokenAddress ( string symbol ) external view returns ( address );
  function getSynthBytes32 ( string symbol ) external view returns ( bytes32 );
  function getForexAddress ( string symbol ) external view returns ( address );

To Initialize OrFeed, simply include this code:

OrFeedInterface orfeed= OrFeedinterface(0x73f5022bec0e01c0859634b0c7186301c5464b46);

One of the best things about OrFeed is that OrFeed automatically detects which kind of asset you are looking for (though the data can come from different providers), as the parameter of "venue" when making the getExchangeRate call. For example, you can get the price for ETH/USD the same way you get the price for JPY/ETH. The 3rd parameter is the venue. Use blank ('') for default oracle. In the future, you can reference several venues/providers to get their data and throw out any that deviate too far from the average.

uint jpyusdPrice = orfeed.getExchangeRate("JPY", "USD", "DEFAULT", 100000);
// returns 920 (or $920.00)

Note: Replace "DEFAULT" with the oracle provider you would like data from. For example, if you want to know Uniswap's price on the buy side, use "BUY-UNISWAP-EXCHANGE". If you want Kyber's sell side data for the same, you can use "SELL-KYBER-EXCHANGE". Because ERC-20s have many, many integers, when getting prices from token to token, be sure to use very large amounts.... 1000000000 DAI is less than one penny, for example, due to divisibility at 18.

More examples:

uint price = orfeed.getExchangeRate("ETH", "USDC", "BUY-KYBER-EXCHANGE", 100000000000000);
uint price = orfeed.getExchangeRate("BTC", "DAI", "SELL-UNISWAP-EXCHANGE", 100);
uint price = orfeed.getExchangeRate("MKR", "EUR", "", 100000000000000);


uint price = orfeed.getExchangeRate("AAPL", "USD", "PROVIDER1", 1);

Stocks and ETFs are provided by a centralized oracle and we are currently working on a register in which requests can go to any provider (centralized or decentralized)... or of course, aggregated with the removal of outliers (recommended). The current contract supports the top 10 equities by market cap (AAPL, AMZN, JNJ etc) and the top 5 ETFs (SPY, etc)

You can run you own oracle by deploying a Node app with the example code in /examples/oracleNodeExampleApp (contract code is in contacts/stockETFPriceContract.sol) and provide as many stocks at the update frequency of your choice. We recommend buying GAS token (we are in no way affiliated and not shilling) to lower your Ethereum fee risk (and so you can pay a reasonable gas price f you plan to run an oracle for a long period of time). Otherwise, you will be exposed to gas fee price risk, or your prices might not update at the frequency you would like.

Read the full docs

Free data is provided by Kyber, Uniswap and Synthetix.

Premium data is provided as follows:

How it all fits together

Demo on Testnets

the OrFeed demo already deployed to testnets
Kovan: 0x31a29958301c407d4b4bf0d53dac1f2d154d9d8d
Rinkeby: 0x97875355ef55ae35613029df8b1c8cf8f89c9066

Works Provided As Inspiration Of Thought Through Development:

William George, Clément Lesaege: Smart Contract Oracle for Approximating Real-World, Real Number Values

Aragon Network Whitepaper

Vitalik Buterin: Minimal Anti-Collusion Infrastructure

You can’t perform that action at this time.