Sponsored Link:   DocTailor - Legal Self Customisable Smart Contract Platform - Bridging the Gap Between Business & Cryptocurrency Holders - Join Now!
Contract Overview
ETH Balance: 0 Ether
ETH USD Value: $0
No Of Transactions: 293 txns
  Latest 25 txns from a total Of 293 transactions View All

TxHash Age From To Value [TxFee]
0x18530578b5673f105c24e4caa55fecf4f96718222ec1468e92f6c7757d939ed62 days 1 hr ago0xef27c63180353bd3b267f0479456ea8771ce7f03  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0 Ether0.0001533
0x226acf78f6bfc696e7ef3ce02b6c004b2c7f9500f774b459631cee7ceb01804c3 days 12 hrs ago0xef27c63180353bd3b267f0479456ea8771ce7f03  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0 Ether0.000099129
0x1323405a03d195fed5fa8b493cdf9aca9f4b6d9f28716295047017fb6b5339697 days 5 hrs ago0x58d5e8c6800635f4bd7b8461fc54f30138385dfe  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0.65 Ether0.00012134
0xefee1d854d71b19d24efa37a048f3da997332ab4dc9a224acb45fb3eb058f3e97 days 7 hrs agoOraclize  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0 Ether0.01835926
0xaccf04d4be5d93a73f8698508880300debd9cba22af855c7dc3a0be8bee855697 days 7 hrs agoOraclize  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0 Ether0.0435144
0x48b5212cf39060935945f82e2f8d1522ca7be959d9f7d98097596a773ce572fa7 days 8 hrs ago0xd85a4117c17f998e9748dc0d3e3fbfc681c44707  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd6 Ether0.002369836
0x3c561d395c34671d3893bd7fb89104e4569b21d3e07a141350b8470bc3993f697 days 8 hrs ago0xd85a4117c17f998e9748dc0d3e3fbfc681c44707  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd6.1 Ether0.000169274
0xbcc6a64dcbea6a1b6037cba7771778781296b20e57c20b549ae48bcd42be53777 days 8 hrs ago0xd85a4117c17f998e9748dc0d3e3fbfc681c44707  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd5.5 Ether0.000048364
0x8dd9d7b1a053707aafdecfb781e1d9a9760b290efcc2111aa86387ca8a92acc67 days 8 hrs ago0x897cd68dd079f10b2cf06a196f2b8d9be51f1dcc  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0.546812 Ether0.000048536
0xd58f6b35cd826148d3bcd9ef3b32f9ac098edcc638fa654e3df6cba5ea388c037 days 8 hrs ago0xd85a4117c17f998e9748dc0d3e3fbfc681c44707  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd1 Ether0.000048364
0x7efdc12082a551e5d0d14bd469b6e2e5fae9c36279c0a7f50c8c63e95aa0bf797 days 8 hrs ago0xd85a4117c17f998e9748dc0d3e3fbfc681c44707  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd6 Ether0.000048364
0x8b26fe98471c7f3c5db13188dd6426d39c0a9188f6e13e625613bbbcb95b0c827 days 9 hrs ago0xd85a4117c17f998e9748dc0d3e3fbfc681c44707  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd6.214 Ether0.000048364
0xf2ce6d15a4e615f282bb815d7e3392d3e3293ececf9eed4cf12ea42ae60a2a917 days 10 hrs ago0xd85a4117c17f998e9748dc0d3e3fbfc681c44707  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd6.2 Ether0.00229729
0x342678d52a275d3bc42475542fae53e74c06e21311c5589fa9f324d2af4d31347 days 10 hrs ago0xd85a4117c17f998e9748dc0d3e3fbfc681c44707  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd3 Ether0.000991462
0xd916a0fd80a757b08c8bed0cda0faaa16a8de924bd84e3894506c11583b087587 days 10 hrs ago0xef27c63180353bd3b267f0479456ea8771ce7f03  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0 Ether0.000048107
0x23e60a784359abae1aba6f8bcf0903bd1f01c8e2f5618e7dc445697deec3002f7 days 10 hrs ago0xd85a4117c17f998e9748dc0d3e3fbfc681c44707  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd6.21 Ether0.000991462
0x54e5993a9a3e4f3d17308ef122130d0e5bd7f9ddaa3d4fd84caddefc7ddde2647 days 10 hrs ago0xd85a4117c17f998e9748dc0d3e3fbfc681c44707  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd6.22 Ether0.000991462
0x2ddc52dbea61015f2e8786bd847ecaf8c93cac00378cba050370cbe8ff9e1f067 days 10 hrs ago0xd85a4117c17f998e9748dc0d3e3fbfc681c44707  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd6.22100977 Ether0.000991462
0xb2fe58cbfac644811eba443af90ee126a34e9f268449ccdc536a966d57416dc27 days 11 hrs agoBinanceWallet_2  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0.5 Ether0.0012134
0xdaa2151ec2bc25f0501671e94e8761520a6fe5320d99038b0893e78b8b5de2747 days 12 hrs ago0xef27c63180353bd3b267f0479456ea8771ce7f03  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0 Ether0.000048107
0x6872dc8d46544d27a20cbfe0d1bdff7a3ae7241ef3fd2791444b93e9bee7e1dc7 days 12 hrs ago0xa9481693b5c550e4413c4d6abdd0d35d89f25ca1  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0.8 Ether0.000024268
0xef7ff004fa23086d507e116a208891585b975bfe66ea0baacecf651e2f4933ab7 days 12 hrs ago0xa9481693b5c550e4413c4d6abdd0d35d89f25ca1  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0.8 Ether0.000024268
0x31730df692a56a176aedca4b197b25f2cfa341f8a39bc571973efa9acc7c5a5d7 days 12 hrs ago0xa9481693b5c550e4413c4d6abdd0d35d89f25ca1  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0.8 Ether0.000024268
0xa99df54df6ba8aa88f53cfd5a560aad03905b21446face73b15763d87f12e64b7 days 14 hrs ago0xef27c63180353bd3b267f0479456ea8771ce7f03  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0 Ether0.000048107
0xbabe002266166ddc520e9aac75a8a389710f141aa113068680468a1a945f40df7 days 15 hrs ago0xef27c63180353bd3b267f0479456ea8771ce7f03  IN   0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0 Ether0.000033107
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
  Latest 25 Internal Txns, Click here to View More View All
ParentTxHash Block Age From To Value
0x18530578b5673f105c24e4caa55fecf4f96718222ec1468e92f6c7757d939ed654756262 days 1 hr ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0xef27c63180353bd3b267f0479456ea8771ce7f030.7469331301236736 Ether
0xaccf04d4be5d93a73f8698508880300debd9cba22af855c7dc3a0be8bee8556954448707 days 7 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.05002667174690816 Ether
0xcc61d13bb5233aede3642bb19b873ace0c5d4937dc99dfe859da7992039d818654398888 days 4 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x268343557a5a08cecac22930c00fe37c06e1d0273.888 Ether
0xcc61d13bb5233aede3642bb19b873ace0c5d4937dc99dfe859da7992039d818654398888 days 4 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00402667174690816 Ether
0x56bfe34131a453c88c503c1a49fc40e74407c34bccc5e8ea7deb6d877e30bf7454351958 days 22 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x268343557a5a08cecac22930c00fe37c06e1d0275.433 Ether
0x56bfe34131a453c88c503c1a49fc40e74407c34bccc5e8ea7deb6d877e30bf7454351958 days 22 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00402667174690816 Ether
0x34a5cdb7b96f21cc33c0079d834d62877573f93f746f2a97b7e3594637f988e454337669 days 4 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x268343557a5a08cecac22930c00fe37c06e1d0270.62 Ether
0x34a5cdb7b96f21cc33c0079d834d62877573f93f746f2a97b7e3594637f988e454337669 days 4 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00402667174690816 Ether
0x310b16f31e2246c3aec92b21b4c296764a29666e189992d945e8388e64459d5b542712210 days 8 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x268343557a5a08cecac22930c00fe37c06e1d0272.716722364 Ether
0x310b16f31e2246c3aec92b21b4c296764a29666e189992d945e8388e64459d5b542712210 days 8 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00402667174690816 Ether
0x06819d7044382b5b639b78efe8594602b421eeab81a423ea6ee608c15948b89b542630810 days 11 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x268343557a5a08cecac22930c00fe37c06e1d0270.9 Ether
0x06819d7044382b5b639b78efe8594602b421eeab81a423ea6ee608c15948b89b542630810 days 11 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00402667174690816 Ether
0x1b81655d584d0b6a8b8664e68f5fe3a10f9b3922aceb991dbb4a0bb37e2208a7542243811 days 2 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x268343557a5a08cecac22930c00fe37c06e1d0270.52 Ether
0x1b81655d584d0b6a8b8664e68f5fe3a10f9b3922aceb991dbb4a0bb37e2208a7542243811 days 2 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00402667174690816 Ether
0x7e6695cc6a102f45a941f6298c0e8e0f0ad79e9d73130f8a5081f1755916df83542082011 days 9 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x268343557a5a08cecac22930c00fe37c06e1d0270.82 Ether
0x7e6695cc6a102f45a941f6298c0e8e0f0ad79e9d73130f8a5081f1755916df83542082011 days 9 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00402667174690816 Ether
0x7bb1996268cf9ecd90142794b5b68e7b96d7c6ff17a359aa607d1a7ac339f537542072611 days 9 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x268343557a5a08cecac22930c00fe37c06e1d0270.5 Ether
0x7bb1996268cf9ecd90142794b5b68e7b96d7c6ff17a359aa607d1a7ac339f537542072611 days 9 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00402667174690816 Ether
0x7155d81356ff52523917b20286d1e9dbacfbef3abb88524346e4c2fe38616c6a542030311 days 11 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x268343557a5a08cecac22930c00fe37c06e1d0270.9 Ether
0x7155d81356ff52523917b20286d1e9dbacfbef3abb88524346e4c2fe38616c6a542030311 days 11 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00402667174690816 Ether
0x49d108746b53eb44a0c5ab3c03161e2393de23abc9a004e25bc8555b06d96de6541984511 days 13 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x268343557a5a08cecac22930c00fe37c06e1d0272.41 Ether
0x49d108746b53eb44a0c5ab3c03161e2393de23abc9a004e25bc8555b06d96de6541984511 days 13 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00402667174690816 Ether
0xd92362d556ae401f4fc93ff2825a25251a07f6cbbab3119b3f2022bc3aac0e81541983611 days 13 hrs ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00402667174690816 Ether
0x6ea3c3a398b7a4ba9cb9427904be207ade666de6ba038651de924a41bd2333cf541700012 days 37 mins ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x268343557a5a08cecac22930c00fe37c06e1d0272 Ether
0x6ea3c3a398b7a4ba9cb9427904be207ade666de6ba038651de924a41bd2333cf541700012 days 37 mins ago0xf6cadb5ceaba978dfed889c72a4d61d3a4bc53dd0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00402667174690816 Ether
[ Download CSV Export  ] 
Contract Source Code Verified (Exact match)
Contract Name: BetexICO
Compiler Version: v0.4.21+commit.dfe3193c
Optimization Enabled: No
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts
pragma solidity ^0.4.21;

