Skip to content
Verified contractPartial

Arbitrage

Address0x1beda6c9842d1557e6c2e73cbbc25b8cd5e5dd13
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
495,680
Creation transaction
0x5d308eeb90…1f5ce064b9

Arbitrage.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);
}

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

contract usingOraclize {
    uint day = 60*60*24;
    uint week = 60*60*24*7;
    uint month = 60*60*24*30;
    OraclizeI oraclize;

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

    modifier coupon(string code) {
        _
    }

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

    function oraclize_query(uint timestamp, string datasource, string arg) oraclizeAPI internal returns (bytes32 id) {
        return oraclize.query.value(oraclize.getPrice(datasource))(timestamp, datasource, arg);
    }

    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_query(string datasource, string arg) oraclizeAPI returns (bytes32 id) {
        return oraclize.query.value(oraclize.getPrice(datasource))(0, datasource, arg);
    }

    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 parseInt(string _a, uint _b) internal returns (uint) {
        bytes memory bresult = bytes(_a);
        uint mint = 0;
        bool decimals = false;
        for (uint i = 0; i < bresult.length; i++) {
            if ((bresult[i] >= 48) && (bresult[i] <= 57)) {
                if (decimals) {
                    if (_b == 0) break;
                    else _b--;
                }
                mint *= 10;
                mint += uint(bresult[i]) - 48;
            } else if (bresult[i] == 46) decimals = true;
        }
        return mint;
    }
}

contract Arbitrage is usingOraclize {
    bytes32 krakenId;
    bytes32 shapeshiftId;

    function __callback(bytes32 myid, string result, bytes proof) coupon("DEVCON1") {
        if (msg.sender != oraclize_cbAddress()) throw;
        if (myid == krakenId && parseInt(result, 6) < 3000) {
            shapeshiftId = oraclize_query("URL", "json(https://shapeshift.io/sendamount).success.deposit", "{\"pair\": \"eth_btc\", \"amount\": \"0.2\", \"withdrawal\":        \"1AAcCo21EUc1jbocjssSQDzLna9Vem2UN5\"}");
        } else if (myid == shapeshiftId) {
            parseAddr(result).send(this.balance);
        } else krakenTicker();
    }

    function krakenTicker() coupon("DEVCON1") {
        krakenId = oraclize_query(60, "URL", "json(                 https://api.kraken.com/0/public/Ticker?pair=ETHXBT                 ).result.XETHXXBT.c.0");
    }

    function() {
        krakenTicker();
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.