github.com/diadata-org/diadata@v1.4.593/pkg/dia/scraper/blockchain-scrapers/blockchains/ethereum/oracleService/diaoracle.sol (about)

     1  pragma solidity ^0.4.21;
     2  // compiles with v0.4.25
     3  
     4  contract DiaOracle {
     5  	address owner;
     6  
     7  	struct CoinInfo {
     8  		uint256 price;
     9  		uint256 supply;
    10  		uint256 lastUpdateTimestamp;
    11  		string symbol;
    12  	}
    13  
    14  	mapping(string => CoinInfo) diaOracles;
    15  	
    16  	event newCoinInfo(
    17  		string name,
    18  		string symbol,
    19  		uint256 price,
    20  		uint256 supply,
    21  		uint256 lastUpdateTimestamp
    22  	);
    23      
    24  	constructor() public {
    25  		owner = msg.sender;
    26  	}
    27  
    28  	function changeOwner(address newOwner) public {
    29  		require(msg.sender == owner);
    30  		owner = newOwner;
    31  	}
    32      
    33  	function updateCoinInfo(string name, string symbol, uint256 newPrice, uint256 newSupply, uint256 newTimestamp) public {
    34  		require(msg.sender == owner);
    35  		diaOracles[name] = (CoinInfo(newPrice, newSupply, newTimestamp, symbol));
    36  		emit newCoinInfo(name, symbol, newPrice, newSupply, newTimestamp);
    37  	}
    38      
    39  	function getCoinInfo(string name) public view returns (uint256, uint256, uint256, string) {
    40  		return (
    41  			diaOracles[name].price,
    42  			diaOracles[name].supply,
    43  			diaOracles[name].lastUpdateTimestamp,
    44  			diaOracles[name].symbol
    45  		);
    46  	}
    47  }