/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMath {

  /**
  * @dev Multiplies two numbers, throws on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    if (a == 0) {
      return 0;
    }
    uint256 c = a * b;
    assert(c / a == b);
    return c;
  }

  /**
  * @dev Integer division of two numbers, truncating the quotient.
  */
  function div(uint256 a, uint256 b) internal pure 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;
  }

  /**
  * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    assert(b <= a);
    return a - b;
  }

  /**
  * @dev Adds two numbers, throws on overflow.
  */
  function add(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    assert(c >= a);
    return c;
  }
}


/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
  address public owner;


  event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);


  /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.
   */
  function Ownable() public {
    owner = msg.sender;
  }

  /**
   * @dev Throws if called by any account other than the owner.
   */
  modifier onlyOwner() {
    require(msg.sender == owner);
    _;
  }

  /**
   * @dev Allows the current owner to transfer control of the contract to a newOwner.
   * @param newOwner The address to transfer ownership to.
   */
  function transferOwnership(address newOwner) public onlyOwner {
    require(newOwner != address(0));
    OwnershipTransferred(owner, newOwner);
    owner = newOwner;
  }

}


/**
 * @title ERC20Basic
 * @dev Simpler version of ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/179
 */
contract ERC20Basic {
  function totalSupply() public view returns (uint256);
  function balanceOf(address who) public view returns (uint256);
  function transfer(address to, uint256 value) public returns (bool);
  event Transfer(address indexed from, address indexed to, uint256 value);
}


/**
 * @title ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/20
 */
contract ERC20 is ERC20Basic {
  function allowance(address owner, address spender) public view returns (uint256);
  function transferFrom(address from, address to, uint256 value) public returns (bool);
  function approve(address spender, uint256 value) public returns (bool);
  event Approval(address indexed owner, address indexed spender, uint256 value);
}


/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure.
 * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
  function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
    assert(token.transfer(to, value));
  }

  function safeTransferFrom(ERC20 token, address from, address to, uint256 value) internal {
    assert(token.transferFrom(from, to, value));
  }

  function safeApprove(ERC20 token, address spender, uint256 value) internal {
    assert(token.approve(spender, value));
  }
}


/**
 * @title Contracts that should be able to recover tokens
 * @author SylTi
 * @dev This allow a contract to recover any ERC20 token received in a contract by transferring the balance to the contract owner.
 * This will prevent any accidental loss of tokens.
 */
contract CanReclaimToken is Ownable {
  using SafeERC20 for ERC20Basic;

  /**
   * @dev Reclaim all ERC20Basic compatible tokens
   * @param token ERC20Basic The address of the token contract
   */
  function reclaimToken(ERC20Basic token) external onlyOwner {
    uint256 balance = token.balanceOf(this);
    token.safeTransfer(owner, balance);
  }

}


/**
 * @title Contracts that should not own Contracts
 * @author Remco Bloemen <[email protected]π.com>
 * @dev Should contracts (anything Ownable) end up being owned by this contract, it allows the owner
 * of this contract to reclaim ownership of the contracts.
 */
contract HasNoContracts is Ownable {

  /**
   * @dev Reclaim ownership of Ownable contracts
   * @param contractAddr The address of the Ownable to be reclaimed.
   */
  function reclaimContract(address contractAddr) external onlyOwner {
    Ownable contractInst = Ownable(contractAddr);
    contractInst.transferOwnership(owner);
  }
}


/**
 * @title Contracts that should not own Tokens
 * @author Remco Bloemen <[email protected]π.com>
 * @dev This blocks incoming ERC223 tokens to prevent accidental loss of tokens.
 * Should tokens (any ERC20Basic compatible) end up in the contract, it allows the
 * owner to reclaim the tokens.
 */
contract HasNoTokens is CanReclaimToken {

 /**
  * @dev Reject all ERC223 compatible tokens
  * @param from_ address The address that is transferring the tokens
  * @param value_ uint256 the amount of the specified token
  * @param data_ Bytes The data passed from the caller.
  */
  function tokenFallback(address from_, uint256 value_, bytes data_) external {
    from_;
    value_;
    data_;
    revert();
  }

}


/**
 * @title Contracts that should not own Ether
 * @author Remco Bloemen <[email protected]π.com>
 * @dev This tries to block incoming ether to prevent accidental loss of Ether. Should Ether end up
 * in the contract, it will allow the owner to reclaim this ether.
 * @notice Ether can still be send to this contract by:
 * calling functions labeled `payable`
 * `selfdestruct(contract_address)`
 * mining directly to the contract address
*/
contract HasNoEther is Ownable {

  /**
  * @dev Constructor that rejects incoming Ether
  * @dev The `payable` flag is added so we can access `msg.value` without compiler warning. If we
  * leave out payable, then Solidity will allow inheriting contracts to implement a payable
  * constructor. By doing it this way we prevent a payable constructor from working. Alternatively
  * we could use assembly to access msg.value.
  */
  function HasNoEther() public payable {
    require(msg.value == 0);
  }

  /**
   * @dev Disallows direct send by settings a default function without the `payable` flag.
   */
  function() external {
  }

  /**
   * @dev Transfer all Ether held by the contract to the owner.
   */
  function reclaimEther() external onlyOwner {
    assert(owner.send(this.balance));
  }
}


/**
 * @title Base contract for contracts that should not own things.
 * @author Remco Bloemen <[email protected]π.com>
 * @dev Solves a class of errors where a contract accidentally becomes owner of Ether, Tokens or
 * Owned contracts. See respective base contracts for details.
 */
contract NoOwner is HasNoEther, HasNoTokens, HasNoContracts {
}


/**
 * @title Basic token
 * @dev Basic version of StandardToken, with no allowances.
 */
contract BasicToken is ERC20Basic {
  using SafeMath for uint256;

  mapping(address => uint256) balances;

  uint256 totalSupply_;

  /**
  * @dev total number of tokens in existence
  */
  function totalSupply() public view returns (uint256) {
    return totalSupply_;
  }

  /**
  * @dev transfer token for a specified address
  * @param _to The address to transfer to.
  * @param _value The amount to be transferred.
  */
  function transfer(address _to, uint256 _value) public returns (bool) {
    require(_to != address(0));
    require(_value <= balances[msg.sender]);

    // SafeMath.sub will throw if there is not enough balance.
    balances[msg.sender] = balances[msg.sender].sub(_value);
    balances[_to] = balances[_to].add(_value);
    Transfer(msg.sender, _to, _value);
    return true;
  }

  /**
  * @dev Gets the balance of the specified address.
  * @param _owner The address to query the the balance of.
  * @return An uint256 representing the amount owned by the passed address.
  */
  function balanceOf(address _owner) public view returns (uint256 balance) {
    return balances[_owner];
  }

}


/**
 * @title Standard ERC20 token
 *
 * @dev Implementation of the basic standard token.
 * @dev https://github.com/ethereum/EIPs/issues/20
 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
 */
contract StandardToken is ERC20, BasicToken {

  mapping (address => mapping (address => uint256)) internal allowed;


  /**
   * @dev Transfer tokens from one address to another
   * @param _from address The address which you want to send tokens from
   * @param _to address The address which you want to transfer to
   * @param _value uint256 the amount of tokens to be transferred
   */
  function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
    require(_to != address(0));
    require(_value <= balances[_from]);
    require(_value <= allowed[_from][msg.sender]);

    balances[_from] = balances[_from].sub(_value);
    balances[_to] = balances[_to].add(_value);
    allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
    Transfer(_from, _to, _value);
    return true;
  }

  /**
   * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
   *
   * Beware that changing an allowance with this method brings the risk that someone may use both the old
   * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
   * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
   * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
   * @param _spender The address which will spend the funds.
   * @param _value The amount of tokens to be spent.
   */
  function approve(address _spender, uint256 _value) public returns (bool) {
    allowed[msg.sender][_spender] = _value;
    Approval(msg.sender, _spender, _value);
    return true;
  }

  /**
   * @dev Function to check the amount of tokens that an owner allowed to a spender.
   * @param _owner address The address which owns the funds.
   * @param _spender address The address which will spend the funds.
   * @return A uint256 specifying the amount of tokens still available for the spender.
   */
  function allowance(address _owner, address _spender) public view returns (uint256) {
    return allowed[_owner][_spender];
  }

  /**
   * @dev Increase the amount of tokens that an owner allowed to a spender.
   *
   * approve should be called when allowed[_spender] == 0. To increment
   * allowed value is better to use this function to avoid 2 calls (and wait until
   * the first transaction is mined)
   * From MonolithDAO Token.sol
   * @param _spender The address which will spend the funds.
   * @param _addedValue The amount of tokens to increase the allowance by.
   */
  function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
    allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
    Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
    return true;
  }

  /**
   * @dev Decrease the amount of tokens that an owner allowed to a spender.
   *
   * approve should be called when allowed[_spender] == 0. To decrement
   * allowed value is better to use this function to avoid 2 calls (and wait until
   * the first transaction is mined)
   * From MonolithDAO Token.sol
   * @param _spender The address which will spend the funds.
   * @param _subtractedValue The amount of tokens to decrease the allowance by.
   */
  function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
    uint oldValue = allowed[msg.sender][_spender];
    if (_subtractedValue > oldValue) {
      allowed[msg.sender][_spender] = 0;
    } else {
      allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
    }
    Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
    return true;
  }

}


