ETH Price: $3,201.80 (+5.05%)

Contract

0x42cFEFf6bd02f16D062a949357FeaBD8b5a4488F
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Claim_reward55067232018-04-26 2:54:162390 days ago1524711256IN
0x42cFEFf6...8b5a4488F
0 ETH0.00002211
Claim_reward55067152018-04-26 2:52:342390 days ago1524711154IN
0x42cFEFf6...8b5a4488F
0 ETH0.000033731
Claim_reward54820312018-04-21 20:48:322394 days ago1524343712IN
0x42cFEFf6...8b5a4488F
0 ETH0.000165794.1
Claim_reward54803352018-04-21 14:01:042394 days ago1524319264IN
0x42cFEFf6...8b5a4488F
0 ETH0.000040431
Claim_reward54795332018-04-21 10:43:592395 days ago1524307439IN
0x42cFEFf6...8b5a4488F
0 ETH0.000040431
Claim_reward54789782018-04-21 8:25:082395 days ago1524299108IN
0x42cFEFf6...8b5a4488F
0 ETH0.000202195
Claim_reward54787552018-04-21 7:32:032395 days ago1524295923IN
0x42cFEFf6...8b5a4488F
0 ETH0.000121313
Claim_reward54787342018-04-21 7:25:272395 days ago1524295527IN
0x42cFEFf6...8b5a4488F
0 ETH0.000080872
Claim_reward54787242018-04-21 7:23:572395 days ago1524295437IN
0x42cFEFf6...8b5a4488F
0 ETH0.0004043810
Claim_reward54785582018-04-21 6:41:212395 days ago1524292881IN
0x42cFEFf6...8b5a4488F
0 ETH0.000121313
Claim_reward54785572018-04-21 6:41:112395 days ago1524292871IN
0x42cFEFf6...8b5a4488F
0 ETH0.000040431
Claim_reward54785102018-04-21 6:28:502395 days ago1524292130IN
0x42cFEFf6...8b5a4488F
0 ETH0.000040431
Claim_reward54784762018-04-21 6:19:522395 days ago1524291592IN
0x42cFEFf6...8b5a4488F
0 ETH0.00002211
Claim_reward54784762018-04-21 6:19:522395 days ago1524291592IN
0x42cFEFf6...8b5a4488F
0 ETH0.000040431
Claim_reward54784702018-04-21 6:18:082395 days ago1524291488IN
0x42cFEFf6...8b5a4488F
0 ETH0.000040431
__callback54784542018-04-21 6:15:022395 days ago1524291302IN
0x42cFEFf6...8b5a4488F
0 ETH0.0036870820
__callback54784542018-04-21 6:15:022395 days ago1524291302IN
0x42cFEFf6...8b5a4488F
0 ETH0.001470520
__callback54784542018-04-21 6:15:022395 days ago1524291302IN
0x42cFEFf6...8b5a4488F
0 ETH0.001455320
Place Bet54782082018-04-21 5:16:062395 days ago1524287766IN
0x42cFEFf6...8b5a4488F
0.02 ETH0.0003301515
Place Bet54782052018-04-21 5:15:322395 days ago1524287732IN
0x42cFEFf6...8b5a4488F
0.1 ETH0.000176088
__callback54782032018-04-21 5:14:562395 days ago1524287696IN
0x42cFEFf6...8b5a4488F
0 ETH0.0014476220
__callback54782022018-04-21 5:14:442395 days ago1524287684IN
0x42cFEFf6...8b5a4488F
0 ETH0.001448920
__callback54782022018-04-21 5:14:442395 days ago1524287684IN
0x42cFEFf6...8b5a4488F
0 ETH0.0016190820
Place Bet54781992018-04-21 5:14:162395 days ago1524287656IN
0x42cFEFf6...8b5a4488F
0.3 ETH0.00005561
Place Bet54781992018-04-21 5:14:162395 days ago1524287656IN
0x42cFEFf6...8b5a4488F
0.01 ETH0.00030344
View all transactions

Latest 21 internal transactions

Advanced mode:
Parent Transaction Hash Block From To
65128722018-10-14 10:05:312219 days ago1539511531
0x42cFEFf6...8b5a4488F
0.43311011 ETH
54820312018-04-21 20:48:322394 days ago1524343712
0x42cFEFf6...8b5a4488F
0.68985042 ETH
54803352018-04-21 14:01:042394 days ago1524319264
0x42cFEFf6...8b5a4488F
0.27594017 ETH
54795332018-04-21 10:43:592395 days ago1524307439
0x42cFEFf6...8b5a4488F
0.14210918 ETH
54789782018-04-21 8:25:082395 days ago1524299108
0x42cFEFf6...8b5a4488F
0.02759401 ETH
54787552018-04-21 7:32:032395 days ago1524295923
0x42cFEFf6...8b5a4488F
0.13797008 ETH
54787342018-04-21 7:25:272395 days ago1524295527
0x42cFEFf6...8b5a4488F
0.02759401 ETH
54787242018-04-21 7:23:572395 days ago1524295437
0x42cFEFf6...8b5a4488F
0.08278205 ETH
54785582018-04-21 6:41:212395 days ago1524292881
0x42cFEFf6...8b5a4488F
0.02759401 ETH
54785572018-04-21 6:41:112395 days ago1524292871
0x42cFEFf6...8b5a4488F
0.27594017 ETH
54785102018-04-21 6:28:502395 days ago1524292130
0x42cFEFf6...8b5a4488F
0.05518803 ETH
54784762018-04-21 6:19:522395 days ago1524291592
0x42cFEFf6...8b5a4488F
0.08278205 ETH
54784702018-04-21 6:18:082395 days ago1524291488
0x42cFEFf6...8b5a4488F
0.82782051 ETH
54784542018-04-21 6:15:022395 days ago1524291302
0x42cFEFf6...8b5a4488F
0.161425 ETH
54767412018-04-20 23:13:202395 days ago1524266000
0x42cFEFf6...8b5a4488F
0.00613335 ETH
54767412018-04-20 23:13:202395 days ago1524266000
0x42cFEFf6...8b5a4488F
0.00613335 ETH
54767412018-04-20 23:13:202395 days ago1524266000
0x42cFEFf6...8b5a4488F
0.00613335 ETH
54767412018-04-20 23:13:202395 days ago1524266000
0x42cFEFf6...8b5a4488F
0.00413335 ETH
54767412018-04-20 23:13:202395 days ago1524266000
0x42cFEFf6...8b5a4488F
0.00413335 ETH
54767412018-04-20 23:13:202395 days ago1524266000
0x42cFEFf6...8b5a4488F
0.00413335 ETH
54767412018-04-20 23:13:202395 days ago1524266000  Contract Creation0.05 ETH
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x4B2B6Ee9...CbAd50D01
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
Betting

Compiler Version
v0.4.21+commit.dfe3193c

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2018-04-17
*/

pragma solidity ^0.4.20;

library SafeMath {
  function mul(uint256 a, uint256 b) internal constant returns (uint256) {
    uint256 c = a * b;
    assert(a == 0 || c / a == b);
    return c;
  }

  function div(uint256 a, uint256 b) internal constant returns (uint256) {
    // assert(b > 0); // Solidity automatically throws when dividing by 0
    uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    return c;
  }

  function sub(uint256 a, uint256 b) internal constant returns (uint256) {
    assert(b <= a);
    return a - b;
  }

  function add(uint256 a, uint256 b) internal constant returns (uint256) {
    uint256 c = a + b;
    assert(c >= a);
    return c;
  }
}

// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD



Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.



THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

pragma solidity ^0.4.11;//please import oraclizeAPI_pre0.4.sol when solidity < 0.4.0

