ETH Price: $2,274.15 (+2.23%)

Contract

0xda39857f898E37aF86fdABd8D688Efe84D3F4106
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Claim_reward56431932018-05-19 23:52:082303 days ago1526773928IN
0xda39857f...84D3F4106
0 ETH0.000161754
Claim_reward56160982018-05-15 5:06:082307 days ago1526360768IN
0xda39857f...84D3F4106
0 ETH0.0004043810
Claim_reward56139552018-05-14 20:01:482308 days ago1526328108IN
0xda39857f...84D3F4106
0 ETH0.00032358
Claim_reward56138652018-05-14 19:37:552308 days ago1526326675IN
0xda39857f...84D3F4106
0 ETH0.000363949
Claim_reward56137972018-05-14 19:19:332308 days ago1526325573IN
0xda39857f...84D3F4106
0 ETH0.0004043810
Claim_reward56137782018-05-14 19:14:452308 days ago1526325285IN
0xda39857f...84D3F4106
0 ETH0.000283067
Claim_reward56137752018-05-14 19:13:532308 days ago1526325233IN
0xda39857f...84D3F4106
0 ETH0.0004043810
Claim_reward56137692018-05-14 19:12:432308 days ago1526325163IN
0xda39857f...84D3F4106
0 ETH0.000363949
Claim_reward56137682018-05-14 19:12:332308 days ago1526325153IN
0xda39857f...84D3F4106
0 ETH0.0004448111
Claim_reward56137642018-05-14 19:11:432308 days ago1526325103IN
0xda39857f...84D3F4106
0 ETH0.000283067
__callback56137592018-05-14 19:08:592308 days ago1526324939IN
0xda39857f...84D3F4106
0 ETH0.0042104620
__callback56137572018-05-14 19:08:002308 days ago1526324880IN
0xda39857f...84D3F4106
0 ETH0.0016661820
__callback56137552018-05-14 19:07:502308 days ago1526324870IN
0xda39857f...84D3F4106
0 ETH0.0016509820
Place Bet56136302018-05-14 18:34:482308 days ago1526322888IN
0xda39857f...84D3F4106
0.01 ETH0.0002641212
Place Bet56135332018-05-14 18:10:442308 days ago1526321444IN
0xda39857f...84D3F4106
0.03 ETH0.0002421111
Place Bet56135302018-05-14 18:10:162308 days ago1526321416IN
0xda39857f...84D3F4106
0.03 ETH0.000176088
Place Bet56135272018-05-14 18:08:372308 days ago1526321317IN
0xda39857f...84D3F4106
0.03 ETH0.000176088
__callback56135242018-05-14 18:07:562308 days ago1526321276IN
0xda39857f...84D3F4106
0 ETH0.0015221620
__callback56135242018-05-14 18:07:562308 days ago1526321276IN
0xda39857f...84D3F4106
0 ETH0.0015373620
__callback56135232018-05-14 18:07:532308 days ago1526321273IN
0xda39857f...84D3F4106
0 ETH0.0015221620
Place Bet56135182018-05-14 18:06:272308 days ago1526321187IN
0xda39857f...84D3F4106
0.125 ETH0.0015928921
Place Bet56135142018-05-14 18:05:342308 days ago1526321134IN
0xda39857f...84D3F4106
0.04 ETH0.0015170420
Place Bet56135082018-05-14 18:04:082308 days ago1526321048IN
0xda39857f...84D3F4106
0.025 ETH0.000500439
Place Bet56135082018-05-14 18:04:082308 days ago1526321048IN
0xda39857f...84D3F4106
0.1 ETH0.0006561211.8
Place Bet56135072018-05-14 18:03:562308 days ago1526321036IN
0xda39857f...84D3F4106
0.3 ETH0.0008874611.7
View all transactions

Latest 19 internal transactions