/**
 * @title BetexToken
 */
contract BetexToken is StandardToken, NoOwner {

    string public constant name = "Betex Token"; // solium-disable-line uppercase
    string public constant symbol = "BETEX"; // solium-disable-line uppercase
    uint8 public constant decimals = 18; // solium-disable-line uppercase

    // transfer unlock time (except team and broker recipients)
    uint256 public firstUnlockTime;

    // transfer unlock time for the team and broker recipients
    uint256 public secondUnlockTime; 

    // addresses locked till second unlock time
    mapping (address => bool) public blockedTillSecondUnlock;

    // token holders
    address[] public holders;

    // holder number
    mapping (address => uint256) public holderNumber;

    // ICO address
    address public icoAddress;

    // supply constants
    uint256 public constant TOTAL_SUPPLY = 10000000 * (10 ** uint256(decimals));
    uint256 public constant SALE_SUPPLY = 5000000 * (10 ** uint256(decimals));

    // funds supply constants
    uint256 public constant BOUNTY_SUPPLY = 200000 * (10 ** uint256(decimals));
    uint256 public constant RESERVE_SUPPLY = 800000 * (10 ** uint256(decimals));
    uint256 public constant BROKER_RESERVE_SUPPLY = 1000000 * (10 ** uint256(decimals));
    uint256 public constant TEAM_SUPPLY = 3000000 * (10 ** uint256(decimals));

    // funds addresses constants
    address public constant BOUNTY_ADDRESS = 0x48c15e5A9343E3220cdD8127620AE286A204448a;
    address public constant RESERVE_ADDRESS = 0xC8fE659AaeF73b6e41DEe427c989150e3eDAf57D;
    address public constant BROKER_RESERVE_ADDRESS = 0x8697d46171aBCaD2dC5A4061b8C35f909a402417;
    address public constant TEAM_ADDRESS = 0x1761988F02C75E7c3432fa31d179cad6C5843F24;

    // min tokens to be a holder, 0.1
    uint256 public constant MIN_HOLDER_TOKENS = 10 ** uint256(decimals - 1);
    
    /**
     * @dev Constructor
     * @param _firstUnlockTime first unlock time
     * @param _secondUnlockTime second unlock time
     */
    function BetexToken
    (
        uint256 _firstUnlockTime, 
        uint256 _secondUnlockTime
    )
        public 
    {        
        require(_secondUnlockTime > firstUnlockTime);

        firstUnlockTime = _firstUnlockTime;
        secondUnlockTime = _secondUnlockTime;

        // Allocate tokens to the bounty fund
        balances[BOUNTY_ADDRESS] = BOUNTY_SUPPLY;
        holders.push(BOUNTY_ADDRESS);
        emit Transfer(0x0, BOUNTY_ADDRESS, BOUNTY_SUPPLY);

        // Allocate tokens to the reserve fund
        balances[RESERVE_ADDRESS] = RESERVE_SUPPLY;
        holders.push(RESERVE_ADDRESS);
        emit Transfer(0x0, RESERVE_ADDRESS, RESERVE_SUPPLY);

        // Allocate tokens to the broker reserve fund
        balances[BROKER_RESERVE_ADDRESS] = BROKER_RESERVE_SUPPLY;
        holders.push(BROKER_RESERVE_ADDRESS);
        emit Transfer(0x0, BROKER_RESERVE_ADDRESS, BROKER_RESERVE_SUPPLY);

        // Allocate tokens to the team fund
        balances[TEAM_ADDRESS] = TEAM_SUPPLY;
        holders.push(TEAM_ADDRESS);
        emit Transfer(0x0, TEAM_ADDRESS, TEAM_SUPPLY);

        totalSupply_ = TOTAL_SUPPLY.sub(SALE_SUPPLY);
    }

    /**
     * @dev set ICO address and allocate sale supply to it
     */
    function setICO(address _icoAddress) public onlyOwner {
        require(_icoAddress != address(0));
        require(icoAddress == address(0));
        require(totalSupply_ == TOTAL_SUPPLY.sub(SALE_SUPPLY));
        
        // Allocate tokens to the ico contract
        balances[_icoAddress] = SALE_SUPPLY;
        emit Transfer(0x0, _icoAddress, SALE_SUPPLY);

        icoAddress = _icoAddress;
        totalSupply_ = TOTAL_SUPPLY;
    }
    
    // standard transfer function with timelocks
    function transfer(address _to, uint256 _value) public returns (bool) {
        require(transferAllowed(msg.sender));
        enforceSecondLock(msg.sender, _to);
        preserveHolders(msg.sender, _to, _value);
        return super.transfer(_to, _value);
    }

    // standard transferFrom function with timelocks
    function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
        require(transferAllowed(msg.sender));
        enforceSecondLock(msg.sender, _to);
        preserveHolders(_from, _to, _value);
        return super.transferFrom(_from, _to, _value);
    }

    // get holders count
    function getHoldersCount() public view returns (uint256) {
        return holders.length;
    }

    // enforce second lock on receiver
    function enforceSecondLock(address _from, address _to) internal {
        if (now < secondUnlockTime) { // solium-disable-line security/no-block-members
            if (_from == TEAM_ADDRESS || _from == BROKER_RESERVE_ADDRESS) {
                require(balances[_to] == uint256(0) || blockedTillSecondUnlock[_to]);
                blockedTillSecondUnlock[_to] = true;
            }
        }
    }

    // preserve holders list
    function preserveHolders(address _from, address _to, uint256 _value) internal {
        if (balances[_from].sub(_value) < MIN_HOLDER_TOKENS) 
            removeHolder(_from);
        if (balances[_to].add(_value) >= MIN_HOLDER_TOKENS) 
            addHolder(_to);   
    }

    // remove holder from the holders list
    function removeHolder(address _holder) internal {
        uint256 _number = holderNumber[_holder];

        if (_number == 0 || holders.length == 0 || _number > holders.length)
            return;

        uint256 _index = _number.sub(1);
        uint256 _lastIndex = holders.length.sub(1);
        address _lastHolder = holders[_lastIndex];

        if (_index != _lastIndex) {
            holders[_index] = _lastHolder;
            holderNumber[_lastHolder] = _number;
        }

        holderNumber[_holder] = 0;
        holders.length = _lastIndex;
    } 

    // add holder to the holders list
    function addHolder(address _holder) internal {
        if (holderNumber[_holder] == 0) {
            holders.push(_holder);
            holderNumber[_holder] = holders.length;
        }
    }

    // @return true if transfer operation is allowed
    function transferAllowed(address _sender) internal view returns(bool) {
        if (now > secondUnlockTime || _sender == icoAddress) // solium-disable-line security/no-block-members
            return true;
        if (now < firstUnlockTime) // solium-disable-line security/no-block-members
            return false;
        if (blockedTillSecondUnlock[_sender])
            return false;
        return true;
    }

}


/**
 * @title BetexStorage
 */