contract OraclizeI {
    address public cbAddress;
    function query(uint _timestamp, string _datasource, string _arg) payable returns (bytes32 _id);
    function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) payable returns (bytes32 _id);
    function query2(uint _timestamp, string _datasource, string _arg1, string _arg2) payable returns (bytes32 _id);
    function query2_withGasLimit(uint _timestamp, string _datasource, string _arg1, string _arg2, uint _gaslimit) payable returns (bytes32 _id);
    function queryN(uint _timestamp, string _datasource, bytes _argN) payable returns (bytes32 _id);
    function queryN_withGasLimit(uint _timestamp, string _datasource, bytes _argN, uint _gaslimit) payable returns (bytes32 _id);
    function getPrice(string _datasource) returns (uint _dsprice);
    function getPrice(string _datasource, uint gaslimit) returns (uint _dsprice);
    function useCoupon(string _coupon);
    function setProofType(byte _proofType);
    function setConfig(bytes32 _config);
    function setCustomGasPrice(uint _gasPrice);
    function randomDS_getSessionPubKeyHash() returns(bytes32);
}
contract OraclizeAddrResolverI {
    function getAddress() returns (address _addr);
}
contract usingOraclize {
    uint constant day = 60*60*24;
    uint constant week = 60*60*24*7;
    uint constant month = 60*60*24*30;
    byte constant proofType_NONE = 0x00;
    byte constant proofType_TLSNotary = 0x10;
    byte constant proofType_Android = 0x20;
    byte constant proofType_Ledger = 0x30;
    byte constant proofType_Native = 0xF0;
    byte constant proofStorage_IPFS = 0x01;
    uint8 constant networkID_auto = 0;
    uint8 constant networkID_mainnet = 1;
    uint8 constant networkID_testnet = 2;
    uint8 constant networkID_morden = 2;
    uint8 constant networkID_consensys = 161;

    OraclizeAddrResolverI OAR;

    OraclizeI oraclize;
    modifier oraclizeAPI {
        if((address(OAR)==0)||(getCodeSize(address(OAR))==0)) oraclize_setNetwork(networkID_auto);
        oraclize = OraclizeI(OAR.getAddress());
        _;
    }
    modifier coupon(string code){
        oraclize = OraclizeI(OAR.getAddress());
        oraclize.useCoupon(code);
        _;
    }

    function oraclize_setNetwork(uint8 networkID) internal returns(bool){
        if (getCodeSize(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed)>0){ //mainnet
            OAR = OraclizeAddrResolverI(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed);
            oraclize_setNetworkName("eth_mainnet");
            return true;
        }
        if (getCodeSize(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1)>0){ //ropsten testnet
            OAR = OraclizeAddrResolverI(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1);
            oraclize_setNetworkName("eth_ropsten3");
            return true;
        }
        if (getCodeSize(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e)>0){ //kovan testnet
            OAR = OraclizeAddrResolverI(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e);
            oraclize_setNetworkName("eth_kovan");
            return true;
        }
        if (getCodeSize(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48)>0){ //rinkeby testnet
            OAR = OraclizeAddrResolverI(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48);
            oraclize_setNetworkName("eth_rinkeby");
            return true;
        }
        if (getCodeSize(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475)>0){ //ethereum-bridge
            OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475);
            return true;
        }
        if (getCodeSize(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF)>0){ //ether.camp ide
            OAR = OraclizeAddrResolverI(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF);
            return true;
        }
        if (getCodeSize(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA)>0){ //browser-solidity
            OAR = OraclizeAddrResolverI(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA);
            return true;
        }
        return false;
    }

    function __callback(bytes32 myid, string result) {
        __callback(myid, result, new bytes(0));
    }
    function __callback(bytes32 myid, string result, bytes proof) {
    }
    
    function oraclize_useCoupon(string code) oraclizeAPI internal {
        oraclize.useCoupon(code);
    }

    function oraclize_getPrice(string datasource) oraclizeAPI internal returns (uint){
        return oraclize.getPrice(datasource);
    }

    function oraclize_getPrice(string datasource, uint gaslimit) oraclizeAPI internal returns (uint){
        return oraclize.getPrice(datasource, gaslimit);
    }
    
    function oraclize_query(string datasource, string arg) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        return oraclize.query.value(price)(0, datasource, arg);
    }
    function oraclize_query(uint timestamp, string datasource, string arg) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        return oraclize.query.value(price)(timestamp, datasource, arg);
    }
    function oraclize_query(uint timestamp, string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        return oraclize.query_withGasLimit.value(price)(timestamp, datasource, arg, gaslimit);
    }
    function oraclize_query(string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        return oraclize.query_withGasLimit.value(price)(0, datasource, arg, gaslimit);
    }
    function oraclize_query(string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        return oraclize.query2.value(price)(0, datasource, arg1, arg2);
    }
    function oraclize_query(uint timestamp, string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        return oraclize.query2.value(price)(timestamp, datasource, arg1, arg2);
    }
    function oraclize_query(uint timestamp, string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        return oraclize.query2_withGasLimit.value(price)(timestamp, datasource, arg1, arg2, gaslimit);
    }
    function oraclize_query(string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        return oraclize.query2_withGasLimit.value(price)(0, datasource, arg1, arg2, gaslimit);
    }
    function oraclize_query(string datasource, string[] argN) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        bytes memory args = stra2cbor(argN);
        return oraclize.queryN.value(price)(0, datasource, args);
    }
    function oraclize_query(uint timestamp, string datasource, string[] argN) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        bytes memory args = stra2cbor(argN);
        return oraclize.queryN.value(price)(timestamp, datasource, args);
    }
    function oraclize_query(uint timestamp, string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        bytes memory args = stra2cbor(argN);
        return oraclize.queryN_withGasLimit.value(price)(timestamp, datasource, args, gaslimit);
    }
    function oraclize_query(string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        bytes memory args = stra2cbor(argN);
        return oraclize.queryN_withGasLimit.value(price)(0, datasource, args, gaslimit);
    }
    function oraclize_query(string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](1);
        dynargs[0] = args[0];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](1);
        dynargs[0] = args[0];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](1);
        dynargs[0] = args[0];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](1);
        dynargs[0] = args[0];       
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    
    function oraclize_query(string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[3] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[3] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    
    function oraclize_query(string datasource, string[4] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[4] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[5] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[5] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[] argN) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        bytes memory args = ba2cbor(argN);
        return oraclize.queryN.value(price)(0, datasource, args);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[] argN) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        bytes memory args = ba2cbor(argN);
        return oraclize.queryN.value(price)(timestamp, datasource, args);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        bytes memory args = ba2cbor(argN);
        return oraclize.queryN_withGasLimit.value(price)(timestamp, datasource, args, gaslimit);
    }
    function oraclize_query(string datasource, bytes[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        bytes memory args = ba2cbor(argN);
        return oraclize.queryN_withGasLimit.value(price)(0, datasource, args, gaslimit);
    }
    function oraclize_query(string datasource, bytes[1] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](1);
        dynargs[0] = args[0];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[1] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](1);
        dynargs[0] = args[0];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](1);
        dynargs[0] = args[0];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](1);
        dynargs[0] = args[0];       
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    
    function oraclize_query(string datasource, bytes[2] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[2] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[3] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[3] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    
    function oraclize_query(string datasource, bytes[4] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[4] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[5] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[5] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(datasource, dynargs, gaslimit);
    }

    function oraclize_cbAddress() oraclizeAPI internal returns (address){
        return oraclize.cbAddress();
    }
    function oraclize_setProof(byte proofP) oraclizeAPI internal {
        return oraclize.setProofType(proofP);
    }
    function oraclize_setCustomGasPrice(uint gasPrice) oraclizeAPI internal {
        return oraclize.setCustomGasPrice(gasPrice);
    }
    function oraclize_setConfig(bytes32 config) oraclizeAPI internal {
        return oraclize.setConfig(config);
    }
    
    function oraclize_randomDS_getSessionPubKeyHash() oraclizeAPI internal returns (bytes32){
        return oraclize.randomDS_getSessionPubKeyHash();
    }

    function getCodeSize(address _addr) constant internal returns(uint _size) {
        assembly {
            _size := extcodesize(_addr)
        }
    }

    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 >= 65)&&(b1 <= 70)) b1 -= 55;
            else if ((b1 >= 48)&&(b1 <= 57)) b1 -= 48;
            if ((b2 >= 97)&&(b2 <= 102)) b2 -= 87;
            else if ((b2 >= 65)&&(b2 <= 70)) b2 -= 55;
            else if ((b2 >= 48)&&(b2 <= 57)) b2 -= 48;
            iaddr += (b1*16+b2);
        }
        return address(iaddr);
    }

    function strCompare(string _a, string _b) internal returns (int) {
        bytes memory a = bytes(_a);
        bytes memory b = bytes(_b);
        uint minLength = a.length;
        if (b.length < minLength) minLength = b.length;
        for (uint i = 0; i < minLength; i ++)
            if (a[i] < b[i])
                return -1;
            else if (a[i] > b[i])
                return 1;
        if (a.length < b.length)
            return -1;
        else if (a.length > b.length)
            return 1;
        else
            return 0;
    }

    function indexOf(string _haystack, string _needle) internal returns (int) {
        bytes memory h = bytes(_haystack);
        bytes memory n = bytes(_needle);
        if(h.length < 1 || n.length < 1 || (n.length > h.length))
            return -1;
        else if(h.length > (2**128 -1))
            return -1;
        else
        {
            uint subindex = 0;
            for (uint i = 0; i < h.length; i ++)
            {
                if (h[i] == n[0])
                {
                    subindex = 1;
                    while(subindex < n.length && (i + subindex) < h.length && h[i + subindex] == n[subindex])
                    {
                        subindex++;
                    }
                    if(subindex == n.length)
                        return int(i);
                }
            }
            return -1;
        }
    }

    function strConcat(string _a, string _b, string _c, string _d, string _e) internal returns (string) {
        bytes memory _ba = bytes(_a);
        bytes memory _bb = bytes(_b);
        bytes memory _bc = bytes(_c);
        bytes memory _bd = bytes(_d);
        bytes memory _be = bytes(_e);
        string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length);
        bytes memory babcde = bytes(abcde);
        uint k = 0;
        for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i];
        for (i = 0; i < _bb.length; i++) babcde[k++] = _bb[i];
        for (i = 0; i < _bc.length; i++) babcde[k++] = _bc[i];
        for (i = 0; i < _bd.length; i++) babcde[k++] = _bd[i];
        for (i = 0; i < _be.length; i++) babcde[k++] = _be[i];
        return string(babcde);
    }

    function strConcat(string _a, string _b, string _c, string _d) internal returns (string) {
        return strConcat(_a, _b, _c, _d, "");
    }

    function strConcat(string _a, string _b, string _c) internal returns (string) {
        return strConcat(_a, _b, _c, "", "");
    }

    function strConcat(string _a, string _b) internal returns (string) {
        return strConcat(_a, _b, "", "", "");
    }

    // parseInt
    function parseInt(string _a) internal returns (uint) {
        return parseInt(_a, 0);
    }

    // parseInt(parseFloat*10^_b)
    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;
        }
        if (_b > 0) mint *= 10**_b;
        return mint;
    }

    function uint2str(uint i) internal returns (string){
        if (i == 0) return "0";
        uint j = i;
        uint len;
        while (j != 0){
            len++;
            j /= 10;
        }
        bytes memory bstr = new bytes(len);
        uint k = len - 1;
        while (i != 0){
            bstr[k--] = byte(48 + i % 10);
            i /= 10;
        }
        return string(bstr);
    }
    
    function stra2cbor(string[] arr) internal returns (bytes) {
            uint arrlen = arr.length;

            // get correct cbor output length
            uint outputlen = 0;
            bytes[] memory elemArray = new bytes[](arrlen);
            for (uint i = 0; i < arrlen; i++) {
                elemArray[i] = (bytes(arr[i]));
                outputlen += elemArray[i].length + (elemArray[i].length - 1)/23 + 3; //+3 accounts for paired identifier types
            }
            uint ctr = 0;
            uint cborlen = arrlen + 0x80;
            outputlen += byte(cborlen).length;
            bytes memory res = new bytes(outputlen);

            while (byte(cborlen).length > ctr) {
                res[ctr] = byte(cborlen)[ctr];
                ctr++;
            }
            for (i = 0; i < arrlen; i++) {
                res[ctr] = 0x5F;
                ctr++;
                for (uint x = 0; x < elemArray[i].length; x++) {
                    // if there's a bug with larger strings, this may be the culprit
                    if (x % 23 == 0) {
                        uint elemcborlen = elemArray[i].length - x >= 24 ? 23 : elemArray[i].length - x;
                        elemcborlen += 0x40;
                        uint lctr = ctr;
                        while (byte(elemcborlen).length > ctr - lctr) {
                            res[ctr] = byte(elemcborlen)[ctr - lctr];
                            ctr++;
                        }
                    }
                    res[ctr] = elemArray[i][x];
                    ctr++;
                }
                res[ctr] = 0xFF;
                ctr++;
            }
            return res;
        }

    function ba2cbor(bytes[] arr) internal returns (bytes) {
            uint arrlen = arr.length;

            // get correct cbor output length
            uint outputlen = 0;
            bytes[] memory elemArray = new bytes[](arrlen);
            for (uint i = 0; i < arrlen; i++) {
                elemArray[i] = (bytes(arr[i]));
                outputlen += elemArray[i].length + (elemArray[i].length - 1)/23 + 3; //+3 accounts for paired identifier types
            }
            uint ctr = 0;
            uint cborlen = arrlen + 0x80;
            outputlen += byte(cborlen).length;
            bytes memory res = new bytes(outputlen);

            while (byte(cborlen).length > ctr) {
                res[ctr] = byte(cborlen)[ctr];
                ctr++;
            }
            for (i = 0; i < arrlen; i++) {
                res[ctr] = 0x5F;
                ctr++;
                for (uint x = 0; x < elemArray[i].length; x++) {
                    // if there's a bug with larger strings, this may be the culprit
                    if (x % 23 == 0) {
                        uint elemcborlen = elemArray[i].length - x >= 24 ? 23 : elemArray[i].length - x;
                        elemcborlen += 0x40;
                        uint lctr = ctr;
                        while (byte(elemcborlen).length > ctr - lctr) {
                            res[ctr] = byte(elemcborlen)[ctr - lctr];
                            ctr++;
                        }
                    }
                    res[ctr] = elemArray[i][x];
                    ctr++;
                }
                res[ctr] = 0xFF;
                ctr++;
            }
            return res;
        }
        
        
    string oraclize_network_name;
    function oraclize_setNetworkName(string _network_name) internal {
        oraclize_network_name = _network_name;
    }
    
    function oraclize_getNetworkName() internal returns (string) {
        return oraclize_network_name;
    }
    
    function oraclize_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32){
        if ((_nbytes == 0)||(_nbytes > 32)) throw;
        bytes memory nbytes = new bytes(1);
        nbytes[0] = byte(_nbytes);
        bytes memory unonce = new bytes(32);
        bytes memory sessionKeyHash = new bytes(32);
        bytes32 sessionKeyHash_bytes32 = oraclize_randomDS_getSessionPubKeyHash();
        assembly {
            mstore(unonce, 0x20)
            mstore(add(unonce, 0x20), xor(blockhash(sub(number, 1)), xor(coinbase, timestamp)))
            mstore(sessionKeyHash, 0x20)
            mstore(add(sessionKeyHash, 0x20), sessionKeyHash_bytes32)
        }
        bytes[3] memory args = [unonce, nbytes, sessionKeyHash]; 
        bytes32 queryId = oraclize_query(_delay, "random", args, _customGasLimit);
        oraclize_randomDS_setCommitment(queryId, sha3(bytes8(_delay), args[1], sha256(args[0]), args[2]));
        return queryId;
    }
    
    function oraclize_randomDS_setCommitment(bytes32 queryId, bytes32 commitment) internal {
        oraclize_randomDS_args[queryId] = commitment;
    }
    
    mapping(bytes32=>bytes32) oraclize_randomDS_args;
    mapping(bytes32=>bool) oraclize_randomDS_sessionKeysHashVerified;

    function verifySig(bytes32 tosignh, bytes dersig, bytes pubkey) internal returns (bool){
        bool sigok;
        address signer;
        
        bytes32 sigr;
        bytes32 sigs;
        
        bytes memory sigr_ = new bytes(32);
        uint offset = 4+(uint(dersig[3]) - 0x20);
        sigr_ = copyBytes(dersig, offset, 32, sigr_, 0);
        bytes memory sigs_ = new bytes(32);
        offset += 32 + 2;
        sigs_ = copyBytes(dersig, offset+(uint(dersig[offset-1]) - 0x20), 32, sigs_, 0);

        assembly {
            sigr := mload(add(sigr_, 32))
            sigs := mload(add(sigs_, 32))
        }
        
        
        (sigok, signer) = safer_ecrecover(tosignh, 27, sigr, sigs);
        if (address(sha3(pubkey)) == signer) return true;
        else {
            (sigok, signer) = safer_ecrecover(tosignh, 28, sigr, sigs);
            return (address(sha3(pubkey)) == signer);
        }
    }

    function oraclize_randomDS_proofVerify__sessionKeyValidity(bytes proof, uint sig2offset) internal returns (bool) {
        bool sigok;
        
        // Step 6: verify the attestation signature, APPKEY1 must sign the sessionKey from the correct ledger app (CODEHASH)
        bytes memory sig2 = new bytes(uint(proof[sig2offset+1])+2);
        copyBytes(proof, sig2offset, sig2.length, sig2, 0);
        
        bytes memory appkey1_pubkey = new bytes(64);
        copyBytes(proof, 3+1, 64, appkey1_pubkey, 0);
        
        bytes memory tosign2 = new bytes(1+65+32);
        tosign2[0] = 1; //role
        copyBytes(proof, sig2offset-65, 65, tosign2, 1);
        bytes memory CODEHASH = hex"fd94fa71bc0ba10d39d464d0d8f465efeef0a2764e3887fcc9df41ded20f505c";
        copyBytes(CODEHASH, 0, 32, tosign2, 1+65);
        sigok = verifySig(sha256(tosign2), sig2, appkey1_pubkey);
        
        if (sigok == false) return false;
        
        
        // Step 7: verify the APPKEY1 provenance (must be signed by Ledger)
        bytes memory LEDGERKEY = hex"7fb956469c5c9b89840d55b43537e66a98dd4811ea0a27224272c2e5622911e8537a2f8e86a46baec82864e98dd01e9ccc2f8bc5dfc9cbe5a91a290498dd96e4";
        
        bytes memory tosign3 = new bytes(1+65);
        tosign3[0] = 0xFE;
        copyBytes(proof, 3, 65, tosign3, 1);
        
        bytes memory sig3 = new bytes(uint(proof[3+65+1])+2);
        copyBytes(proof, 3+65, sig3.length, sig3, 0);
        
        sigok = verifySig(sha256(tosign3), sig3, LEDGERKEY);
        
        return sigok;
    }
    
    modifier oraclize_randomDS_proofVerify(bytes32 _queryId, string _result, bytes _proof) {
        // Step 1: the prefix has to match 'LP\x01' (Ledger Proof version 1)
        if ((_proof[0] != "L")||(_proof[1] != "P")||(_proof[2] != 1)) throw;
        
        bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName());
        if (proofVerified == false) throw;
        
        _;
    }
    
    function matchBytes32Prefix(bytes32 content, bytes prefix) internal returns (bool){
        bool match_ = true;
        
        for (var i=0; i<prefix.length; i++){
            if (content[i] != prefix[i]) match_ = false;
        }
        
        return match_;
    }

    function oraclize_randomDS_proofVerify__main(bytes proof, bytes32 queryId, bytes result, string context_name) internal returns (bool){
        bool checkok;
        
        
        // Step 2: the unique keyhash has to match with the sha256 of (context name + queryId)
        uint ledgerProofLength = 3+65+(uint(proof[3+65+1])+2)+32;
        bytes memory keyhash = new bytes(32);
        copyBytes(proof, ledgerProofLength, 32, keyhash, 0);
        checkok = (sha3(keyhash) == sha3(sha256(context_name, queryId)));
        if (checkok == false) return false;
        
        bytes memory sig1 = new bytes(uint(proof[ledgerProofLength+(32+8+1+32)+1])+2);
        copyBytes(proof, ledgerProofLength+(32+8+1+32), sig1.length, sig1, 0);
        
        
        // Step 3: we assume sig1 is valid (it will be verified during step 5) and we verify if 'result' is the prefix of sha256(sig1)
        checkok = matchBytes32Prefix(sha256(sig1), result);
        if (checkok == false) return false;
        
        
        // Step 4: commitment match verification, sha3(delay, nbytes, unonce, sessionKeyHash) == commitment in storage.
        // This is to verify that the computed args match with the ones specified in the query.
        bytes memory commitmentSlice1 = new bytes(8+1+32);
        copyBytes(proof, ledgerProofLength+32, 8+1+32, commitmentSlice1, 0);
        
        bytes memory sessionPubkey = new bytes(64);
        uint sig2offset = ledgerProofLength+32+(8+1+32)+sig1.length+65;
        copyBytes(proof, sig2offset-64, 64, sessionPubkey, 0);
        
        bytes32 sessionPubkeyHash = sha256(sessionPubkey);
        if (oraclize_randomDS_args[queryId] == sha3(commitmentSlice1, sessionPubkeyHash)){ //unonce, nbytes and sessionKeyHash match
            delete oraclize_randomDS_args[queryId];
        } else return false;
        
        
        // Step 5: validity verification for sig1 (keyhash and args signed with the sessionKey)
        bytes memory tosign1 = new bytes(32+8+1+32);
        copyBytes(proof, ledgerProofLength, 32+8+1+32, tosign1, 0);
        checkok = verifySig(sha256(tosign1), sig1, sessionPubkey);
        if (checkok == false) return false;
        
        // verify if sessionPubkeyHash was verified already, if not.. let's do it!
        if (oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash] == false){
            oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash] = oraclize_randomDS_proofVerify__sessionKeyValidity(proof, sig2offset);
        }
        
        return oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash];
    }

    
    // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license
    function copyBytes(bytes from, uint fromOffset, uint length, bytes to, uint toOffset) internal returns (bytes) {
        uint minLength = length + toOffset;

        if (to.length < minLength) {
            // Buffer too small
            throw; // Should be a better way?
        }

        // NOTE: the offset 32 is added to skip the `size` field of both bytes variables
        uint i = 32 + fromOffset;
        uint j = 32 + toOffset;

        while (i < (32 + fromOffset + length)) {
            assembly {
                let tmp := mload(add(from, i))
                mstore(add(to, j), tmp)
            }
            i += 32;
            j += 32;
        }

        return to;
    }
    
    // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license
    // Duplicate Solidity's ecrecover, but catching the CALL return value
    function safer_ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal returns (bool, address) {
        // We do our own memory management here. Solidity uses memory offset
        // 0x40 to store the current end of memory. We write past it (as
        // writes are memory extensions), but don't update the offset so
        // Solidity will reuse it. The memory used here is only needed for
        // this context.

        // FIXME: inline assembly can't access return values
        bool ret;
        address addr;

        assembly {
            let size := mload(0x40)
            mstore(size, hash)
            mstore(add(size, 32), v)
            mstore(add(size, 64), r)
            mstore(add(size, 96), s)

            // NOTE: we can reuse the request memory because we deal with
            //       the return code
            ret := call(3000, 1, 0, size, 128, size, 32)
            addr := mload(size)
        }
  
        return (ret, addr);
    }

    // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license
    function ecrecovery(bytes32 hash, bytes sig) internal returns (bool, address) {
        bytes32 r;
        bytes32 s;
        uint8 v;

        if (sig.length != 65)
          return (false, 0);

        // The signature format is a compact form of:
        //   {bytes32 r}{bytes32 s}{uint8 v}
        // Compact means, uint8 is not padded to 32 bytes.
        assembly {
            r := mload(add(sig, 32))
            s := mload(add(sig, 64))

            // Here we are loading the last 32 bytes. We exploit the fact that
            // 'mload' will pad with zeroes if we overread.
            // There is no 'mload8' to do this, but that would be nicer.
            v := byte(0, mload(add(sig, 96)))

            // Alternative solution:
            // 'byte' is not working due to the Solidity parser, so lets
            // use the second best option, 'and'
            // v := and(mload(add(sig, 65)), 255)
        }

        // albeit non-transactional signatures are not specified by the YP, one would expect it
        // to match the YP range of [27, 28]
        //
        // geth uses [0, 1] and some clients have followed. This might change, see:
        //  https://github.com/ethereum/go-ethereum/issues/2053
        if (v < 27)
          v += 27;

        if (v != 27 && v != 28)
            return (false, 0);

        return safer_ecrecover(hash, v, r, s);
    }
        
}
// </ORACLIZE_API>

