Skip to content
Verified contractPartial

ShapeShift

Address0x5d24ce0db1dcc6915bc9d829050104acae5367d5
Balance

0 ETH

 

Transactions

3

 

Compiler

solc 0.1.6

 

Same code

Only this contract

 

Details

Compiler
solc 0.1.6+commit.d41f8b7c
Language
solidity
Optimization
Yes, 200 runs
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
505,437
Creation transaction
0x36eea3d01b…91df4388a0

ShapeShift.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
contract OraclizeI {
    address public cbAddress;
    function query(uint _timestamp, string _datasource, string _arg) returns (bytes32 _id);
    function query2(uint _timestamp, string _datasource, string _arg1, string _arg2) returns (bytes32 _id);
    function getPrice(string _datasource) returns (uint _dsprice);
    function useCoupon(string _coupon);
    function setProofType(byte _proofType);
}

contract OraclizeAddrResolverI {
    function getAddress() returns (address _addr);
}

contract usingOraclize {
    OraclizeI oraclize;

    modifier oraclizeAPI {
        OraclizeAddrResolverI OAR = OraclizeAddrResolverI(0x1d11e5eae3112dbd44f99266872ff1d07c77dce8);
        oraclize = OraclizeI(OAR.getAddress());
        _
    }

    modifier coupon(string code) {
        OraclizeAddrResolverI OAR = OraclizeAddrResolverI(0x1d11e5eae3112dbd44f99266872ff1d07c77dce8);
        oraclize = OraclizeI(OAR.getAddress());
        oraclize.useCoupon(code);
        _
    }

    function oraclize_query(string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id) {
        return oraclize.query2.value(oraclize.getPrice(datasource))(0, datasource, arg1, arg2);
    }

    function oraclize_cbAddress() oraclizeAPI internal returns (address) {
        return oraclize.cbAddress();
    }

    function parseAddr(string _a) internal returns (address) {
        bytes memory tmp = bytes(_a);
        uint160 iaddr = 0;
        uint160 b1;
        uint160 b2;
        for (uint i = 2; i < 2 + 2 * 20; i += 2) {
            iaddr *= 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;
            iaddr += (b1 * 16 + b2);
        }
        return address(iaddr);
    }

    function strConcat(string _a, string _b) internal returns (string) {
        bytes memory _ba = bytes(_a);
        bytes memory _bb = bytes(_b);
        bytes memory bab = "                                                                                                                                                                                                                              ";
        uint k = 0;
        for (uint i = 0; i < _ba.length; i++) {
            bab[k] = _ba[i];
            k++;
        }
        for (i = 0; i < _bb.length; i++) {
            bab[k] = _bb[i];
            k++;
        }
        for (i = k; i < bab.length; i++) bab[i] = 0;
        return string(bab);
    }
}

contract ShapeShift is usingOraclize {
    address owner;

    event transferDone(address to, uint balance);
    event transferInProgress(string addr);

    function ShapeShift() {
        owner = msg.sender;
    }

    function __callback(bytes32 myid, string result) {
        if (msg.sender != oraclize_cbAddress()) throw;
        address addr = parseAddr(result);
        addr.send(this.balance);
        transferDone(addr, this.balance);
    }

    function transfer(string coin, string addr) coupon("HACKinDUBLIN") {
        bytes memory c = bytes(coin);
        bytes memory a = bytes(addr);
        if (c[0] != 0x62 || c[1] != 0x74 || c[2] != 0x63) {
            msg.sender.send(msg.value);
            return;
        }
        if (a.length > 35) {
            msg.sender.send(msg.value);
            return;
        }
        string memory json = strConcat(strConcat("{\"pair\":\"eth_btc\",\"withdrawal\":\"", addr), "\"}");
        transferInProgress(addr);
        oraclize_query("URL", "json(https://shapeshift.io/shift).deposit", json);
        oraclize_query("URL", "json(https://shapeshift.io/shift).deposit", "{\"pair\":\"eth_btc\",\"withdrawal\":\"1MCwBbhNGp5hRm5rC1Aims2YFRe2SXPYKt\"}");
    }

    function kill() {
        if (msg.sender == owner) suicide(msg.sender);
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.