contract BetexStorage is Ownable {

    // minimum funding to get volume bonus	
    uint256 public constant VOLUME_BONUS_CONDITION = 50 ether;

    // minimum funding to get volume extra bonus	
    uint256 public constant VOLUME_EXTRA_BONUS_CONDITION = 100 ether;

    // extra bonus amount during first bonus round, %
    uint256 public constant FIRST_VOLUME_EXTRA_BONUS = 20;

    // extra bonus amount during second bonus round, %
    uint256 public constant SECOND_VOLUME_EXTRA_BONUS = 10;

    // bonus amount during first bonus round, %
    uint256 public constant FIRST_VOLUME_BONUS = 10;

    // bonus amount during second bonus round, %
    uint256 public constant SECOND_VOLUME_BONUS = 5;

    // oraclize funding order
    struct Order {
        address beneficiary;
        uint256 funds;
        uint256 bonus;
        uint256 rate;
    }

    // oraclize funding orders
    mapping (bytes32 => Order) public orders;

    // oraclize orders for unsold tokens allocation
    mapping (bytes32 => bool) public unsoldAllocationOrders;

    // addresses allowed to buy tokens
    mapping (address => bool) public whitelist;

    // funded
    mapping (address => bool) public funded;

    // funders
    address[] public funders;
    
    // pre ico funders
    address[] public preICOFunders;

    // tokens to allocate before ico sale starts
    mapping (address => uint256) public preICOBalances;

    // is preICO data initialized
    bool public preICODataInitialized;


    /**
     * @dev Constructor
     */  
    function BetexStorage() public {

        // pre sale round 1
        preICOFunders.push(0x233Fd2B3d7a0924Fe1Bb0dd7FA168eEF8C522E65);
        preICOBalances[0x233Fd2B3d7a0924Fe1Bb0dd7FA168eEF8C522E65] = 15000000000000000000000;
        preICOFunders.push(0x2712ba56cB3Cf8783693c8a1796F70ABa57132b1);
        preICOBalances[0x2712ba56cB3Cf8783693c8a1796F70ABa57132b1] = 15000000000000000000000;
        preICOFunders.push(0x6f3DDfb726eA637e125C4fbf6694B940711478f4);
        preICOBalances[0x6f3DDfb726eA637e125C4fbf6694B940711478f4] = 15000000000000000000000;
        preICOFunders.push(0xAf7Ff6f381684707001d517Bf83C4a3538f9C82a);
        preICOBalances[0xAf7Ff6f381684707001d517Bf83C4a3538f9C82a] = 22548265874120000000000;
        preICOFunders.push(0x51219a9330c196b8bd7fA0737C8e0db53c1ad628);
        preICOBalances[0x51219a9330c196b8bd7fA0737C8e0db53c1ad628] = 32145215844400000000000;
        preICOFunders.push(0xA2D42D689769f7BA32712f27B09606fFD8F3b699);
        preICOBalances[0xA2D42D689769f7BA32712f27B09606fFD8F3b699] = 15000000000000000000000;
        preICOFunders.push(0xB7C9D3AAbF44296232538B8b184F274B57003994);
        preICOBalances[0xB7C9D3AAbF44296232538B8b184F274B57003994] = 20000000000000000000000;
        preICOFunders.push(0x58667a170F53b809CA9143c1CeEa00D2Df866577);
        preICOBalances[0x58667a170F53b809CA9143c1CeEa00D2Df866577] = 184526257787000000000000;
        preICOFunders.push(0x0D4b2A1a47b1059d622C033c2a58F2F651010553);
        preICOBalances[0x0D4b2A1a47b1059d622C033c2a58F2F651010553] = 17845264771100000000000;
        preICOFunders.push(0x982F59497026473d2227f5dd02cdf6fdCF237AE0);
        preICOBalances[0x982F59497026473d2227f5dd02cdf6fdCF237AE0] = 31358989521120000000000;
        preICOFunders.push(0x250d540EFeabA7b5C0407A955Fd76217590dbc37);
        preICOBalances[0x250d540EFeabA7b5C0407A955Fd76217590dbc37] = 15000000000000000000000;
        preICOFunders.push(0x2Cde7768B7d5dcb12c5b5572daEf3F7B855c8685);
        preICOBalances[0x2Cde7768B7d5dcb12c5b5572daEf3F7B855c8685] = 17500000000000000000000;
        preICOFunders.push(0x89777c2a4C1843a99B2fF481a4CEF67f5d7A1387);
        preICOBalances[0x89777c2a4C1843a99B2fF481a4CEF67f5d7A1387] = 15000000000000000000000;
        preICOFunders.push(0x63699D4d309e48e8B575BE771700570A828dC655);
        preICOBalances[0x63699D4d309e48e8B575BE771700570A828dC655] = 15000000000000000000000;
        preICOFunders.push(0x9bc92E0da2e4aC174b8E33D7c74b5009563a8e2A);
        preICOBalances[0x9bc92E0da2e4aC174b8E33D7c74b5009563a8e2A] = 21542365440880000000000;
        preICOFunders.push(0xA1CA632CF8Fb3a965c84668e09e3BEdb3567F35D);
        preICOBalances[0xA1CA632CF8Fb3a965c84668e09e3BEdb3567F35D] = 15000000000000000000000;
        preICOFunders.push(0x1DCeF74ddD26c82f34B300E027b5CaA4eC4F8C83);
        preICOBalances[0x1DCeF74ddD26c82f34B300E027b5CaA4eC4F8C83] = 15000000000000000000000;
        preICOFunders.push(0x51B7Bf4B7C1E89cfe7C09938Ad0096F9dFFCA4B7);
        preICOBalances[0x51B7Bf4B7C1E89cfe7C09938Ad0096F9dFFCA4B7] = 17533640761380000000000;

        // pre sale round 2 
        preICOFunders.push(0xD2Cdc0905877ee3b7d08220D783bd042de825AEb);
        preICOBalances[0xD2Cdc0905877ee3b7d08220D783bd042de825AEb] = 5000000000000000000000;
        preICOFunders.push(0x3b217081702AF670e2c2fD25FD7da882620a68E8);
        preICOBalances[0x3b217081702AF670e2c2fD25FD7da882620a68E8] = 7415245400000000000000;
        preICOFunders.push(0xbA860D4B9423bF6b517B29c395A49fe80Da758E3);
        preICOBalances[0xbA860D4B9423bF6b517B29c395A49fe80Da758E3] = 5000000000000000000000;
        preICOFunders.push(0xF64b80DdfB860C0D1bEb760fd9fC663c4D5C4dC3);
        preICOBalances[0xF64b80DdfB860C0D1bEb760fd9fC663c4D5C4dC3] = 75000000000000000000000;
        preICOFunders.push(0x396D5A35B5f41D7cafCCF9BeF225c274d2c7B6E2);
        preICOBalances[0x396D5A35B5f41D7cafCCF9BeF225c274d2c7B6E2] = 74589245777000000000000;
        preICOFunders.push(0x4d61A4aD175E96139Ae8c5d951327e3f6Cc3f764);
        preICOBalances[0x4d61A4aD175E96139Ae8c5d951327e3f6Cc3f764] = 5000000000000000000000;
        preICOFunders.push(0x4B490F6A49C17657A5508B8Bf8F1D7f5aAD8c921);
        preICOBalances[0x4B490F6A49C17657A5508B8Bf8F1D7f5aAD8c921] = 200000000000000000000000;
        preICOFunders.push(0xC943038f2f1dd1faC6E10B82039C14bd20ff1F8E);
        preICOBalances[0xC943038f2f1dd1faC6E10B82039C14bd20ff1F8E] = 174522545811300000000000;
        preICOFunders.push(0xBa87D63A8C4Ed665b6881BaCe4A225a07c418F22);
        preICOBalances[0xBa87D63A8C4Ed665b6881BaCe4A225a07c418F22] = 5000000000000000000000;
        preICOFunders.push(0x753846c0467cF320BcDA9f1C67fF86dF39b1438c);
        preICOBalances[0x753846c0467cF320BcDA9f1C67fF86dF39b1438c] = 5000000000000000000000;
        preICOFunders.push(0x3773bBB1adDF9D642D5bbFaafa13b0690Fb33460);
        preICOBalances[0x3773bBB1adDF9D642D5bbFaafa13b0690Fb33460] = 5000000000000000000000;
        preICOFunders.push(0x456Cf70345cbF483779166af117B40938B8F0A9c);
        preICOBalances[0x456Cf70345cbF483779166af117B40938B8F0A9c] = 50000000000000000000000;
        preICOFunders.push(0x662AE260D736F041Db66c34617d5fB22eC0cC2Ee);
        preICOBalances[0x662AE260D736F041Db66c34617d5fB22eC0cC2Ee] = 40000000000000000000000;
        preICOFunders.push(0xEa7e647F167AdAa4df52AF630A873a1379f68E3F);
        preICOBalances[0xEa7e647F167AdAa4df52AF630A873a1379f68E3F] = 40000000000000000000000;
        preICOFunders.push(0x352913f3F7CA96530180b93C18C86f38b3F0c429);
        preICOBalances[0x352913f3F7CA96530180b93C18C86f38b3F0c429] = 45458265454000000000000;
        preICOFunders.push(0xB21bf8391a6500ED210Af96d125867124261f4d4);
        preICOBalances[0xB21bf8391a6500ED210Af96d125867124261f4d4] = 5000000000000000000000;
        preICOFunders.push(0xDecBd29B42c66f90679D2CB34e73E571F447f6c5);
        preICOBalances[0xDecBd29B42c66f90679D2CB34e73E571F447f6c5] = 7500000000000000000000;
        preICOFunders.push(0xE36106a0DC0F07e87f7194694631511317909b8B);
        preICOBalances[0xE36106a0DC0F07e87f7194694631511317909b8B] = 5000000000000000000000;
        preICOFunders.push(0xe9114cd97E0Ee4fe349D3F57d0C9710E18581b69);
        preICOBalances[0xe9114cd97E0Ee4fe349D3F57d0C9710E18581b69] = 40000000000000000000000;
        preICOFunders.push(0xC73996ce45752B9AE4e85EDDf056Aa9aaCaAD4A2);
        preICOBalances[0xC73996ce45752B9AE4e85EDDf056Aa9aaCaAD4A2] = 100000000000000000000000;
        preICOFunders.push(0x6C1407d9984Dc2cE33456b67acAaEC78c1784673);
        preICOBalances[0x6C1407d9984Dc2cE33456b67acAaEC78c1784673] = 5000000000000000000000;
        preICOFunders.push(0x987e93429004CA9fa2A42604658B99Bb5A574f01);
        preICOBalances[0x987e93429004CA9fa2A42604658B99Bb5A574f01] = 124354548881022000000000;
        preICOFunders.push(0x4c3B81B5f9f9c7efa03bE39218E6760E8D2A1609);
        preICOBalances[0x4c3B81B5f9f9c7efa03bE39218E6760E8D2A1609] = 5000000000000000000000;
        preICOFunders.push(0x33fA8cd89B151458Cb147ecC497e469f2c1D38eA);
        preICOBalances[0x33fA8cd89B151458Cb147ecC497e469f2c1D38eA] = 60000000000000000000000;

        // main sale (01-31 of Marh)
        preICOFunders.push(0x9AfA1204afCf48AB4302F246Ef4BE5C1D733a751);
        preICOBalances[0x9AfA1204afCf48AB4302F246Ef4BE5C1D733a751] = 154551417972192330000000;
    }

    /**
     * @dev Add a new address to the funders
     * @param _funder funder's address
     */
    function addFunder(address _funder) public onlyOwner {
        if (!funded[_funder]) {
            funders.push(_funder);
            funded[_funder] = true;
        }
    }
   
    /**
     * @return true if address is a funder address
     * @param _funder funder's address
     */
    function isFunder(address _funder) public view returns(bool) {
        return funded[_funder];
    }

    /**
     * @return funders count
     */
    function getFundersCount() public view returns(uint256) {
        return funders.length;
    }

    /**
     * @return number of preICO funders count
     */
    function getPreICOFundersCount() public view returns(uint256) {
        return preICOFunders.length;
    }

    /**
     * @dev Add a new oraclize funding order
     * @param _orderId oraclize order id
     * @param _beneficiary who'll get the tokens
     * @param _funds paid wei amount
     * @param _bonus bonus amount
     */
    function addOrder(
        bytes32 _orderId, 
        address _beneficiary, 
        uint256 _funds, 
        uint256 _bonus
    )
        public 
        onlyOwner 
    {
        orders[_orderId].beneficiary = _beneficiary;
        orders[_orderId].funds = _funds;
        orders[_orderId].bonus = _bonus;
    }

    /**
     * @dev Get oraclize funding order by order id
     * @param _orderId oraclize order id
     * @return beneficiaty address, paid funds amount and bonus amount 
     */
    function getOrder(bytes32 _orderId) 
        public 
        view 
        returns(address, uint256, uint256)
    {
        address _beneficiary = orders[_orderId].beneficiary;
        uint256 _funds = orders[_orderId].funds;
        uint256 _bonus = orders[_orderId].bonus;

        return (_beneficiary, _funds, _bonus);
    }

    /**
     * @dev Set eth/usd rate for the specified oraclize order
     * @param _orderId oraclize order id
     * @param _rate eth/usd rate
     */
    function setRateForOrder(bytes32 _orderId, uint256 _rate) public onlyOwner {
        orders[_orderId].rate = _rate;
    }

    /**
     * @dev Add a new oraclize unsold tokens allocation order
     * @param _orderId oraclize order id
     */
    function addUnsoldAllocationOrder(bytes32 _orderId) public onlyOwner {
        unsoldAllocationOrders[_orderId] = true;
    }

    /**
     * @dev Whitelist the address
     * @param _address address to be whitelisted
     */
    function addToWhitelist(address _address) public onlyOwner {
        whitelist[_address] = true;
    }

    /**
     * @dev Check if address is whitelisted
     * @param _address address that needs to be verified
     * @return true if address is whitelisted
     */
    function isWhitelisted(address _address) public view returns(bool) {
        return whitelist[_address];
    }

    /**
     * @dev Get bonus amount for token purchase
     * @param _funds amount of the funds
     * @param _bonusChangeTime bonus change time
     * @return corresponding bonus value
     */
    function getBonus(uint256 _funds, uint256 _bonusChangeTime) public view returns(uint256) {
        
        if (_funds < VOLUME_BONUS_CONDITION)
            return 0;

        if (now < _bonusChangeTime) { // solium-disable-line security/no-block-members
            if (_funds >= VOLUME_EXTRA_BONUS_CONDITION)
                return FIRST_VOLUME_EXTRA_BONUS;
            else 
                return FIRST_VOLUME_BONUS;
        } else {
            if (_funds >= VOLUME_EXTRA_BONUS_CONDITION)
                return SECOND_VOLUME_EXTRA_BONUS;
            else
                return SECOND_VOLUME_BONUS;
        }
        return 0;
    }
}