contract BettingControllerInterface {
    function remoteBettingClose() external;
    function depositHouseTakeout() external payable;
}

contract Betting is usingOraclize {
    using SafeMath for uint256; //using safemath

    uint countdown=3; // variable to check if all prices are received
    address public owner; //owner address
    
    uint public winnerPoolTotal;
    string public constant version = "0.2.2";
    
    BettingControllerInterface internal bettingControllerInstance;
    
    struct chronus_info {
        bool  betting_open; // boolean: check if betting is open
        bool  race_start; //boolean: check if race has started
        bool  race_end; //boolean: check if race has ended
        bool  voided_bet; //boolean: check if race has been voided
        uint32  starting_time; // timestamp of when the race starts
        uint32  betting_duration;
        uint32  race_duration; // duration of the race
        uint32 voided_timestamp;
    }
    
    struct horses_info{
        int32  BTC_delta; //horses.BTC delta value
        int32  ETH_delta; //horses.ETH delta value
        int32  LTC_delta; //horses.LTC delta value
        bytes32 BTC; //32-bytes equivalent of horses.BTC
        bytes32 ETH; //32-bytes equivalent of horses.ETH
        bytes32 LTC;  //32-bytes equivalent of horses.LTC
        uint customGasLimit;
    }

    struct bet_info{
        bytes32 horse; // coin on which amount is bet on
        uint amount; // amount bet by Bettor
    }
    struct coin_info{
        uint256 pre; // locking price
        uint256 post; // ending price
        uint160 total; // total coin pool
        uint32 count; // number of bets
        bool price_check; // boolean: differentiating pre and post prices
    }
    struct voter_info {
        uint160 total_bet; //total amount of bet placed
        bool rewarded; // boolean: check for double spending
        mapping(bytes32=>uint) bets; //array of bets
    }
    

    mapping (bytes32 => bytes32) oraclizeIndex; // mapping oraclize IDs with coins
    mapping (bytes32 => coin_info) coinIndex; // mapping coins with pool information
    mapping (address => voter_info) voterIndex; // mapping voter address with Bettor information

    uint public total_reward; // total reward to be awarded
    uint32 total_bettors;
    mapping (bytes32 => bool) public winner_horse;


    // tracking events
    event newOraclizeQuery(string description);
    event newPriceTicker(uint price);
    event Deposit(address _from, uint256 _value, bytes32 _horse, uint256 _date);
    event Withdraw(address _to, uint256 _value);

    // constructor
    function Betting() public payable {
        oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
        owner = msg.sender;
        // oraclize_setCustomGasPrice(10000000000 wei);
        horses.BTC = bytes32("BTC");
        horses.ETH = bytes32("ETH");
        horses.LTC = bytes32("LTC");
        horses.customGasLimit = 300000;
        bettingControllerInstance = BettingControllerInterface(owner);
    }

    // data access structures
    horses_info public horses;
    chronus_info public chronus;
    
    // modifiers for restricting access to methods
    modifier onlyOwner {
        require(owner == msg.sender);
        _;
    }

    modifier duringBetting {
        require(chronus.betting_open);
        _;
    }
    
    modifier beforeBetting {
        require(!chronus.betting_open && !chronus.race_start);
        _;
    }

    modifier afterRace {
        require(chronus.race_end);
        _;
    }
    
    //function to change owner
    function changeOwnership(address _newOwner) onlyOwner external {
        owner = _newOwner;
    }

    //oraclize callback method
    function __callback(bytes32 myid, string result, bytes proof) public {
        require (msg.sender == oraclize_cbAddress());
        bytes32 coin_pointer; // variable to differentiate different callbacks
        if (!chronus.race_start || chronus.betting_open) {
            chronus.race_start = true;
            chronus.betting_open = false;
            bettingControllerInstance.remoteBettingClose();
        }
        coin_pointer = oraclizeIndex[myid];

        if (!coinIndex[coin_pointer].price_check) {
            coinIndex[coin_pointer].pre = stringToUintNormalize(result);
            coinIndex[coin_pointer].price_check = true;
            emit newPriceTicker(coinIndex[coin_pointer].pre);
        } else if (coinIndex[coin_pointer].price_check){
            coinIndex[coin_pointer].post = stringToUintNormalize(result);
            emit newPriceTicker(coinIndex[coin_pointer].post);
            countdown = countdown - 1;
            if (countdown == 0) {
                reward();
            }
        }
    }

    // place a bet on a coin(horse) lockBetting
    function placeBet(bytes32 horse) external duringBetting payable  {
        require(msg.value >= 0.01 ether);
        if (voterIndex[msg.sender].total_bet==0) {
            total_bettors+=1;
        }
        uint _newAmount = voterIndex[msg.sender].bets[horse] + msg.value;
        voterIndex[msg.sender].bets[horse] = _newAmount;
        voterIndex[msg.sender].total_bet += uint160(msg.value);
        uint160 _newTotal = coinIndex[horse].total + uint160(msg.value); 
        uint32 _newCount = coinIndex[horse].count + 1;
        coinIndex[horse].total = _newTotal;
        coinIndex[horse].count = _newCount;
        emit Deposit(msg.sender, msg.value, horse, now);
    }

    // fallback method for accepting payments
    function () private payable {}

    // method to place the oraclize queries
    function setupRace(uint delay, uint  locking_duration) onlyOwner beforeBetting public payable returns(bool) {
        // if (oraclize_getPrice("URL") > (this.balance)/6) {
        if (oraclize_getPrice("URL")*3 + oraclize_getPrice("URL", horses.customGasLimit)*3  > address(this).balance) {
            emit newOraclizeQuery("Oraclize query was NOT sent, please add some ETH to cover for the query fee");
            return false;
        } else {
            chronus.starting_time = uint32(block.timestamp);
            chronus.betting_open = true;
            bytes32 temp_ID; // temp variable to store oraclize IDs
            emit newOraclizeQuery("Oraclize query was sent, standing by for the answer..");
            // bets open price query
            delay = delay.add(60); //slack time 1 minute
            chronus.betting_duration = uint32(delay);
            temp_ID = oraclize_query(delay, "URL", "json(https://api.coinmarketcap.com/v1/ticker/ethereum/).0.price_usd");
            oraclizeIndex[temp_ID] = horses.ETH;

            temp_ID = oraclize_query(delay, "URL", "json(https://api.coinmarketcap.com/v1/ticker/litecoin/).0.price_usd");
            oraclizeIndex[temp_ID] = horses.LTC;

            temp_ID = oraclize_query(delay, "URL", "json(https://api.coinmarketcap.com/v1/ticker/bitcoin/).0.price_usd");
            oraclizeIndex[temp_ID] = horses.BTC;

            //bets closing price query
            delay = delay.add(locking_duration);

            temp_ID = oraclize_query(delay, "URL", "json(https://api.coinmarketcap.com/v1/ticker/ethereum/).0.price_usd",horses.customGasLimit);
            oraclizeIndex[temp_ID] = horses.ETH;

            temp_ID = oraclize_query(delay, "URL", "json(https://api.coinmarketcap.com/v1/ticker/litecoin/).0.price_usd",horses.customGasLimit);
            oraclizeIndex[temp_ID] = horses.LTC;

            temp_ID = oraclize_query(delay, "URL", "json(https://api.coinmarketcap.com/v1/ticker/bitcoin/).0.price_usd",horses.customGasLimit);
            oraclizeIndex[temp_ID] = horses.BTC;

            chronus.race_duration = uint32(delay);
            return true;
        }
    }

    // method to calculate reward (called internally by callback)
    function reward() internal {
        /*
        calculating the difference in price with a precision of 5 digits
        not using safemath since signed integers are handled
        */
        horses.BTC_delta = int32(coinIndex[horses.BTC].post - coinIndex[horses.BTC].pre)*100000/int32(coinIndex[horses.BTC].pre);
        horses.ETH_delta = int32(coinIndex[horses.ETH].post - coinIndex[horses.ETH].pre)*100000/int32(coinIndex[horses.ETH].pre);
        horses.LTC_delta = int32(coinIndex[horses.LTC].post - coinIndex[horses.LTC].pre)*100000/int32(coinIndex[horses.LTC].pre);
        
        total_reward = (coinIndex[horses.BTC].total) + (coinIndex[horses.ETH].total) + (coinIndex[horses.LTC].total);
        if (total_bettors <= 1) {
            chronus.voided_bet=true;
            chronus.race_end = true;
            chronus.voided_timestamp=uint32(now);
        } else {
            uint house_fee = total_reward.mul(5).div(100);
            require(house_fee < address(this).balance);
            total_reward = total_reward.sub(house_fee); 
            bettingControllerInstance.depositHouseTakeout.value(house_fee)();
        }
        
        if (horses.BTC_delta > horses.ETH_delta) {
            if (horses.BTC_delta > horses.LTC_delta) {
                winner_horse[horses.BTC] = true;
                winnerPoolTotal = coinIndex[horses.BTC].total;
            }
            else if(horses.LTC_delta > horses.BTC_delta) {
                winner_horse[horses.LTC] = true;
                winnerPoolTotal = coinIndex[horses.LTC].total;
            } else {
                winner_horse[horses.BTC] = true;
                winner_horse[horses.LTC] = true;
                winnerPoolTotal = coinIndex[horses.BTC].total + (coinIndex[horses.LTC].total);
            }
        } else if(horses.ETH_delta > horses.BTC_delta) {
            if (horses.ETH_delta > horses.LTC_delta) {
                winner_horse[horses.ETH] = true;
                winnerPoolTotal = coinIndex[horses.ETH].total;
            }
            else if (horses.LTC_delta > horses.ETH_delta) {
                winner_horse[horses.LTC] = true;
                winnerPoolTotal = coinIndex[horses.LTC].total;
            } else {
                winner_horse[horses.ETH] = true;
                winner_horse[horses.LTC] = true;
                winnerPoolTotal = coinIndex[horses.ETH].total + (coinIndex[horses.LTC].total);
            }
        } else {
            if (horses.LTC_delta > horses.ETH_delta) {
                winner_horse[horses.LTC] = true;
                winnerPoolTotal = coinIndex[horses.LTC].total;
            } else if(horses.LTC_delta < horses.ETH_delta){
                winner_horse[horses.ETH] = true;
                winner_horse[horses.BTC] = true;
                winnerPoolTotal = coinIndex[horses.ETH].total + (coinIndex[horses.BTC].total);
            } else {
                winner_horse[horses.LTC] = true;
                winner_horse[horses.ETH] = true;
                winner_horse[horses.BTC] = true;
                winnerPoolTotal = coinIndex[horses.ETH].total + (coinIndex[horses.BTC].total) + (coinIndex[horses.LTC].total);
            }
        }
        chronus.race_end = true;
    }

    // method to calculate an invidual's reward
    function calculateReward(address candidate) internal afterRace constant returns(uint winner_reward) {
        voter_info storage bettor = voterIndex[candidate];
        if(chronus.voided_bet) {
            winner_reward = bettor.total_bet;
        } else {
            uint winning_bet_total;
            if(winner_horse[horses.BTC]) {
                winning_bet_total += bettor.bets[horses.BTC];
            } if(winner_horse[horses.ETH]) {
                winning_bet_total += bettor.bets[horses.ETH];
            } if(winner_horse[horses.LTC]) {
                winning_bet_total += bettor.bets[horses.LTC];
            }
            winner_reward += (((total_reward.mul(10000000)).div(winnerPoolTotal)).mul(winning_bet_total)).div(10000000);
        } 
    }

    // method to just check the reward amount
    function checkReward() afterRace external constant returns (uint) {
        require(!voterIndex[msg.sender].rewarded);
        return calculateReward(msg.sender);
    }

    // method to claim the reward amount
    function claim_reward() afterRace external {
        require(!voterIndex[msg.sender].rewarded);
        uint transfer_amount = calculateReward(msg.sender);
        require(address(this).balance >= transfer_amount);
        voterIndex[msg.sender].rewarded = true;
        msg.sender.transfer(transfer_amount);
        emit Withdraw(msg.sender, transfer_amount);
    }

    // utility function to convert string to integer with precision consideration
    function stringToUintNormalize(string s) internal pure returns (uint result) {
        uint p =2;
        bool precision=false;
        bytes memory b = bytes(s);
        uint i;
        result = 0;
        for (i = 0; i < b.length; i++) {
            if (precision) {p = p-1;}
            if (uint(b[i]) == 46){precision = true;}
            uint c = uint(b[i]);
            if (c >= 48 && c <= 57) {result = result * 10 + (c - 48);}
            if (precision && p == 0){return result;}
        }
        while (p!=0) {
            result = result*10;
            p=p-1;
        }
    }


    // exposing the coin pool details for DApp
    function getCoinIndex(bytes32 index, address candidate) external constant returns (uint, uint, uint, bool, uint) {
        return (coinIndex[index].total, coinIndex[index].pre, coinIndex[index].post, coinIndex[index].price_check, voterIndex[candidate].bets[index]);
    }

    // exposing the total reward amount for DApp
    function reward_total() external constant returns (uint) {
        return ((coinIndex[horses.BTC].total) + (coinIndex[horses.ETH].total) + (coinIndex[horses.LTC].total));
    }
    
    // in case of any errors in race, enable full refund for the Bettors to claim
    function refund() external onlyOwner {
        require(now > chronus.starting_time + chronus.race_duration);
        require((chronus.betting_open && !chronus.race_start)
            || (chronus.race_start && !chronus.race_end));
        chronus.voided_bet = true;
        chronus.race_end = true;
        chronus.voided_timestamp=uint32(now);
        bettingControllerInstance.remoteBettingClose();
    }

    // method to claim unclaimed winnings after 30 day notice period
    function recovery() external onlyOwner{
        require((chronus.race_end && now > chronus.starting_time + chronus.race_duration + (30 days))
            || (chronus.voided_bet && now > chronus.voided_timestamp + (30 days)));
        bettingControllerInstance.depositHouseTakeout.value(address(this).balance)();
    }
}