Advanced mode:
Parent Transaction Hash Block From To
58407702018-06-23 15:30:172268 days ago1529767817
0xda39857f...84D3F4106
0.00060001 ETH
56431932018-05-19 23:52:082303 days ago1526773928
0xda39857f...84D3F4106
0.06563756 ETH
56160982018-05-15 5:06:082307 days ago1526360768
0xda39857f...84D3F4106
0.15753016 ETH
56139552018-05-14 20:01:482308 days ago1526328108
0xda39857f...84D3F4106
0.02625502 ETH
56138652018-05-14 19:37:552308 days ago1526326675
0xda39857f...84D3F4106
0.13127513 ETH
56137972018-05-14 19:19:332308 days ago1526325573
0xda39857f...84D3F4106
0.13127513 ETH
56137782018-05-14 19:14:452308 days ago1526325285
0xda39857f...84D3F4106
0.15753016 ETH
56137752018-05-14 19:13:532308 days ago1526325233
0xda39857f...84D3F4106
0.32818783 ETH
56137692018-05-14 19:12:432308 days ago1526325163
0xda39857f...84D3F4106
2.88805297 ETH
56137682018-05-14 19:12:332308 days ago1526325153
0xda39857f...84D3F4106
0.78765081 ETH
56137642018-05-14 19:11:432308 days ago1526325103
0xda39857f...84D3F4106
0.02625502 ETH
56137592018-05-14 19:08:592308 days ago1526324939
0xda39857f...84D3F4106
0.24735 ETH
56127452018-05-14 14:52:012308 days ago1526309521
0xda39857f...84D3F4106
0.00473335 ETH
56127452018-05-14 14:52:012308 days ago1526309521
0xda39857f...84D3F4106
0.00473335 ETH
56127452018-05-14 14:52:012308 days ago1526309521
0xda39857f...84D3F4106
0.00473335 ETH
56127452018-05-14 14:52:012308 days ago1526309521
0xda39857f...84D3F4106
0.00173335 ETH
56127452018-05-14 14:52:012308 days ago1526309521
0xda39857f...84D3F4106
0.00173335 ETH
56127452018-05-14 14:52:012308 days ago1526309521
0xda39857f...84D3F4106
0.00173335 ETH
56127452018-05-14 14:52:012308 days ago1526309521  Contract Creation0.02 ETH
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xD9e8a52F...6724408D3
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-05-06
*/

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{
        int64  BTC_delta; //horses.BTC delta value
        int64  ETH_delta; //horses.ETH delta value
        int64  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 customPreGasLimit;
        uint customPostGasLimit;
    }

    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;
        bytes32 preOraclizeId;
        bytes32 postOraclizeId;
    }
    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.customPreGasLimit = 80000;
        horses.customPostGasLimit = 230000;
        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());
        require (!chronus.race_end);
        bytes32 coin_pointer; // variable to differentiate different callbacks
        chronus.race_start = true;
        chronus.betting_open = false;
        bettingControllerInstance.remoteBettingClose();
        coin_pointer = oraclizeIndex[myid];

        if (myid == coinIndex[coin_pointer].preOraclizeId) {
            if (coinIndex[coin_pointer].pre > 0) {
            } else if (now >= chronus.starting_time+chronus.betting_duration+ 30 minutes) {
                forceVoidRace();
            } else {
                coinIndex[coin_pointer].pre = stringToUintNormalize(result);
                emit newPriceTicker(coinIndex[coin_pointer].pre);
            }
        } else if (myid == coinIndex[coin_pointer].postOraclizeId){
            if (coinIndex[coin_pointer].pre > 0 ){
                if (coinIndex[coin_pointer].post > 0) {
                } else if (now >= chronus.starting_time+chronus.race_duration+ 30 minutes) {
                    forceVoidRace();
                } else {
                    coinIndex[coin_pointer].post = stringToUintNormalize(result);
                    coinIndex[coin_pointer].price_check = true;
                    emit newPriceTicker(coinIndex[coin_pointer].post);
                    
                    if (coinIndex[horses.ETH].price_check && coinIndex[horses.BTC].price_check && coinIndex[horses.LTC].price_check) {
                        reward();
                    }
                }
            } else {
                forceVoidRace();
            }
        }
    }

    // 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" , horses.customPreGasLimit)*3 + oraclize_getPrice("URL", horses.customPostGasLimit)*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
            chronus.betting_duration = uint32(delay);
            temp_ID = oraclize_query(delay, "URL", "json(https://api.coinmarketcap.com/v1/ticker/ethereum/).0.price_usd",horses.customPreGasLimit);
            oraclizeIndex[temp_ID] = horses.ETH;
            coinIndex[horses.ETH].preOraclizeId = temp_ID;

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

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

            //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.customPostGasLimit);
            oraclizeIndex[temp_ID] = horses.ETH;
            coinIndex[horses.ETH].postOraclizeId = temp_ID;

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

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

            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 = int64(coinIndex[horses.BTC].post - coinIndex[horses.BTC].pre)*100000/int64(coinIndex[horses.BTC].pre);
        horses.ETH_delta = int64(coinIndex[horses.ETH].post - coinIndex[horses.ETH].pre)*100000/int64(coinIndex[horses.ETH].pre);
        horses.LTC_delta = int64(coinIndex[horses.LTC].post - coinIndex[horses.LTC].pre)*100000/int64(coinIndex[horses.LTC].pre);
        
        total_reward = (coinIndex[horses.BTC].total) + (coinIndex[horses.ETH].total) + (coinIndex[horses.LTC].total);
        if (total_bettors <= 1) {
            forceVoidRace();
        } 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);
    }
    
    function forceVoidRace() internal {
        chronus.voided_bet=true;
        chronus.race_end = true;
        chronus.voided_timestamp=uint32(now);
    }

    // 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":"int64"},{"name":"ETH_delta","type":"int64"},{"name":"LTC_delta","type":"int64"},{"name":"BTC","type":"bytes32"},{"name":"ETH","type":"bytes32"},{"name":"LTC","type":"bytes32"},{"name":"customPreGasLimit","type":"uint256"},{"name":"customPostGasLimit","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

