Oraclize test from October 2015 that asks ShapeShift, through the oracle, for an ETH-to-BTC deposit address and parses the reply onchain.
Historical Significance
An early form of Oraclize's StopLoss example, which pairs a price feed with an automatic ShapeShift conversion. It shows the oracle making a POST request to an exchange API less than three months after mainnet launch. Source reconstructed from bytecode; exact creation match.
Context
Deployed on 24 October 2015 by the Oraclize operator account. The Oraclize address comes from a resolver contract at 0xda0181a763b533e532248f6ff859e564a470d9aa deployed earlier the same day, and the four-argument POST query was still an overload of query() (later renamed query2). The contract has since self-destructed; the source is proven against its deploy transaction.
Key Facts
Description
On deployment the contract asks Oraclize to POST {"pair": "eth_btc", "amount": "0.2", "withdrawal": "1AAcCo21EUc1jbocjssSQDzLna9Vem2UN5"} to ShapeShift's sendamount endpoint and return success.deposit. __callback() accepts the reply only from the connector's cb_address(), parses the hex deposit address character by character into an address and stores it in shapeshift_address. The fee is paid with a plain send of getPrice("URL") to the connector before the query. kill() self-destructs to the caller.
Source Verified
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)
contract OraclizeI {
function query(uint _timestamp, string _datasource, string _arg1, string _arg2) returns (bytes32 _id);
function getPrice(string _datasource) returns (uint _dsprice);
function cb_address() returns (address _cbAddress);
}
contract OraclizeAddrResolverI {
function getAddress() returns (address _addr);
}
contract usingOraclize {
address oraclize_addr = OraclizeAddrResolverI(0xda0181a763b533e532248f6ff859e564a470d9aa).getAddress();
OraclizeI oraclize = OraclizeI(oraclize_addr);
}
contract StopLoss is usingOraclize {
address public shapeshift_address;
function StopLoss() {
update();
}
function __callback(bytes32 myid, string result) {
if (msg.sender != oraclize.cb_address()) throw;
bytes memory tmp = bytes(result);
uint160 ishapeshift = 0;
uint160 b1;
uint160 b2;
for (uint i=2; i<2+2*20; i+=2){
ishapeshift *= 256;
b1 = uint160(tmp[i]);
b2 = uint160(tmp[i+1]);
if ((b1 >= 97)&&(b1 <= 102)) b1 -= 87;
else if ((b1 >= 48)&&(b1 <= 57)) b1 -= 48;
if ((b2 >= 97)&&(b2 <= 102)) b2 -= 87;
else if ((b2 >= 48)&&(b2 <= 57)) b2 -= 48;
ishapeshift += (b1*16+b2);
}
shapeshift_address = address(ishapeshift);
}
function update() {
oraclize_addr.send(oraclize.getPrice("URL"));
oraclize.query(0, "URL", "json(https://shapeshift.io/sendamount).success.deposit", '{"pair": "eth_btc", "amount": "0.2", "withdrawal": "1AAcCo21EUc1jbocjssSQDzLna9Vem2UN5"}');
}
function kill(){
suicide(msg.sender);
}
}External Links
Related contracts
Target
Same deployerTarget contract.
0x9e0ae8...c9428eSeptember 17, 2015GetSet
Same deployerA minimal getter/setter proxy from the Oraclize team. set() forwards calls to a hardcoded target contract, get() returns constant 255.
0x77beac...7e96c2September 17, 2015SimpleStorage
Same deployerThe storage example rewired to send a wei and return a constant
0x7aa73b...46473bSeptember 17, 2015Controller
Same deployerController contract.
0x3c9492...e332e5September 17, 2015GetSet
Same deployerA 57-byte test contract: set() stores the transaction's ether value into storage slot 0, and get() reads it back.
0xe595e8...423530September 17, 2015GetSet
Same deployerA 57-byte test contract: set() stores the transaction's ether value into storage slot 0, and get() reads it back.
0xd17e9b...03b76aSeptember 17, 2015