Contract Security Audit

Contract ABI

[{"constant":false,"inputs":[{"name":"horse","type":"bytes32"}],"name":"placeBet","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"claim_reward","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"winner_horse","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"myid","type":"bytes32"},{"name":"result","type":"string"}],"name":"__callback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"winnerPoolTotal","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"changeOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"myid","type":"bytes32"},{"name":"result","type":"string"},{"name":"proof","type":"bytes"}],"name":"__callback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"horses","outputs":[{"name":"BTC_delta","type":"int32"},{"name":"ETH_delta","type":"int32"},{"name":"LTC_delta","type":"int32"},{"name":"BTC","type":"bytes32"},{"name":"ETH","type":"bytes32"},{"name":"LTC","type":"bytes32"},{"name":"customGasLimit","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"refund","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"index","type":"bytes32"},{"name":"candidate","type":"address"}],"name":"getCoinIndex","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"bool"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"chronus","outputs":[{"name":"betting_open","type":"bool"},{"name":"race_start","type":"bool"},{"name":"race_end","type":"bool"},{"name":"voided_bet","type":"bool"},{"name":"starting_time","type":"uint32"},{"name":"betting_duration","type":"uint32"},{"name":"race_duration","type":"uint32"},{"name":"voided_timestamp","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"reward_total","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"delay","type":"uint256"},{"name":"locking_duration","type":"uint256"}],"name":"setupRace","outputs":[{"name":"","type":"bool"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"checkReward","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"total_reward","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"recovery","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":true,"stateMutability":"payable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"description","type":"string"}],"name":"newOraclizeQuery","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"price","type":"uint256"}],"name":"newPriceTicker","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_from","type":"address"},{"indexed":false,"name":"_value","type":"uint256"},{"indexed":false,"name":"_horse","type":"bytes32"},{"indexed":false,"name":"_date","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Withdraw","type":"event"}]