// <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.
*/

// This api is currently targeted at 0.4.18, please import oraclizeAPI_pre0.4.sol or oraclizeAPI_0.4 where necessary
pragma solidity ^0.4.18;

contract OraclizeI {
    address public cbAddress;
    function query(uint _timestamp, string _datasource, string _arg) external payable returns (bytes32 _id);
    function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) external payable returns (bytes32 _id);
    function query2(uint _timestamp, string _datasource, string _arg1, string _arg2) public payable returns (bytes32 _id);
    function query2_withGasLimit(uint _timestamp, string _datasource, string _arg1, string _arg2, uint _gaslimit) external payable returns (bytes32 _id);
    function queryN(uint _timestamp, string _datasource, bytes _argN) public payable returns (bytes32 _id);
    function queryN_withGasLimit(uint _timestamp, string _datasource, bytes _argN, uint _gaslimit) external payable returns (bytes32 _id);
    function getPrice(string _datasource) public returns (uint _dsprice);
    function getPrice(string _datasource, uint gaslimit) public returns (uint _dsprice);
    function setProofType(byte _proofType) external;
    function setCustomGasPrice(uint _gasPrice) external;
    function randomDS_getSessionPubKeyHash() external constant returns(bytes32);
}
contract OraclizeAddrResolverI {
    function getAddress() public 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);

        if(address(oraclize) != OAR.getAddress())
            oraclize = OraclizeI(OAR.getAddress());

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

    function oraclize_setNetwork(uint8 networkID) internal returns(bool){
      return oraclize_setNetwork();
      networkID; // silence the warning and remain backwards compatible
    }
    function oraclize_setNetwork() 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) public {
        __callback(myid, result, new bytes(0));
    }
    function __callback(bytes32 myid, string result, bytes proof) public {
      return;
      myid; result; proof; // Silence compiler warnings
    }

    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_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 pure 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 pure 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 pure 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 pure 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 pure returns (string) {
        return strConcat(_a, _b, _c, _d, "");
    }

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

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

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

    // parseInt(parseFloat*10^_b)
    function parseInt(string _a, uint _b) internal pure 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 pure 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 pure 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 pure 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 view returns (string) {
        return oraclize_network_name;
    }

    function oraclize_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32){
        require((_nbytes > 0) && (_nbytes <= 32));
        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, keccak256(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(keccak256(pubkey)) == signer) return true;
        else {
            (sigok, signer) = safer_ecrecover(tosignh, 28, sigr, sigs);
            return (address(keccak256(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] = byte(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)
        require((_proof[0] == "L") && (_proof[1] == "P") && (_proof[2] == 1));

        bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName());
        require(proofVerified);

        _;
    }

    function oraclize_randomDS_proofVerify__returnCode(bytes32 _queryId, string _result, bytes _proof) internal returns (uint8){
        // Step 1: the prefix has to match 'LP\x01' (Ledger Proof version 1)
        if ((_proof[0] != "L")||(_proof[1] != "P")||(_proof[2] != 1)) return 1;

        bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName());
        if (proofVerified == false) return 2;

        return 0;
    }

    function matchBytes32Prefix(bytes32 content, bytes prefix, uint n_random_bytes) internal pure returns (bool){
        bool match_ = true;


        for (uint256 i=0; i< n_random_bytes; 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){

        // 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);
        if (!(keccak256(keyhash) == keccak256(sha256(context_name, queryId)))) 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)
        if (!matchBytes32Prefix(sha256(sig1), result, uint(proof[ledgerProofLength+32+8]))) return false;

        // Step 4: commitment match verification, keccak256(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] == keccak256(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);
        if (!verifySig(sha256(tosign1), sig1, sessionPubkey)) 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 pure returns (bytes) {
        uint minLength = length + toOffset;

        // Buffer too small
        require(to.length >= minLength); // 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>



/**
 * @title BetexICO
 */
contract BetexICO is usingOraclize, HasNoContracts {
    using SafeMath for uint256;
    using SafeERC20 for ERC20;

    // Betex token
    BetexToken public token;

    // Betex storage
    BetexStorage public betexStorage;

    // ico start timestamp
    uint256 public startTime;

    // bonus change timestamp  
    uint256 public bonusChangeTime;

    // ico end timestamp
    uint256 public endTime;

    // wallet address to trasfer funding to
    address public wallet;

    // tokens sold
    uint256 public sold;

    // wei raised
    uint256 public raised;

    // unsold tokens amount
    uint256 public unsoldTokensAmount;

    // how many tokens are sold before unsold allocation started
    uint256 public soldBeforeUnsoldAllocation;

    // counter for funders, who got unsold tokens allocated
    uint256 public unsoldAllocationCount;

    // are preICO tokens allocated
    bool public preICOTokensAllocated;

    // is unsold tokens allocation scheduled
    bool public unsoldAllocatonScheduled;

    // eth/usd rate url
    string public ethRateURL = "json(https://api.coinmarketcap.com/v1/ticker/ethereum/).0.price_usd";

    // oraclize gas limit
    uint256 public oraclizeGasLimit = 200000;

    // unsold tokens allocation oraclize gas limit
    uint256 public unsoldAllocationOraclizeGasLimit = 2500000;

    // three hours delay (from the ico end time) for unsold tokens allocation
    uint256 public unsoldAllocationDelay = 10800;

    // addresses authorized to refill the contract (for oraclize queries)
    mapping (address => bool) public refillers;

    // minimum funding amount
    uint256 public constant MIN_FUNDING_AMOUNT = 0.5 ether;

    // rate exponent
    uint256 public constant RATE_EXPONENT = 4;

    // token price, usd
    uint256 public constant TOKEN_PRICE = 3;

    // size of unsold tokens allocation bunch
    uint256 public constant UNSOLD_ALLOCATION_SIZE = 50; 

    // unsold allocation exponent
    uint256 public constant UNSOLD_ALLOCATION_EXPONENT = 10;

    /**
     * event for add to whitelist logging
     * @param funder funder address
     */
    event WhitelistAddEvent(address indexed funder);

    /**
     * event for funding order logging
     * @param funder funder who has done the order
     * @param orderId oraclize orderId
     * @param funds paid wei amount
     */
    event OrderEvent(address indexed funder, bytes32 indexed orderId, uint256 funds);

    /**
     * event for token purchase logging
     * @param funder funder who paid for the tokens
     * @param orderId oraclize orderId
     * @param tokens amount of tokens purchased
     */
    event TokenPurchaseEvent(address indexed funder, bytes32 indexed orderId, uint256 tokens);

    /**
     * event for unsold tokens allocation logging
     * @param funder funder token holders
     * @param tokens amount of tokens purchased
     */
    event UnsoldTokensAllocationEvent(address indexed funder, uint256 tokens);


    /**
     * @dev Constructor
     * @param _startTime start time timestamp
     * @param _bonusChangeTime bonus change timestamp
     * @param _endTime end time timestamp
     * @param _wallet wallet address to transfer funding to
     * @param _token Betex token address
     * @param _betexStorage BetexStorage contract address
     */
    function BetexICO (
        uint256 _startTime,
        uint256 _bonusChangeTime,
        uint256 _endTime,
        address _wallet, 
        address _token,
        address _betexStorage
    ) 
        public 
        payable
    {
        require(_startTime < _endTime);
        require(_bonusChangeTime > _startTime && _bonusChangeTime < _endTime);

        require(_wallet != address(0));
        require(_token != address(0));
        require(_betexStorage != address(0));

        startTime = _startTime;
        bonusChangeTime = _bonusChangeTime;
        endTime = _endTime;
        wallet = _wallet;

        token = BetexToken(_token);
        betexStorage = BetexStorage(_betexStorage);
    }

    // fallback function, used to buy tokens and refill the contract for oraclize
    function () public payable {
        address _sender = msg.sender;
        uint256 _funds = msg.value;

        if (betexStorage.isWhitelisted(_sender)) {
            buyTokens(_sender, _funds);
        } else if (!refillers[_sender] && !(owner == _sender)) {
            revert();
        }
    }

    /**
     * @dev Get current rate from oraclize and transfer tokens or start unsold tokens allocation
     * @param _orderId oraclize order id
     * @param _result current eth/usd rate
     */
    function __callback(bytes32 _orderId, string _result) public {  // solium-disable-line mixedcase
        require(msg.sender == oraclize_cbAddress());

        // check if it's an order for aftersale token allocation
        if (betexStorage.unsoldAllocationOrders(_orderId)) {
            if (!allUnsoldTokensAllocated()) {
                allocateUnsoldTokens();
                if (!allUnsoldTokensAllocated()) {
                    bytes32 orderId = oraclize_query("URL", ethRateURL, unsoldAllocationOraclizeGasLimit);
                    betexStorage.addUnsoldAllocationOrder(orderId);
                }
            }
        } else {
            uint256 _rate = parseInt(_result, RATE_EXPONENT);

            address _beneficiary;
            uint256 _funds;
            uint256 _bonus;

            (_beneficiary, _funds, _bonus) = betexStorage.getOrder(_orderId);

            uint256 _sum = _funds.mul(_rate).div(10 ** RATE_EXPONENT);
            uint256 _tokens = _sum.div(TOKEN_PRICE);

            uint256 _bonusTokens = _tokens.mul(_bonus).div(100);
            _tokens = _tokens.add(_bonusTokens);

            if (sold.add(_tokens) > token.SALE_SUPPLY()) {
                _tokens = token.SALE_SUPPLY().sub(sold);
            }

            betexStorage.setRateForOrder(_orderId, _rate);

            token.transfer(_beneficiary, _tokens);
            sold = sold.add(_tokens);
            emit TokenPurchaseEvent(_beneficiary, _orderId, _tokens);
        }
    }

    // schedule unsold tokens allocation using oraclize
    function scheduleUnsoldAllocation() public {
        require(!unsoldAllocatonScheduled);

        // query for unsold tokens allocation with delay from the ico end time
        bytes32 _orderId = oraclize_query(endTime.add(unsoldAllocationDelay), "URL", ethRateURL, unsoldAllocationOraclizeGasLimit); // solium-disable-line arg-overflow
        betexStorage.addUnsoldAllocationOrder(_orderId); 

        unsoldAllocatonScheduled = true;
    }

    /**
     * @dev Allocate unsold tokens (for bunch of funders)
     */
    function allocateUnsoldTokens() public {
        require(now > endTime.add(unsoldAllocationDelay)); // solium-disable-line security/no-block-members
        require(!allUnsoldTokensAllocated());

        // save unsold and sold amounts
        if (unsoldAllocationCount == 0) {
            unsoldTokensAmount = token.SALE_SUPPLY().sub(sold);
            soldBeforeUnsoldAllocation = sold;
        }

        for (uint256 i = 0; i < UNSOLD_ALLOCATION_SIZE && !allUnsoldTokensAllocated(); i = i.add(1)) {
            address _funder = betexStorage.funders(unsoldAllocationCount);
            uint256 _funderTokens = token.balanceOf(_funder);

            if (_funderTokens != 0) {
                uint256 _share = _funderTokens.mul(10 ** UNSOLD_ALLOCATION_EXPONENT).div(soldBeforeUnsoldAllocation);
                uint256 _tokensToAllocate = unsoldTokensAmount.mul(_share).div(10 ** UNSOLD_ALLOCATION_EXPONENT);

                token.transfer(_funder, _tokensToAllocate); 
                emit UnsoldTokensAllocationEvent(_funder, _tokensToAllocate);
                sold = sold.add(_tokensToAllocate);
            }

            unsoldAllocationCount = unsoldAllocationCount.add(1);
        }

        if (allUnsoldTokensAllocated()) {
            if (sold < token.SALE_SUPPLY()) {
                uint256 _change = token.SALE_SUPPLY().sub(sold);
                address _reserveAddress = token.RESERVE_ADDRESS();
                token.transfer(_reserveAddress, _change);
                sold = sold.add(_change);
            }
        }           
    }

    // allocate preICO tokens
    function allocatePreICOTokens() public {
        require(!preICOTokensAllocated);

        for (uint256 i = 0; i < betexStorage.getPreICOFundersCount(); i++) {
            address _funder = betexStorage.preICOFunders(i);
            uint256 _tokens = betexStorage.preICOBalances(_funder);

            token.transfer(_funder, _tokens);
            sold = sold.add(_tokens);

            betexStorage.addFunder(_funder);
        }
        
        preICOTokensAllocated = true;
    }

    /**
     * @dev Whitelist funder's address
     * @param _funder funder's address
     */
    function addToWhitelist(address _funder) onlyOwner public {
        require(_funder != address(0));
        betexStorage.addToWhitelist(_funder);

        emit WhitelistAddEvent(_funder);
    }

    /**
     * @dev Set oraclize gas limit
     * @param _gasLimit a new oraclize gas limit
     */
    function setOraclizeGasLimit(uint256 _gasLimit) onlyOwner public {
        require(_gasLimit > 0);
        oraclizeGasLimit = _gasLimit;
    }

    /**
     * @dev Set oraclize gas price
     * @param _gasPrice a new oraclize gas price
     */
    function setOraclizeGasPrice(uint256 _gasPrice) onlyOwner public {
        require(_gasPrice > 0);
        oraclize_setCustomGasPrice(_gasPrice);
    }

    /**
     * @dev Add a refiller
     * @param _refiller address that authorized to refill the contract
     */
    function addRefiller(address _refiller) onlyOwner public {
        require(_refiller != address(0));
        refillers[_refiller] = true;
    }

    /**
     * @dev Withdraw ether from contract
     * @param _amount amount to withdraw
     */
    function withdrawEther(uint256 _amount) onlyOwner public {
        require(address(this).balance >= _amount);
        owner.transfer(_amount);
    }

    /**
     * @dev Makes order for tokens purchase
     * @param _funder funder who paid for the tokens
     * @param _funds amount of the funds
     */
    function buyTokens(address _funder, uint256 _funds) internal {
        require(liveBetexICO());
        require(_funds >= MIN_FUNDING_AMOUNT);
        require(oraclize_getPrice("URL") <= address(this).balance);
        
        bytes32 _orderId = oraclize_query("URL", ethRateURL, oraclizeGasLimit);
        uint256 _bonus = betexStorage.getBonus(_funds, bonusChangeTime);
        betexStorage.addOrder(_orderId, _funder, _funds, _bonus); // solium-disable-line arg-overflow

        wallet.transfer(_funds);
        raised = raised.add(_funds);

        betexStorage.addFunder(_funder);

        emit OrderEvent(_funder, _orderId, _funds);
    }

    // @return true if all unsold tokens are allocated
    function allUnsoldTokensAllocated() internal view returns (bool) {
        return unsoldAllocationCount == betexStorage.getFundersCount();
    }

    // @return true if the ICO is alive
    function liveBetexICO() internal view returns (bool) {
        return now >= startTime && now <= endTime && sold < token.SALE_SUPPLY(); // solium-disable-line security/no-block-members
    }
    
}

    Contract ABI  
[{"constant":true,"inputs":[],"name":"unsoldAllocatonScheduled","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"sold","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_refiller","type":"address"}],"name":"addRefiller","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"unsoldAllocationDelay","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"refillers","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_orderId","type":"bytes32"},{"name":"_result","type":"string"}],"name":"__callback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"contractAddr","type":"address"}],"name":"reclaimContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UNSOLD_ALLOCATION_SIZE","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"endTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"scheduleUnsoldAllocation","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"betexStorage","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","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":false,"inputs":[{"name":"_amount","type":"uint256"}],"name":"withdrawEther","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"UNSOLD_ALLOCATION_EXPONENT","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"oraclizeGasLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"unsoldTokensAmount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"wallet","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"RATE_EXPONENT","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_gasPrice","type":"uint256"}],"name":"setOraclizeGasPrice","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"startTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"allocateUnsoldTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"preICOTokensAllocated","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"unsoldAllocationCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ethRateURL","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_gasLimit","type":"uint256"}],"name":"setOraclizeGasLimit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"allocatePreICOTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"unsoldAllocationOraclizeGasLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"bonusChangeTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"soldBeforeUnsoldAllocation","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MIN_FUNDING_AMOUNT","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"TOKEN_PRICE","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_funder","type":"address"}],"name":"addToWhitelist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"raised","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_startTime","type":"uint256"},{"name":"_bonusChangeTime","type":"uint256"},{"name":"_endTime","type":"uint256"},{"name":"_wallet","type":"address"},{"name":"_token","type":"address"},{"name":"_betexStorage","type":"address"}],"payable":true,"stateMutability":"payable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"funder","type":"address"}],"name":"WhitelistAddEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"funder","type":"address"},{"indexed":true,"name":"orderId","type":"bytes32"},{"indexed":false,"name":"funds","type":"uint256"}],"name":"OrderEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"funder","type":"address"},{"indexed":true,"name":"orderId","type":"bytes32"},{"indexed":false,"name":"tokens","type":"uint256"}],"name":"TokenPurchaseEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"funder","type":"address"},{"indexed":false,"name":"tokens","type":"uint256"}],"name":"UnsoldTokensAllocationEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

  Contract Creation Code Switch To Opcodes View
