0xGojo / OrFeedSmartContracts

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

Home Page:https://www.orfeed.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Website: orfeed.org

Demo: https://etherscan.io/dapp/0xb215bf00e18825667f696833d13368092cf62e66

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(0xb215bf00e18825667f696833d13368092cf62e66);

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.

Read the full docs orfeed.org/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

About

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

https://www.orfeed.org