Find all relevant information to start building a variety of financial dApps with DIA Oracles and APIs, a reliable and verifiable bridge between off-chain data from various sources and on-chain smart contracts.
DIA operates oracles on multiple blockchains and access data from multiple and transparent sources.
This smart contract holds mappings from an index to an asset’s name, its price value, and – if applicable – supply data. By using the read function getCoinInfo(coin_name) it is possible to retrieve this data. Along with the actual data there is a metadata field for the timestamp of the last update.
/** *Submitted for verification at Etherscan.io on 2018-10-25 */ pragma solidity ^0.4.21; contract DiaOracle { address owner; struct CoinInfo { uint256 price; uint256 supply; uint256 lastUpdateTimestamp; string symbol; } mapping(string => CoinInfo) diaOracles; event newCoinInfo( string name, string symbol, uint256 price, uint256 supply, uint256 lastUpdateTimestamp ); constructor() public { owner = msg.sender; } function changeOwner(address newOwner) public { require(msg.sender == owner); owner = newOwner; } function updateCoinInfo(string name, string symbol, uint256 newPrice, uint256 newSupply, uint256 newTimestamp) public { require(msg.sender == owner); diaOracles[name] = (CoinInfo(newPrice, newSupply, newTimestamp, symbol)); emit newCoinInfo(name, symbol, newPrice, newSupply, newTimestamp); } function getCoinInfo(string name) public view returns (uint256, uint256, uint256, string) { return ( diaOracles[name].price, diaOracles[name].supply, diaOracles[name].lastUpdateTimestamp, diaOracles[name].symbol ); } }
Whether you’re building a financial service, a portfolio management tool, a new media offering, or anything else, DIA provides the most advanced and updated data on the market for your product.
Find below a few examples of API Endpoints.