6060604052608060405190810160405280604381526020017f6a736f6e2868747470733a2f2f6170692e636f696e6d61726b65746361702e6381526020017f6f6d2f76312f7469636b65722f657468657265756d2f292e302e70726963655f81526020017f7573640000000000000000000000000000000000000000000000000000000000815250601290805190602001906200009e92919062000303565b5062030d40601355622625a0601455612a3060155560405160c08062004f9e8339810160405280805190602001909190805190602001909190805190602001909190805190602001909190805190602001909190805190602001909190505033600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083861015156200014d57600080fd5b85851180156200015c57508385105b15156200016857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515620001a557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515620001e257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156200021f57600080fd5b856008819055508460098190555083600a8190555082600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050505050620003b2565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200034657805160ff191683800117855562000377565b8280016001018555821562000377579182015b828111156200037657825182559160200191906001019062000359565b5b5090506200038691906200038a565b5090565b620003af91905b80821115620003ab57600081600090555060010162000391565b5090565b90565b614bdc80620003c26000396000f3006060604052600436106101c2576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301d92dc81461036957806302c7e7af146103965780630abe293d146103bf5780631766f424146103f8578063251108631461042157806327dc297e146104725780632aed7f3f146104dc5780633188ed13146105155780633197cbb61461053e57806334f2d1ec1461056757806336a36f7c1461057c57806338bbfa50146105d15780633bed33ce1461067e5780634499e043146106a157806350b9c428146106ca57806350df7eb4146106f3578063521eb2731461071c5780636efd1adf1461077157806371c82c141461079a57806378e97925146107bd57806378ed8dfd146107e65780637935326b146107fb5780637f8dafef1461082857806386d3f4b7146108515780638da5cb5b146108df5780638ddf792b146109345780639d97bcd714610957578063a9c6c7141461096c578063b02447e014610995578063bba9cfe1146109be578063d2a7d38a146109e7578063d2d8cb6714610a10578063e43252d714610a39578063f0ea4bfc14610a72578063f2fde38b14610a9b578063fc0c546a14610ad4575b600080339150349050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633af32abf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561028757600080fd5b5af1151561029457600080fd5b50505060405180519050156102b2576102ad8282610b29565b610365565b601660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561035a57508173ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b1561036457600080fd5b5b5050005b341561037457600080fd5b61037c610fd8565b604051808215151515815260200191505060405180910390f35b34156103a157600080fd5b6103a9610feb565b6040518082815260200191505060405180910390f35b34156103ca57600080fd5b6103f6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ff1565b005b341561040357600080fd5b61040b6110e4565b6040518082815260200191505060405180910390f35b341561042c57600080fd5b610458600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506110ea565b604051808215151515815260200191505060405180910390f35b341561047d57600080fd5b6104da60048080356000191690602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061110a565b005b34156104e757600080fd5b610513600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061187f565b005b341561052057600080fd5b6105286119b0565b6040518082815260200191505060405180910390f35b341561054957600080fd5b6105516119b5565b6040518082815260200191505060405180910390f35b341561057257600080fd5b61057a6119bb565b005b341561058757600080fd5b61058f611b94565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156105dc57600080fd5b61067c60048080356000191690602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611bba565b005b341561068957600080fd5b61069f6004808035906020019091905050611bbf565b005b34156106ac57600080fd5b6106b4611ca6565b6040518082815260200191505060405180910390f35b34156106d557600080fd5b6106dd611cab565b6040518082815260200191505060405180910390f35b34156106fe57600080fd5b610706611cb1565b6040518082815260200191505060405180910390f35b341561072757600080fd5b61072f611cb7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561077c57600080fd5b610784611cdd565b6040518082815260200191505060405180910390f35b34156107a557600080fd5b6107bb6004808035906020019091905050611ce2565b005b34156107c857600080fd5b6107d0611d59565b6040518082815260200191505060405180910390f35b34156107f157600080fd5b6107f9611d5f565b005b341561080657600080fd5b61080e6124ef565b604051808215151515815260200191505060405180910390f35b341561083357600080fd5b61083b612502565b6040518082815260200191505060405180910390f35b341561085c57600080fd5b610864612508565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156108a4578082015181840152602081019050610889565b50505050905090810190601f1680156108d15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156108ea57600080fd5b6108f26125a6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561093f57600080fd5b61095560048080359060200190919050506125cc565b005b341561096257600080fd5b61096a612641565b005b341561097757600080fd5b61097f612a78565b6040518082815260200191505060405180910390f35b34156109a057600080fd5b6109a8612a7e565b6040518082815260200191505060405180910390f35b34156109c957600080fd5b6109d1612a84565b6040518082815260200191505060405180910390f35b34156109f257600080fd5b6109fa612a8a565b6040518082815260200191505060405180910390f35b3415610a1b57600080fd5b610a23612a96565b6040518082815260200191505060405180910390f35b3415610a4457600080fd5b610a70600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612a9b565b005b3415610a7d57600080fd5b610a85612c45565b6040518082815260200191505060405180910390f35b3415610aa657600080fd5b610ad2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612c4b565b005b3415610adf57600080fd5b610ae7612da3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600080610b34612dc9565b1515610b3f57600080fd5b6706f05b59d3b200008310151515610b5657600080fd5b3073ffffffffffffffffffffffffffffffffffffffff1631610bac6040805190810160405280600381526020017f55524c0000000000000000000000000000000000000000000000000000000000815250612e8c565b11151515610bb957600080fd5b610c956040805190810160405280600381526020017f55524c000000000000000000000000000000000000000000000000000000000081525060128054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c885780601f10610c5d57610100808354040283529160200191610c88565b820191906000526020600020905b815481529060010190602001808311610c6b57829003601f168201915b50505050506013546131ed565b9150600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639427aa96846009546040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182815260200192505050602060405180830381600087803b1515610d3157600080fd5b5af11515610d3e57600080fd5b505050604051805190509050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637f85c599838686856040518563ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018085600019166000191681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001945050505050600060405180830381600087803b1515610e2657600080fd5b5af11515610e3357600080fd5b505050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f193505050501515610e9857600080fd5b610ead83600d5461370990919063ffffffff16565b600d81905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631bbe9d8c856040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1515610f6f57600080fd5b5af11515610f7c57600080fd5b50505081600019168473ffffffffffffffffffffffffffffffffffffffff167fb430fe733d9c16eb0a70818cd5194122aac135650604ff339b3d266a932ed95a856040518082815260200191505060405180910390a350505050565b601160019054906101000a900460ff1681565b600c5481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561104d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561108957600080fd5b6001601660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60155481565b60166020528060005260406000206000915054906101000a900460ff1681565b60008060008060008060008061111e613727565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561115757600080fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f2055778b6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b15156111ef57600080fd5b5af115156111fc57600080fd5b50505060405180519050156113bc57611213613a16565b15156113b757611221611d5f565b611229613a16565b15156113b65761130b6040805190810160405280600381526020017f55524c000000000000000000000000000000000000000000000000000000000081525060128054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112fe5780601f106112d3576101008083540402835291602001916112fe565b820191906000526020600020905b8154815290600101906020018083116112e157829003601f168201915b50505050506014546131ed565b9750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166313f29768896040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050600060405180830381600087803b15156113a557600080fd5b5af115156113b257600080fd5b5050505b5b611873565b6113c7896004613abd565b9650600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635778472a8b6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050606060405180830381600087803b151561146157600080fd5b5af1151561146e57600080fd5b505050604051805190602001805190602001805190508096508197508298505050506114b96004600a0a6114ab8988613db790919063ffffffff16565b613df290919063ffffffff16565b92506114cf600384613df290919063ffffffff16565b91506114f760646114e98685613db790919063ffffffff16565b613df290919063ffffffff16565b905061150c818361370990919063ffffffff16565b9150600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cbf6fff96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561159357600080fd5b5af115156115a057600080fd5b505050604051805190506115bf83600c5461370990919063ffffffff16565b111561167857611675600c54600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cbf6fff96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561165057600080fd5b5af1151561165d57600080fd5b50505060405180519050613e0d90919063ffffffff16565b91505b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634cc225288b896040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180836000191660001916815260200182815260200192505050600060405180830381600087803b151561171857600080fd5b5af1151561172557600080fd5b505050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb87846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156117ec57600080fd5b5af115156117f957600080fd5b505050604051805190505061181982600c5461370990919063ffffffff16565b600c8190555089600019168673ffffffffffffffffffffffffffffffffffffffff167ff1d93d0419db8b3c501881999401171fbfd7657127b99a41abba74c50fe98008846040518082815260200191505060405180910390a35b50505050505050505050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118dd57600080fd5b8190508073ffffffffffffffffffffffffffffffffffffffff1663f2fde38b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b151561199c57600080fd5b5af115156119a957600080fd5b5050505050565b603281565b600a5481565b6000601160019054906101000a900460ff161515156119d957600080fd5b611acc6119f3601554600a5461370990919063ffffffff16565b6040805190810160405280600381526020017f55524c000000000000000000000000000000000000000000000000000000000081525060128054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611abf5780601f10611a9457610100808354040283529160200191611abf565b820191906000526020600020905b815481529060010190602001808311611aa257829003601f168201915b5050505050601454613e26565b9050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166313f29768826040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050600060405180830381600087803b1515611b6657600080fd5b5af11515611b7357600080fd5b5050506001601160016101000a81548160ff02191690831515021790555050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b505050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c1b57600080fd5b803073ffffffffffffffffffffffffffffffffffffffff163110151515611c4157600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515611ca357600080fd5b50565b600a81565b60135481565b600e5481565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611d3e57600080fd5b600081111515611d4d57600080fd5b611d5681614342565b50565b60085481565b6000806000806000806000611d81601554600a5461370990919063ffffffff16565b42111515611d8e57600080fd5b611d96613a16565b151515611da257600080fd5b60006010541415611e6d57611e5d600c54600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cbf6fff96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515611e3857600080fd5b5af11515611e4557600080fd5b50505060405180519050613e0d90919063ffffffff16565b600e81905550600c54600f819055505b600096505b603287108015611e875750611e85613a16565b155b156121eb57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dc0d3dff6010546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1515611f1e57600080fd5b5af11515611f2b57600080fd5b505050604051805190509550600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231876040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1515611ff357600080fd5b5af1151561200057600080fd5b5050506040518051905094506000851415156121b457612040600f54612032600a800a88613db790919063ffffffff16565b613df290919063ffffffff16565b935061206c600a800a61205e86600e54613db790919063ffffffff16565b613df290919063ffffffff16565b9250600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb87856040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561213257600080fd5b5af1151561213f57600080fd5b50505060405180519050508573ffffffffffffffffffffffffffffffffffffffff167f137817e5736d39197c6deb71997e0a1e17d35ba14c2f76c10f286b5112dd2323846040518082815260200191505060405180910390a26121ad83600c5461370990919063ffffffff16565b600c819055505b6121ca600160105461370990919063ffffffff16565b6010819055506121e460018861370990919063ffffffff16565b9650611e72565b6121f3613a16565b156124e657600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cbf6fff96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561227d57600080fd5b5af1151561228a57600080fd5b50505060405180519050600c5410156124e55761234d600c54600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cbf6fff96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561232857600080fd5b5af1151561233557600080fd5b50505060405180519050613e0d90919063ffffffff16565b9150600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630c6a31616040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156123d457600080fd5b5af115156123e157600080fd5b505050604051805190509050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb82846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156124b157600080fd5b5af115156124be57600080fd5b50505060405180519050506124de82600c5461370990919063ffffffff16565b600c819055505b5b50505050505050565b601160009054906101000a900460ff1681565b60105481565b60128054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561259e5780601f106125735761010080835404028352916020019161259e565b820191906000526020600020905b81548152906001019060200180831161258157829003601f168201915b505050505081565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561262857600080fd5b60008111151561263757600080fd5b8060138190555050565b6000806000601160009054906101000a900460ff1615151561266257600080fd5b600092505b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fc22545c6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156126ec57600080fd5b5af115156126f957600080fd5b50505060405180519050831015612a5857600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631e8dd582846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561279a57600080fd5b5af115156127a757600080fd5b505050604051805190509150600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b1da671e836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561286f57600080fd5b5af1151561287c57600080fd5b505050604051805190509050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561294c57600080fd5b5af1151561295957600080fd5b505050604051805190505061297981600c5461370990919063ffffffff16565b600c81905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631bbe9d8c836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1515612a3b57600080fd5b5af11515612a4857600080fd5b5050508280600101935050612667565b6001601160006101000a81548160ff021916908315150217905550505050565b60145481565b60095481565b600f5481565b6706f05b59d3b2000081565b600381565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612af757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515612b3357600080fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e43252d7826040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1515612bef57600080fd5b5af11515612bfc57600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff167f4f66aceae131ebc0b947dc58e399f49a0a1be41cbe2a284121a9d5c570de016060405160405180910390a250565b600d5481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612ca757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515612ce357600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006008544210158015612ddf5750600a544211155b8015612e875750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cbf6fff96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515612e6b57600080fd5b5af11515612e7857600080fd5b50505060405180519050600c54105b905090565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480612efc57506000612efa6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614632565b145b15612f0d57612f0b600061463d565b505b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515612f9157600080fd5b5af11515612f9e57600080fd5b5050506040518051905073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156130da576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561308257600080fd5b5af1151561308f57600080fd5b50505060405180519050600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663524f3889836040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613184578082015181840152602081019050613169565b50505050905090810190601f1680156131b15780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b15156131cf57600080fd5b5af115156131dc57600080fd5b505050604051805190509050919050565b60008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148061325f5750600061325d6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614632565b145b156132705761326e600061463d565b505b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156132f457600080fd5b5af1151561330157600080fd5b5050506040518051905073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561343d576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156133e557600080fd5b5af115156133f257600080fd5b50505060405180519050600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632ef3accc86856040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b838110156134ee5780820151818401526020810190506134d3565b50505050905090810190601f16801561351b5780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b151561353a57600080fd5b5af1151561354757600080fd5b505050604051805190509050823a02670de0b6b3a7640000018111156135735760006001029150613701565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c51be90f8260008888886040518663ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015613632578082015181840152602081019050613617565b50505050905090810190601f16801561365f5780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561369857808201518184015260208101905061367d565b50505050905090810190601f1680156136c55780820380516001836020036101000a031916815260200191505b5096505050505050506020604051808303818588803b15156136e657600080fd5b5af115156136f357600080fd5b505050506040518051905091505b509392505050565b600080828401905083811015151561371d57fe5b8091505092915050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480613797575060006137956000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614632565b145b156137a8576137a6600061463d565b505b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561382c57600080fd5b5af1151561383957600080fd5b5050506040518051905073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515613975576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561391d57600080fd5b5af1151561392a57600080fd5b50505060405180519050600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c281d19e6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156139fa57600080fd5b5af11515613a0757600080fd5b50505060405180519050905090565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663920b3a7e6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515613a9d57600080fd5b5af11515613aaa57600080fd5b5050506040518051905060105414905090565b6000613ac7614af7565b60008060008693506000925060009150600090505b8351811015613d985760307f0100000000000000000000000000000000000000000000000000000000000000028482815181101515613b1757fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191610158015613c2f575060397f0100000000000000000000000000000000000000000000000000000000000000028482815181101515613bbf57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191611155b15613ce0578115613c52576000861415613c4857613d98565b8580600190039650505b600a8302925060308482815181101515613c6857fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027f010000000000000000000000000000000000000000000000000000000000000090040383019250613d8b565b602e7f0100000000000000000000000000000000000000000000000000000000000000028482815181101515613d1257fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415613d8a57600191505b5b8080600101915050613adc565b6000861115613daa5785600a0a830292505b8294505050505092915050565b6000806000841415613dcc5760009150613deb565b8284029050828482811515613ddd57fe5b04141515613de757fe5b8091505b5092915050565b6000808284811515613e0057fe5b0490508091505092915050565b6000828211151515613e1b57fe5b818303905092915050565b60008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480613e9857506000613e966000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614632565b145b15613ea957613ea7600061463d565b505b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515613f2d57600080fd5b5af11515613f3a57600080fd5b5050506040518051905073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515614076576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561401e57600080fd5b5af1151561402b57600080fd5b50505060405180519050600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632ef3accc86856040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b8381101561412757808201518184015260208101905061410c565b50505050905090810190601f1680156141545780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b151561417357600080fd5b5af1151561418057600080fd5b505050604051805190509050823a02670de0b6b3a7640000018111156141ac5760006001029150614339565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c51be90f82888888886040518663ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561426a57808201518184015260208101905061424f565b50505050905090810190601f1680156142975780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156142d05780820151818401526020810190506142b5565b50505050905090810190601f1680156142fd5780820380516001836020036101000a031916815260200191505b5096505050505050506020604051808303818588803b151561431e57600080fd5b5af1151561432b57600080fd5b505050506040518051905091505b50949350505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806143b1575060006143af6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614632565b145b156143c2576143c0600061463d565b505b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561444657600080fd5b5af1151561445357600080fd5b5050506040518051905073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561458f576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561453757600080fd5b5af1151561454457600080fd5b50505060405180519050600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ca6ad1e4826040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561461f57600080fd5b5af1151561462c57600080fd5b50505050565b6000813b9050919050565b600061464761464e565b9050919050565b60008061466e731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed614632565b111561470f57731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed6000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506147066040805190810160405280600b81526020017f6574685f6d61696e6e6574000000000000000000000000000000000000000000815250614add565b60019050614ada565b600061472e73c03a2615d5efaf5f49f60b7bb6583eaec212fdf1614632565b11156147cf5773c03a2615d5efaf5f49f60b7bb6583eaec212fdf16000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506147c66040805190810160405280600c81526020017f6574685f726f707374656e330000000000000000000000000000000000000000815250614add565b60019050614ada565b60006147ee73b7a07bcf2ba2f2703b24c0691b5278999c59ac7e614632565b111561488f5773b7a07bcf2ba2f2703b24c0691b5278999c59ac7e6000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506148866040805190810160405280600981526020017f6574685f6b6f76616e0000000000000000000000000000000000000000000000815250614add565b60019050614ada565b60006148ae73146500cfd35b22e4a392fe0adc06de1a1368ed48614632565b111561494f5773146500cfd35b22e4a392fe0adc06de1a1368ed486000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506149466040805190810160405280600b81526020017f6574685f72696e6b656279000000000000000000000000000000000000000000815250614add565b60019050614ada565b600061496e736f485c8bf6fc43ea212e93bbf8ce046c7f1cb475614632565b11156149d157736f485c8bf6fc43ea212e93bbf8ce046c7f1cb4756000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050614ada565b60006149f07320e12a1f859b3feae5fb2a0a32c18f5a65555bbf614632565b1115614a53577320e12a1f859b3feae5fb2a0a32c18f5a65555bbf6000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050614ada565b6000614a727351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa614632565b1115614ad5577351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa6000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050614ada565b600090505b90565b8060029080519060200190614af3929190614b0b565b5050565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10614b4c57805160ff1916838001178555614b7a565b82800160010185558215614b7a579182015b82811115614b79578251825591602001919060010190614b5e565b5b509050614b879190614b8b565b5090565b614bad91905b80821115614ba9576000816000905550600101614b91565b5090565b905600a165627a7a7230582011a1c79e2970e354270151fbc0cb6df882b4a8c58dcf64d0dbd943be45b0044a0029000000000000000000000000000000000000000000000000000000005ac09f90000000000000000000000000000000000000000000000000000000005ac9da10000000000000000000000000000000000000000000000000000000005ad31490000000000000000000000000268343557a5a08cecac22930c00fe37c06e1d027000000000000000000000000bd270f9a96ed49a1c82055a22ad9b8eec564097f000000000000000000000000c82c2b419b1042fbb14da117c3973788a4dfb7ab

    Constructor Arguments (ABI-encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000005ac09f90000000000000000000000000000000000000000000000000000000005ac9da10000000000000000000000000000000000000000000000000000000005ad31490000000000000000000000000268343557a5a08cecac22930c00fe37c06e1d027000000000000000000000000bd270f9a96ed49a1c82055a22ad9b8eec564097f000000000000000000000000c82c2b419b1042fbb14da117c3973788a4dfb7ab

-----Decoded View---------------
Found 6 constructor arguments :
Arg [0] : 000000000000000000000000000000000000000000000000000000005ac09f90
Arg [1] : 000000000000000000000000000000000000000000000000000000005ac9da10
Arg [2] : 000000000000000000000000000000000000000000000000000000005ad31490
Arg [3] : 000000000000000000000000268343557a5a08cecac22930c00fe37c06e1d027
Arg [4] : 000000000000000000000000bd270f9a96ed49a1c82055a22ad9b8eec564097f
Arg [5] : 000000000000000000000000c82c2b419b1042fbb14da117c3973788a4dfb7ab


   Swarm Source:
bzzr://11a1c79e2970e354270151fbc0cb6df882b4a8c58dcf64d0dbd943be45b0044a

 

View All
Block Age txn Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "downvote" button for any spammy posts, and the "upvote" for interesting conversations.