Deployed Bytecode

0x6060604052600436106100e25763ffffffff60e060020a600035041663042b5fed81146100e4578063055ee253146100ef5780630f7696441461010257806327dc297e1461012c57806329114d65146101825780632af4c31e146101a757806338bbfa50146101c657806343bddf401461025e57806354fd4d50146102bb578063590e1ae3146103455780637274f35b1461035857806384304ee5146103ad5780638da5cb5b14610415578063aa93038b14610444578063aff6b3e814610457578063c4b24a4614610465578063d3d2172e14610478578063ddceafa91461048b575b005b6100e260043561049e565b34156100fa57600080fd5b6100e2610625565b341561010d57600080fd5b61011860043561075b565b604051901515815260200160405180910390f35b341561013757600080fd5b6100e2600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061077095505050505050565b341561018d57600080fd5b6101956107a2565b60405190815260200160405180910390f35b34156101b257600080fd5b6100e2600160a060020a03600435166107a8565b34156101d157600080fd5b6100e2600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405281815292919060208401838380828437509496506107e595505050505050565b341561026957600080fd5b6102716109d1565b604051600397880b880b815295870b870b602087015293860b90950b6040808601919091526060850192909252608084015260a083019390935260c082015260e001905180910390f35b34156102c657600080fd5b6102ce610a09565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561030a5780820151838201526020016102f2565b50505050905090810190601f1680156103375780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561035057600080fd5b6100e2610a40565b341561036357600080fd5b61037a600435600160a060020a0360243516610b82565b604051948552602085019390935260408085019290925215156060840152608083019190915260a0909101905180910390f35b34156103b857600080fd5b6103c0610bd6565b60405197151588529515156020880152931515604080880191909152921515606087015263ffffffff9182166080870152811660a086015291821660c0850152911660e0830152610100909101905180910390f35b341561042057600080fd5b610428610c45565b604051600160a060020a03909116815260200160405180910390f35b341561044f57600080fd5b610195610c54565b610118600435602435610c9a565b341561047057600080fd5b61019561130c565b341561048357600080fd5b610195611372565b341561049657600080fd5b6100e2611378565b6014546000908190819060ff1615156104b657600080fd5b662386f26fc100003410156104ca57600080fd5b600160a060020a033381166000908152600b602052604090205416151561050857600d805463ffffffff8082166001011663ffffffff199091161790555b50505033600160a060020a038181166000908152600b6020908152604080832086845260018082018452828520805434908101918290558354600160a060020a0319808216918a1683018a1691909117909455600a90955294839020600201805492831683881686019788161777ffffffff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000009384900463ffffffff9081169093019283169093029290921790915592947f60452eb7177e8d41c9d9fbc4c6e9ccf55a4d44d412355fbf2f02668e0d1a0ce19290918790429051600160a060020a039094168452602084019290925260408084019190915260608301919091526080909101905180910390a150505050565b60145460009062010000900460ff16151561063f57600080fd5b33600160a060020a03166000908152600b602052604090205474010000000000000000000000000000000000000000900460ff161561067d57600080fd5b61068633611478565b9050600160a060020a03301631819010156106a057600080fd5b600160a060020a0333166000818152600b602052604090819020805474ff000000000000000000000000000000000000000019167401000000000000000000000000000000000000000017905582156108fc0290839051600060405180830381858888f19350505050151561071457600080fd5b7f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243643382604051600160a060020a03909216825260208201526040908101905180910390a150565b600e6020526000908152604090205460ff1681565b61079e828260006040518059106107845750595b818152601f19601f830116810160200160405290506107e5565b5050565b60075481565b60065433600160a060020a039081169116146107c357600080fd5b60068054600160a060020a031916600160a060020a0392909216919091179055565b60006107ef6115b2565b600160a060020a031633600160a060020a031614151561080e57600080fd5b601454610100900460ff161580610827575060145460ff165b15610891576014805460ff1961ff001990911661010017169055600854600160a060020a031663b6fe87fb6040518163ffffffff1660e060020a028152600401600060405180830381600087803b151561088057600080fd5b5af1151561088d57600080fd5b5050505b50600083815260096020908152604080832054808452600a9092529091206002015460c060020a900460ff16151561093f576108cc836116b1565b6000828152600a602052604090819020828155600201805478ff000000000000000000000000000000000000000000000000191660c060020a1790557fc4db019ddd899ab8c4169d2877afae028fd941bb9c752cf08f14d21924c0673491905190815260200160405180910390a16109cb565b6000818152600a602052604090206002015460c060020a900460ff16156109cb57610969836116b1565b6000828152600a6020526040908190206001018290557fc4db019ddd899ab8c4169d2877afae028fd941bb9c752cf08f14d21924c0673491905190815260200160405180910390a160058054600019019081905515156109cb576109cb6117a2565b50505050565b600f54601054601154601254601354600385810b956401000000008104820b956801000000000000000090910490910b939092909187565b60408051908101604052600581527f302e322e32000000000000000000000000000000000000000000000000000000602082015281565b60065433600160a060020a03908116911614610a5b57600080fd5b601454640100000000810463ffffffff9081166c01000000000000000000000000909204811691909101164211610a9157600080fd5b60145460ff168015610aab5750601454610100900460ff16155b80610ad15750601454610100900460ff168015610ad1575060145462010000900460ff16155b1515610adc57600080fd5b6014805462010000630100000063ff000000199092169190911762ff000019161773ffffffff0000000000000000000000000000000019167001000000000000000000000000000000004263ffffffff1602179055600854600160a060020a031663b6fe87fb6040518163ffffffff1660e060020a028152600401600060405180830381600087803b1515610b7057600080fd5b5af11515610b7d57600080fd5b505050565b6000828152600a6020908152604080832060028101548154600192830154600160a060020a039788168752600b8652848720988752979092019093529220549281169491939260c060020a90910460ff1691565b60145460ff808216916101008104821691620100008204811691630100000081049091169063ffffffff64010000000082048116916801000000000000000081048216916c01000000000000000000000000820481169170010000000000000000000000000000000090041688565b600654600160a060020a031681565b6012546000908152600a602052604080822060029081015460115484528284208201546010548552929093200154600160a060020a039283169183169083160101165b90565b600654600090819033600160a060020a03908116911614610cba57600080fd5b60145460ff16158015610cd55750601454610100900460ff16155b1515610ce057600080fd5b30600160a060020a031631610d13604080519081016040526003815260ea60020a62155493026020820152601354611e31565b600302610d3b604080519081016040526003815260ea60020a62155493026020820152611fa7565b600302011115610dff577f46cb989ef9cef13e930e3b7f286225a086e716a90d63e0b7da85d310a9db0c9a6040516020808252604b908201527f4f7261636c697a6520717565727920776173204e4f542073656e742c20706c656040808301919091527f6173652061646420736f6d652045544820746f20636f76657220666f7220746860608301527f6520717565727920666565000000000000000000000000000000000000000000608083015260a0909101905180910390a160009150611305565b60148054600167ffffffff00000000199091166401000000004263ffffffff16021760ff19161790557f46cb989ef9cef13e930e3b7f286225a086e716a90d63e0b7da85d310a9db0c9a60405160208082526035908201527f4f7261636c697a65207175657279207761732073656e742c207374616e64696e6040808301919091527f6720627920666f722074686520616e737765722e2e000000000000000000000060608301526080909101905180910390a1610ec484603c63ffffffff61211616565b601480546bffffffff000000000000000019166801000000000000000063ffffffff8416021790559350610f708460408051908101604052806003815260200160ea60020a621554930281525060806040519081016040528060438152602001600080516020612c1283398151915281526020017f6f6d2f76312f7469636b65722f657468657265756d2f292e302e70726963655f815260200160ea60020a621d5cd90281525061212c565b601154600082815260096020526040908190209190915590915061100c9085908051908101604052806003815260200160ea60020a621554930281525060806040519081016040528060438152602001600080516020612c1283398151915281526020017f6f6d2f76312f7469636b65722f6c697465636f696e2f292e302e70726963655f815260200160ea60020a621d5cd90281525061212c565b60125460008281526009602052604090819020919091559091506110bf9085908051908101604052806003815260200160ea60020a621554930281525060806040519081016040528060428152602001600080516020612c1283398151915281526020017f6f6d2f76312f7469636b65722f626974636f696e2f292e302e70726963655f7581526020017f736400000000000000000000000000000000000000000000000000000000000081525061212c565b60105460008281526009602052604090205590506110e3848463ffffffff61211616565b93506111698460408051908101604052806003815260200160ea60020a62155493028152506080604051908101604090815260438252600080516020612c1283398151915260208301527f6f6d2f76312f7469636b65722f657468657265756d2f292e302e70726963655f9082015260ea60020a621d5cd90260608201526013546123f7565b60115460008281526009602052604090819020919091559091506112079085908051908101604052806003815260200160ea60020a62155493028152506080604051908101604090815260438252600080516020612c1283398151915260208301527f6f6d2f76312f7469636b65722f6c697465636f696e2f292e302e70726963655f9082015260ea60020a621d5cd90260608201526013546123f7565b60125460008281526009602052604090819020919091559091506112bc9085908051908101604052806003815260200160ea60020a62155493028152506080604051908101604090815260428252600080516020612c1283398151915260208301527f6f6d2f76312f7469636b65722f626974636f696e2f292e302e70726963655f75908201527f736400000000000000000000000000000000000000000000000000000000000060608201526013546123f7565b601054600082815260096020526040902055601480546fffffffff00000000000000000000000019166c0100000000000000000000000063ffffffff8816021790556001925090505b5092915050565b60145460009062010000900460ff16151561132657600080fd5b33600160a060020a03166000908152600b602052604090205474010000000000000000000000000000000000000000900460ff161561136457600080fd5b61136d33611478565b905090565b600c5481565b60065433600160a060020a0390811691161461139357600080fd5b60145462010000900460ff1680156113d9575060145462278d00640100000000820463ffffffff9081166c01000000000000000000000000909304811692909201011642115b8061141b57506014546301000000900460ff16801561141b575060145462278d0063ffffffff7001000000000000000000000000000000009092048216011642115b151561142657600080fd5b600854600160a060020a0390811690633270f753903016316040518263ffffffff1660e060020a0281526004016000604051808303818588803b151561146b57600080fd5b5af115156109cb57600080fd5b6014546000908190819062010000900460ff16151561149657600080fd5b600160a060020a0384166000908152600b602052604090206014549092506301000000900460ff16156114d5578154600160a060020a031692506115ab565b6010546000908152600e602052604090205460ff1615611505576010546000908152600183016020526040902054015b6011546000908152600e602052604090205460ff1615611535576011546000908152600183016020526040902054015b6012546000908152600e602052604090205460ff1615611565576012546000908152600183016020526040902054015b6115a66298968061158e8361159a60075461158e62989680600c546126d090919063ffffffff16565b9063ffffffff6126f416565b9063ffffffff6126d016565b830192505b5050919050565b60008054600160a060020a031615806115dd57506000546115db90600160a060020a031661270b565b155b156115ee576115ec600061270f565b505b600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561162d57600080fd5b5af1151561163a57600080fd5b505050604051805160018054600160a060020a031916600160a060020a03928316179081905516905063c281d19e6040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561169657600080fd5b5af115156116a357600080fd5b505050604051805191505090565b60008060006116be612a5a565b5060009250600291508290508381805b82518210156117805783156116e4576001850394505b8282815181106116f057fe5b016020015160f860020a900460f860020a0260f860020a9004602e141561171657600193505b82828151811061172257fe5b016020015160f860020a900460f860020a0260f860020a900490506030811015801561174f575060398111155b15611760576030810386600a020195505b83801561176b575084155b1561177557611798565b6001909101906116ce565b5b84156117985785600a029550600185039450611781565b5050505050919050565b6010546000908152600a602052604081208054600190910154600382810b92909103620186a002900b8115156117d457fe5b600f805463ffffffff191663ffffffff93909205600390810b939093169190911790556011546000908152600a6020526040902080546001919091015481830b92919003620186a002900b81151561182857fe5b600f805492909105600390810b63ffffffff166401000000000267ffffffff00000000199093169290921790556012546000908152600a6020526040902080546001919091015481830b92620186a09290910391909102900b81151561188a57fe5b600f80546bffffffff000000000000000019166801000000000000000063ffffffff9490930560030b8416929092029190911790556012546000908152600a602052604080822060029081015460115484528284208201546010548552929093200154600160a060020a03928316918316908316010116600c55600d54600191161161196a576014805462010000630100000063ff000000199092169190911762ff000019161773ffffffff0000000000000000000000000000000019167001000000000000000000000000000000004263ffffffff1602179055611a04565b611985606461158e6005600c546126d090919063ffffffff16565b9050600160a060020a03301631811061199d57600080fd5b600c546119b0908263ffffffff612a3516565b600c55600854600160a060020a0316633270f753826040518263ffffffff1660e060020a0281526004016000604051808303818588803b15156119f257600080fd5b5af115156119ff57600080fd5b505050505b600f546401000000008104600390810b810b91810b900b1315611b4857600f54680100000000000000008104600390810b810b91810b900b1315611a8057601080546000908152600e60209081526040808320805460ff1916600117905592548252600a90522060020154600160a060020a0316600755611b43565b600f54600381810b810b68010000000000000000909204810b900b1315611adf57601280546000908152600e60209081526040808320805460ff1916600117905592548252600a90522060020154600160a060020a0316600755611b43565b601080546000908152600e602090815260408083208054600160ff19918216811790925560128054865283862080549092169092179055548352600a9091528082206002908101549354835291200154600160a060020a0391821690821601166007555b611e1d565b600f54600381810b810b640100000000909204810b900b1315611c9b57600f54680100000000000000008104600390810b810b640100000000909204810b900b1315611bcc57601180546000908152600e60209081526040808320805460ff1916600117905592548252600a90522060020154600160a060020a0316600755611b43565b600f546401000000008104600390810b810b68010000000000000000909204810b900b1315611c3357601280546000908152600e60209081526040808320805460ff1916600117905592548252600a90522060020154600160a060020a0316600755611b43565b601180546000908152600e602090815260408083208054600160ff19918216811790925560128054865283862080549092169092179055548352600a9091528082206002908101549354835291200154600160a060020a039182169082160116600755611e1d565b600f546401000000008104600390810b810b68010000000000000000909204810b900b1315611d0257601280546000908152600e60209081526040808320805460ff1916600117905592548252600a90522060020154600160a060020a0316600755611e1d565b600f546401000000008104600390810b810b68010000000000000000909204810b900b1215611d9357601180546000908152600e602090815260408083208054600160ff19918216811790925560108054865283862080549092169092179055548352600a9091528082206002908101549354835291200154600160a060020a039182169082160116600755611e1d565b601280546000908152600e602090815260408083208054600160ff1991821681179092556011805486528386208054831684179055601080548752848720805490931690931790915594548452600a9092528083206002908101549254845281842081015494548452922090910154600160a060020a039182169282169082160191909101166007555b506014805462ff0000191662010000179055565b60008054600160a060020a03161580611e5c5750600054611e5a90600160a060020a031661270b565b155b15611e6d57611e6b600061270f565b505b600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611eac57600080fd5b5af11515611eb957600080fd5b505050604051805160018054600160a060020a031916600160a060020a039283161790819055169050632ef3accc84846040518363ffffffff1660e060020a0281526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b83811015611f3e578082015183820152602001611f26565b50505050905090810190601f168015611f6b5780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b1515611f8a57600080fd5b5af11515611f9757600080fd5b5050506040518051949350505050565b60008054600160a060020a03161580611fd25750600054611fd090600160a060020a031661270b565b155b15611fe357611fe1600061270f565b505b600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561202257600080fd5b5af1151561202f57600080fd5b505050604051805160018054600160a060020a031916600160a060020a03928316179081905516905063524f3889836040518263ffffffff1660e060020a0281526004018080602001828103825283818151815260200191508051906020019080838360005b838110156120ad578082015183820152602001612095565b50505050905090810190601f1680156120da5780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b15156120f857600080fd5b5af1151561210557600080fd5b50505060405180519150505b919050565b60008282018381101561212557fe5b9392505050565b600080548190600160a060020a03161580612159575060005461215790600160a060020a031661270b565b155b1561216a57612168600061270f565b505b600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156121a957600080fd5b5af115156121b657600080fd5b505050604051805160018054600160a060020a031916600160a060020a03928316179081905516905063524f3889856040518263ffffffff1660e060020a0281526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561223457808201518382015260200161221c565b50505050905090810190601f1680156122615780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b151561227f57600080fd5b5af1151561228c57600080fd5b5050506040518051915050670de0b6b3a764000062030d403a02018111156122b757600091506123ef565b600154600160a060020a031663adf59f99828787876040518563ffffffff1660e060020a028152600401808481526020018060200180602001838103835285818151815260200191508051906020019080838360005b8381101561232557808201518382015260200161230d565b50505050905090810190601f1680156123525780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b83811015612388578082015183820152602001612370565b50505050905090810190601f1680156123b55780820380516001836020036101000a031916815260200191505b50955050505050506020604051808303818588803b15156123d557600080fd5b5af115156123e257600080fd5b5050505060405180519250505b509392505050565b600080548190600160a060020a03161580612424575060005461242290600160a060020a031661270b565b155b1561243557612433600061270f565b505b600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561247457600080fd5b5af1151561248157600080fd5b505050604051805160018054600160a060020a031916600160a060020a039283161790819055169050632ef3accc86856040518363ffffffff1660e060020a0281526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b838110156125065780820151838201526020016124ee565b50505050905090810190601f1680156125335780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b151561255257600080fd5b5af1151561255f57600080fd5b5050506040518051915050670de0b6b3a76400003a84020181111561258757600091506126c7565b600154600160a060020a031663c51be90f82888888886040518663ffffffff1660e060020a028152600401808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156125fc5780820151838201526020016125e4565b50505050905090810190601f1680156126295780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561265f578082015183820152602001612647565b50505050905090810190601f16801561268c5780820380516001836020036101000a031916815260200191505b5096505050505050506020604051808303818588803b15156126ad57600080fd5b5af115156126ba57600080fd5b5050505060405180519250505b50949350505050565b60008282028315806126ec57508284828115156126e957fe5b04145b151561212557fe5b600080828481151561270257fe5b04949350505050565b3b90565b60008061272f731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed61270b565b111561279f5760008054600160a060020a031916731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed17905561279760408051908101604052600b81527f6574685f6d61696e6e65740000000000000000000000000000000000000000006020820152612a47565b506001612111565b60006127be73c03a2615d5efaf5f49f60b7bb6583eaec212fdf161270b565b11156128265760008054600160a060020a03191673c03a2615d5efaf5f49f60b7bb6583eaec212fdf117905561279760408051908101604052600c81527f6574685f726f707374656e3300000000000000000000000000000000000000006020820152612a47565b600061284573b7a07bcf2ba2f2703b24c0691b5278999c59ac7e61270b565b11156128ad5760008054600160a060020a03191673b7a07bcf2ba2f2703b24c0691b5278999c59ac7e17905561279760408051908101604052600981527f6574685f6b6f76616e00000000000000000000000000000000000000000000006020820152612a47565b60006128cc73146500cfd35b22e4a392fe0adc06de1a1368ed4861270b565b11156129345760008054600160a060020a03191673146500cfd35b22e4a392fe0adc06de1a1368ed4817905561279760408051908101604052600b81527f6574685f72696e6b6562790000000000000000000000000000000000000000006020820152612a47565b6000612953736f485c8bf6fc43ea212e93bbf8ce046c7f1cb47561270b565b1115612987575060008054600160a060020a031916736f485c8bf6fc43ea212e93bbf8ce046c7f1cb4751790556001612111565b60006129a67320e12a1f859b3feae5fb2a0a32c18f5a65555bbf61270b565b11156129da575060008054600160a060020a0319167320e12a1f859b3feae5fb2a0a32c18f5a65555bbf1790556001612111565b60006129f97351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa61270b565b1115612a2d575060008054600160a060020a0319167351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa1790556001612111565b506000919050565b600082821115612a4157fe5b50900390565b600281805161079e929160200190612a6c565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612aad57805160ff1916838001178555612ada565b82800160010185558215612ada579182015b82811115612ada578251825591602001919060010190612abf565b50612ae6929150612aea565b5090565b610c9791905b80821115612ae65760008155600101612af0565b600054600160a060020a03161580612b2e5750600054612b2c90600160a060020a031661270b565b155b15612b3f57612b3d600061270f565b505b600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515612b7e57600080fd5b5af11515612b8b57600080fd5b505050604051805160018054600160a060020a031916600160a060020a03928316179081905516905063688dcfd78260405160e060020a63ffffffff84160281527fff000000000000000000000000000000000000000000000000000000000000009091166004820152602401600060405180830381600087803b151561146b57600080fd006a736f6e2868747470733a2f2f6170692e636f696e6d61726b65746361702e63a165627a7a72305820d9d00e180b08bc1e95eae85ed6ee0228d653bfb6e85676a0a1fc46f3d7c95cc90029

Swarm Source

bzzr://d9d00e180b08bc1e95eae85ed6ee0228d653bfb6e85676a0a1fc46f3d7c95cc9

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.