0x6060604052600436106100e25763ffffffff60e060020a600035041663042b5fed81146100e4578063055ee253146100ef5780630f7696441461010257806327dc297e1461012c57806329114d65146101825780632af4c31e146101a757806338bbfa50146101c657806343bddf401461025e57806354fd4d50146102c4578063590e1ae31461034e5780637274f35b1461036157806384304ee5146103b65780638da5cb5b1461041e578063aa93038b1461044d578063aff6b3e814610460578063c4b24a461461046e578063d3d2172e14610481578063ddceafa914610494575b005b6100e26004356104a7565b34156100fa57600080fd5b6100e261062e565b341561010d57600080fd5b610118600435610764565b604051901515815260200160405180910390f35b341561013757600080fd5b6100e2600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061077995505050505050565b341561018d57600080fd5b6101956107ab565b60405190815260200160405180910390f35b34156101b257600080fd5b6100e2600160a060020a03600435166107b1565b34156101d157600080fd5b6100e2600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405281815292919060208401838380828437509496506107ee95505050505050565b341561026957600080fd5b610271610af3565b604051600798890b890b815296880b880b602088015294870b90960b6040808701919091526060860193909352608085019190915260a084015260c083019390935260e082015261010001905180910390f35b34156102cf57600080fd5b6102d7610b2f565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156103135780820151838201526020016102fb565b50505050905090810190601f1680156103405780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561035957600080fd5b6100e2610b66565b341561036c57600080fd5b610383600435600160a060020a0360243516610c9b565b604051948552602085019390935260408085019290925215156060840152608083019190915260a0909101905180910390f35b34156103c157600080fd5b6103c9610cef565b60405197151588529515156020880152931515604080880191909152921515606087015263ffffffff9182166080870152811660a086015291821660c0850152911660e0830152610100909101905180910390f35b341561042957600080fd5b610431610d51565b604051600160a060020a03909116815260200160405180910390f35b341561045857600080fd5b610195610d60565b610118600435602435610da6565b341561047957600080fd5b610195611474565b341561048c57600080fd5b6101956114da565b341561049f57600080fd5b6100e26114e0565b6015546000908190819060ff1615156104bf57600080fd5b662386f26fc100003410156104d357600080fd5b600160a060020a033381166000908152600b602052604090205416151561051157600d805463ffffffff8082166001011663ffffffff199091161790555b50505033600160a060020a038181166000908152600b6020908152604080832086845260018082018452828520805434908101918290558354600160a060020a0319808216918a1683018a1691909117909455600a90955294839020600201805492831683881686019788161777ffffffff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000009384900463ffffffff9081169093019283169093029290921790915592947f60452eb7177e8d41c9d9fbc4c6e9ccf55a4d44d412355fbf2f02668e0d1a0ce19290918790429051600160a060020a039094168452602084019290925260408084019190915260608301919091526080909101905180910390a150505050565b60155460009062010000900460ff16151561064857600080fd5b33600160a060020a03166000908152600b602052604090205474010000000000000000000000000000000000000000900460ff161561068657600080fd5b61068f336115d3565b9050600160a060020a03301631819010156106a957600080fd5b600160a060020a0333166000818152600b602052604090819020805474ff000000000000000000000000000000000000000019167401000000000000000000000000000000000000000017905582156108fc0290839051600060405180830381858888f19350505050151561071d57600080fd5b7f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243643382604051600160a060020a03909216825260208201526040908101905180910390a150565b600e6020526000908152604090205460ff1681565b6107a78282600060405180591061078d5750595b818152601f19601f830116810160200160405290506107ee565b5050565b60075481565b60065433600160a060020a039081169116146107cc57600080fd5b60068054600160a060020a031916600160a060020a0392909216919091179055565b60006107f861170d565b600160a060020a031633600160a060020a031614151561081757600080fd5b60155462010000900460ff161561082d57600080fd5b6015805460ff1961ff001990911661010017169055600854600160a060020a031663b6fe87fb6040518163ffffffff1660e060020a028152600401600060405180830381600087803b151561088157600080fd5b5af1151561088e57600080fd5b505050600084815260096020908152604080832054808452600a90925290912060030154909150841415610968576000818152600a602052604081205411156108d657610963565b601554610708640100000000820463ffffffff90811668010000000000000000909304811692909201011642106109145761090f61180c565b610963565b61091d83611856565b6000828152600a6020526040908190208290557fc4db019ddd899ab8c4169d2877afae028fd941bb9c752cf08f14d21924c0673491905190815260200160405180910390a15b610aed565b6000818152600a6020526040902060040154841415610aed576000818152600a60205260408120541115610ae5576000818152600a602052604081206001015411156109b357610963565b601554610708640100000000820463ffffffff9081166c01000000000000000000000000909304811692909201011642106109f05761090f61180c565b6109f983611856565b6000828152600a60205260409081902060018101839055600201805478ff000000000000000000000000000000000000000000000000191660c060020a1790557fc4db019ddd899ab8c4169d2877afae028fd941bb9c752cf08f14d21924c0673491905190815260200160405180910390a16011546000908152600a602052604090206002015460c060020a900460ff168015610ab157506010546000908152600a602052604090206002015460c060020a900460ff165b8015610ad857506012546000908152600a602052604090206002015460c060020a900460ff165b1561096357610963611947565b610aed61180c565b50505050565b600f54601054601154601254601354601454600786810b96680100000000000000008104820b96608060020a90910490910b9490939092909188565b60408051908101604052600581527f302e322e32000000000000000000000000000000000000000000000000000000602082015281565b60065433600160a060020a03908116911614610b8157600080fd5b601554640100000000810463ffffffff9081166c01000000000000000000000000909204811691909101164211610bb757600080fd5b60155460ff168015610bd15750601554610100900460ff16155b80610bf75750601554610100900460ff168015610bf7575060155462010000900460ff16155b1515610c0257600080fd5b6015805462010000630100000063ff000000199092169190911762ff000019161773ffffffff000000000000000000000000000000001916608060020a4263ffffffff1602179055600854600160a060020a031663b6fe87fb6040518163ffffffff1660e060020a028152600401600060405180830381600087803b1515610c8957600080fd5b5af11515610c9657600080fd5b505050565b6000828152600a6020908152604080832060028101548154600192830154600160a060020a039788168752600b8652848720988752979092019093529220549281169491939260c060020a90910460ff1691565b60155460ff808216916101008104821691620100008204811691630100000081049091169063ffffffff64010000000082048116916801000000000000000081048216916c010000000000000000000000008204811691608060020a90041688565b600654600160a060020a031681565b6012546000908152600a602052604080822060029081015460115484528284208201546010548552929093200154600160a060020a039283169183169083160101165b90565b600654600090819033600160a060020a03908116911614610dc657600080fd5b60155460ff16158015610de15750601554610100900460ff16155b1515610dec57600080fd5b30600160a060020a031631610e1f604080519081016040526003815260ea60020a62155493026020820152601454611fae565b600302610e4a604080519081016040526003815260ea60020a62155493026020820152601354611fae565b600302011115610f0e577f46cb989ef9cef13e930e3b7f286225a086e716a90d63e0b7da85d310a9db0c9a6040516020808252604b908201527f4f7261636c697a6520717565727920776173204e4f542073656e742c20706c656040808301919091527f6173652061646420736f6d652045544820746f20636f76657220666f7220746860608301527f6520717565727920666565000000000000000000000000000000000000000000608083015260a0909101905180910390a16000915061146d565b60158054600167ffffffff00000000199091166401000000004263ffffffff16021760ff19161790557f46cb989ef9cef13e930e3b7f286225a086e716a90d63e0b7da85d310a9db0c9a60405160208082526035908201527f4f7261636c697a65207175657279207761732073656e742c207374616e64696e6040808301919091527f6720627920666f722074686520616e737765722e2e000000000000000000000060608301526080909101905180910390a1601580546bffffffff000000000000000019166801000000000000000063ffffffff87160217905561106e8460408051908101604052806003815260200160ea60020a6215549302815250608060405190810160409081526043825260008051602061295683398151915260208301527f6f6d2f76312f7469636b65722f657468657265756d2f292e302e70726963655f9082015260ea60020a621d5cd9026060820152601354612124565b6011546000828152600960209081526040808320849055928252600a905281902060030182905590915061111c9085908051908101604052806003815260200160ea60020a6215549302815250608060405190810160409081526043825260008051602061295683398151915260208301527f6f6d2f76312f7469636b65722f6c697465636f696e2f292e302e70726963655f9082015260ea60020a621d5cd9026060820152601354612124565b6012546000828152600960209081526040808320849055928252600a90528190206003018290559091506111e19085908051908101604052806003815260200160ea60020a6215549302815250608060405190810160409081526042825260008051602061295683398151915260208301527f6f6d2f76312f7469636b65722f626974636f696e2f292e302e70726963655f75908201527f73640000000000000000000000000000000000000000000000000000000000006060820152601354612124565b6010546000828152600960209081526040808320849055928252600a9052206003018190559050611218848463ffffffff6123fd16565b935061129e8460408051908101604052806003815260200160ea60020a6215549302815250608060405190810160409081526043825260008051602061295683398151915260208301527f6f6d2f76312f7469636b65722f657468657265756d2f292e302e70726963655f9082015260ea60020a621d5cd9026060820152601454612124565b6011546000828152600960209081526040808320849055928252600a905281902060040182905590915061134c9085908051908101604052806003815260200160ea60020a6215549302815250608060405190810160409081526043825260008051602061295683398151915260208301527f6f6d2f76312f7469636b65722f6c697465636f696e2f292e302e70726963655f9082015260ea60020a621d5cd9026060820152601454612124565b6012546000828152600960209081526040808320849055928252600a90528190206004018290559091506114119085908051908101604052806003815260200160ea60020a6215549302815250608060405190810160409081526042825260008051602061295683398151915260208301527f6f6d2f76312f7469636b65722f626974636f696e2f292e302e70726963655f75908201527f73640000000000000000000000000000000000000000000000000000000000006060820152601454612124565b6010546000828152600960209081526040808320849055928252600a905220600401819055601580546fffffffff00000000000000000000000019166c0100000000000000000000000063ffffffff8816021790556001925090505b5092915050565b60155460009062010000900460ff16151561148e57600080fd5b33600160a060020a03166000908152600b602052604090205474010000000000000000000000000000000000000000900460ff16156114cc57600080fd5b6114d5336115d3565b905090565b600c5481565b60065433600160a060020a039081169116146114fb57600080fd5b60155462010000900460ff168015611541575060155462278d00640100000000820463ffffffff9081166c01000000000000000000000000909304811692909201011642115b8061157657506015546301000000900460ff168015611576575060155462278d0063ffffffff608060020a9092048216011642115b151561158157600080fd5b600854600160a060020a0390811690633270f753903016316040518263ffffffff1660e060020a0281526004016000604051808303818588803b15156115c657600080fd5b5af11515610aed57600080fd5b6015546000908190819062010000900460ff1615156115f157600080fd5b600160a060020a0384166000908152600b602052604090206015549092506301000000900460ff1615611630578154600160a060020a03169250611706565b6010546000908152600e602052604090205460ff1615611660576010546000908152600183016020526040902054015b6011546000908152600e602052604090205460ff1615611690576011546000908152600183016020526040902054015b6012546000908152600e602052604090205460ff16156116c0576012546000908152600183016020526040902054015b611701629896806116e9836116f56007546116e962989680600c5461241390919063ffffffff16565b9063ffffffff61243716565b9063ffffffff61241316565b830192505b5050919050565b60008054600160a060020a03161580611738575060005461173690600160a060020a031661244e565b155b15611749576117476000612452565b505b600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561178857600080fd5b5af1151561179557600080fd5b505050604051805160018054600160a060020a031916600160a060020a03928316179081905516905063c281d19e6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156117f157600080fd5b5af115156117fe57600080fd5b505050604051805191505090565b6015805462010000630100000063ff000000199092169190911762ff000019161773ffffffff000000000000000000000000000000001916608060020a4263ffffffff1602179055565b600080600061186361279e565b5060009250600291508290508381805b8251821015611925578315611889576001850394505b82828151811061189557fe5b016020015160f860020a900460f860020a0260f860020a9004602e14156118bb57600193505b8282815181106118c757fe5b016020015160f860020a900460f860020a0260f860020a90049050603081101580156118f4575060398111155b15611905576030810386600a020195505b838015611910575084155b1561191a5761193d565b600190910190611873565b5b841561193d5785600a029550600185039450611926565b5050505050919050565b6010546000908152600a602052604081208054600190910154600782810b92909103620186a002900b81151561197957fe5b600f805467ffffffffffffffff191667ffffffffffffffff93909205600790810b939093169190911790556011546000908152600a6020526040902080546001919091015481830b92919003620186a002900b8115156119d557fe5b600f805492909105600790810b67ffffffffffffffff1668010000000000000000026fffffffffffffffff0000000000000000199093169290921790556012546000908152600a6020526040902080546001919091015481830b92620186a09290910391909102900b811515611a4757fe5b600f805477ffffffffffffffff000000000000000000000000000000001916608060020a67ffffffffffffffff9490930560070b93909316919091029190911790556012546000908152600a602052604080822060029081015460115484528284208201546010548552929093200154600160a060020a03928316918316908316010116600c55600d54600163ffffffff90911611611aed57611ae861180c565b611b87565b611b0860646116e96005600c5461241390919063ffffffff16565b9050600160a060020a033016318110611b2057600080fd5b600c54611b33908263ffffffff61277916565b600c55600854600160a060020a0316633270f753826040518263ffffffff1660e060020a0281526004016000604051808303818588803b1515611b7557600080fd5b5af11515611b8257600080fd5b505050505b600f54680100000000000000008104600790810b810b91810b900b1315611cc557600f54608060020a8104600790810b810b91810b900b1315611c0257601080546000908152600e60209081526040808320805460ff1916600117905592548252600a90522060020154600160a060020a0316600755611cc0565b600f54600781810b810b608060020a909204810b900b1315611c5c57601280546000908152600e60209081526040808320805460ff1916600117905592548252600a90522060020154600160a060020a0316600755611cc0565b601080546000908152600e602090815260408083208054600160ff19918216811790925560128054865283862080549092169092179055548352600a9091528082206002908101549354835291200154600160a060020a0391821690821601166007555b611f9a565b600f54600781810b810b68010000000000000000909204810b900b1315611e1a57600f54608060020a8104600790810b810b68010000000000000000909204810b900b1315611d4c57601180546000908152600e60209081526040808320805460ff1916600117905592548252600a90522060020154600160a060020a0316600755611cc0565b600f54680100000000000000008104600790810b810b608060020a909204810b900b1315611db257601280546000908152600e60209081526040808320805460ff1916600117905592548252600a90522060020154600160a060020a0316600755611cc0565b601180546000908152600e602090815260408083208054600160ff19918216811790925560128054865283862080549092169092179055548352600a9091528082206002908101549354835291200154600160a060020a039182169082160116600755611f9a565b600f54680100000000000000008104600790810b810b608060020a909204810b900b1315611e8057601280546000908152600e60209081526040808320805460ff1916600117905592548252600a90522060020154600160a060020a0316600755611f9a565b600f54680100000000000000008104600790810b810b608060020a909204810b900b1215611f1057601180546000908152600e602090815260408083208054600160ff19918216811790925560108054865283862080549092169092179055548352600a9091528082206002908101549354835291200154600160a060020a039182169082160116600755611f9a565b601280546000908152600e602090815260408083208054600160ff1991821681179092556011805486528386208054831684179055601080548752848720805490931690931790915594548452600a9092528083206002908101549254845281842081015494548452922090910154600160a060020a039182169282169082160191909101166007555b506015805462ff0000191662010000179055565b60008054600160a060020a03161580611fd95750600054611fd790600160a060020a031661244e565b155b15611fea57611fe86000612452565b505b600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561202957600080fd5b5af1151561203657600080fd5b505050604051805160018054600160a060020a031916600160a060020a039283161790819055169050632ef3accc84846040518363ffffffff1660e060020a0281526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b838110156120bb5780820151838201526020016120a3565b50505050905090810190601f1680156120e85780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b151561210757600080fd5b5af1151561211457600080fd5b5050506040518051949350505050565b600080548190600160a060020a03161580612151575060005461214f90600160a060020a031661244e565b155b15612162576121606000612452565b505b600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156121a157600080fd5b5af115156121ae57600080fd5b505050604051805160018054600160a060020a031916600160a060020a039283161790819055169050632ef3accc86856040518363ffffffff1660e060020a0281526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b8381101561223357808201518382015260200161221b565b50505050905090810190601f1680156122605780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b151561227f57600080fd5b5af1151561228c57600080fd5b5050506040518051915050670de0b6b3a76400003a8402018111156122b457600091506123f4565b600154600160a060020a031663c51be90f82888888886040518663ffffffff1660e060020a028152600401808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015612329578082015183820152602001612311565b50505050905090810190601f1680156123565780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561238c578082015183820152602001612374565b50505050905090810190601f1680156123b95780820380516001836020036101000a031916815260200191505b5096505050505050506020604051808303818588803b15156123da57600080fd5b5af115156123e757600080fd5b5050505060405180519250505b50949350505050565b60008282018381101561240c57fe5b9392505050565b600082820283158061242f575082848281151561242c57fe5b04145b151561240c57fe5b600080828481151561244557fe5b04949350505050565b3b90565b600080612472731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed61244e565b11156124e25760008054600160a060020a031916731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed1790556124da60408051908101604052600b81527f6574685f6d61696e6e6574000000000000000000000000000000000000000000602082015261278b565b506001612774565b600061250173c03a2615d5efaf5f49f60b7bb6583eaec212fdf161244e565b11156125695760008054600160a060020a03191673c03a2615d5efaf5f49f60b7bb6583eaec212fdf11790556124da60408051908101604052600c81527f6574685f726f707374656e330000000000000000000000000000000000000000602082015261278b565b600061258873b7a07bcf2ba2f2703b24c0691b5278999c59ac7e61244e565b11156125f05760008054600160a060020a03191673b7a07bcf2ba2f2703b24c0691b5278999c59ac7e1790556124da60408051908101604052600981527f6574685f6b6f76616e0000000000000000000000000000000000000000000000602082015261278b565b600061260f73146500cfd35b22e4a392fe0adc06de1a1368ed4861244e565b11156126775760008054600160a060020a03191673146500cfd35b22e4a392fe0adc06de1a1368ed481790556124da60408051908101604052600b81527f6574685f72696e6b656279000000000000000000000000000000000000000000602082015261278b565b6000612696736f485c8bf6fc43ea212e93bbf8ce046c7f1cb47561244e565b11156126ca575060008054600160a060020a031916736f485c8bf6fc43ea212e93bbf8ce046c7f1cb4751790556001612774565b60006126e97320e12a1f859b3feae5fb2a0a32c18f5a65555bbf61244e565b111561271d575060008054600160a060020a0319167320e12a1f859b3feae5fb2a0a32c18f5a65555bbf1790556001612774565b600061273c7351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa61244e565b1115612770575060008054600160a060020a0319167351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa1790556001612774565b5060005b919050565b60008282111561278557fe5b50900390565b60028180516107a79291602001906127b0565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106127f157805160ff191683800117855561281e565b8280016001018555821561281e579182015b8281111561281e578251825591602001919060010190612803565b5061282a92915061282e565b5090565b610da391905b8082111561282a5760008155600101612834565b600054600160a060020a03161580612872575060005461287090600160a060020a031661244e565b155b15612883576128816000612452565b505b600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156128c257600080fd5b5af115156128cf57600080fd5b505050604051805160018054600160a060020a031916600160a060020a03928316179081905516905063688dcfd78260405160e060020a63ffffffff84160281527fff000000000000000000000000000000000000000000000000000000000000009091166004820152602401600060405180830381600087803b15156115c657600080fd006a736f6e2868747470733a2f2f6170692e636f696e6d61726b65746361702e63a165627a7a723058200aa12d69dab23532e94060437ac49ac38e94274312a97e6ea62587b8c3a6752a0029

Swarm Source

bzzr://0aa12d69dab23532e94060437ac49ac38e94274312a97e6ea62587b8c3a6752a

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.