A price feed from ether.camp: authorised updaters post asset prices, stored with a timestamp and read by other contracts.
Key Facts
Description
Prices are stored per symbol as integers scaled by one million, with the time of the latest update. The owner adds and removes the accounts allowed to update.
Source Verified
Exact runtime and creation bytecode match with soljson v0.1.6+commit.d41f8b7c, optimizer on. Source: github.com/ether-camp/contracts, revision blob 8fb4216379 (imports inlined, every file verbatim). Verified on Etherscan. Not submitted to Sourcify: its oldest supported compiler is v0.1.7.
Heuristic Analysis
The following characteristics were detected through bytecode analysis and may not be accurate.
Frontier Era
The initial release of Ethereum. A bare-bones implementation for technical users.
Bytecode Overview
Verified Source Available
Source verified through compiler archaeology and exact bytecode matching.
View Verification ProofShow source code (Solidity)
// Submitted by EthereumHistory (ethereumhistory.com)
// This si marker
// for contract not
// to be deployed to
// any environment
contract abstract {}
contract owned is abstract {
address owner;
function owned() {
owner = msg.sender;
}
function changeOwner(address newOwner) onlyowner {
owner = newOwner;
}
modifier onlyowner() {
if (msg.sender==owner) _
}
}
contract mortal is abstract, owned {
function kill() onlyowner {
if (msg.sender == owner) suicide(owner);
}
}
contract NameReg is abstract {
function register(bytes32 name) {}
function unregister() {}
function addressOf(bytes32 name) constant returns (address addr) {}
function nameOf(address addr) constant returns (bytes32 name) {}
function kill() {}
}
contract nameRegAware is abstract {
function nameRegAddress() returns (address) {
return 0x985509582b2c38010bfaa3c8d2be60022d3d00da;
}
function named(bytes32 name) returns (address) {
return NameReg(nameRegAddress()).addressOf(name);
}
}
contract named is abstract, nameRegAware {
function named(bytes32 name) {
NameReg(nameRegAddress()).register(name);
}
}
// contract with util functions
contract util is abstract {
// Converts 'string' to 'bytes32'
function s2b(string s) internal returns (bytes32) {
bytes memory b = bytes(s);
uint r = 0;
for (uint i = 0; i < 32; i++) {
if (i < b.length) {
r = r | uint(b[i]);
}
if (i < 31) r = r * 256;
}
return bytes32(r);
}
}
contract PriceFeedApi {
// block time when the prices were last updated
uint public updateTime;
// returns the price of an asset
// the price is represented as uint: (double price) * 1000000
function getPrice(bytes32 symbol) constant returns(uint currPrice);
// returns the timestamp of the latest price for an asset
// normally this is the exchange timestamp, but if exchange
// doesn't supply such info the latest data retrieval time is returned
function getTimestamp(bytes32 symbol) constant returns(uint timestamp);
}
contract PriceFeed is PriceFeedApi, owned, mortal, named("ether-camp/price-feed") {
mapping (bytes32 => uint) priceMap; // symbol => price
mapping (bytes32 => uint) timestampMap; // symbol => time
mapping (address => uint) updaters; // who can update the price
function PriceFeed() {
addUpdater(msg.sender);
}
function update(bytes32[] symbols, uint[] newPrices, uint[] timestamps) {
if (updaters[msg.sender] == 1) {
updateTime = now;
for (uint i = 0; i < symbols.length; i++) {
priceMap[symbols[i]] = newPrices[i];
timestampMap[symbols[i]] = timestamps[i];
}
}
}
function getPrice(bytes32 symbol) constant returns(uint currPrice) {
return priceMap[symbol];
}
function getTimestamp(bytes32 symbol) constant returns(uint timestamp) {
return timestampMap[symbol];
}
function addUpdater(address updater) onlyowner {
updaters[updater] = 1;
}
function removeUpdater(address updater) onlyowner {
updaters[updater] = 0;
}
}External Links
Related contracts
Greeter
Same eraA HelloWorld greeter deployed at block 51,909 on 8 August 2015, one of a run of contracts from the same account that week.
0x412fda...7267edAugust 8, 2015Greeter
Same eraA Greeter with the message 'Ethereum will change the world smarter' - deployed Aug 8, 2015 by a developer connected to the Tokyo Smart Contract meetup.
0xda0c1c...7a68ebAugust 8, 2015MessageStore
Same eraA 6-line contract storing a single public string, deployed Day 9 of Ethereum by a prolific early experimenter who shipped 18 contracts in one week.
0xd2eccd...ff3d6bAugust 8, 2015Greeter
Same eraThe go-ethereum Contract Tutorial greeter, deployed with the greeting: Hello World!
0x506f4b...466983August 8, 2015Contract 0xd4eae4...a2c77a
Same eraThe ethereum.org crowdsale tutorial, deployed on the ninth day of the public chain, with the funding goal, deadline and price fixed at construction.
0xd4eae4...a2c77aAugust 8, 2015Greeter
Same eraA Frontier-era Greeter contract with the message: 'Hello World!'
0x113158...72fa8aAugust 8, 2015