Contract Overview
Balance: 0.61 Ether
Transactions: 55 txns
 Latest 25 transactions from a total of 55 transactions

TxHash Age From To Value [TxFee]
0xf4244e8b2a977a0e2fb4693265bfa19197d484332f6647a6d74a51a1e4bf9eb531 days 3 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0002674497
0x4cbaa1c3dd8c0a9f9496c62c47a1c5f32ab9ff2e4c777645445d03e626de195831 days 3 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.000142989
0xe5db4eb2135ed89c8eaeb10576a79b0d00982b5cfc0811bb667389ed06b709d831 days 3 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0001115625
0xb0346310ed11df154b8bb1cf5257d428e0a6d7a1783330a7fa782de89331fe2531 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.000065125
0x29506704ef45a5d5f7e710726ce58f3016b71410cc5d1d73d874f75860e71f4031 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0001661225
0xcc1b970ef350ad97affe9e8c57e7160fcb31344bf0e3b524720dc4ee6f7e8dda31 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.000174585
0x2faac01d2bceda8d482087145f0450cecfa346d5649f466f7e391da5b709837e31 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0001270017
0x220fc40611608ed6707567aff61aa0fedb97889a22a5b67139acc32d66b3c5bb31 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0001194375
0xe1062ce3b8f96a43d2d26cce7033400286477f47f6557c4b9f4fb8383a2251ac31 days 4 hrs ago0x353f3bf550ed5cffd6015abdfb18cc2a67c5c18d  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00.015 Ether0.002093316
0xdb6f654cf55afb0a77c54c8eeef5d99150c8154f624be4d1fe9548a4a85c47d531 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0001508304
0x84f1af5b8ee47ab54ffeacbc5c770cfc6442faba9faeed99a2c1b23cdefd698e31 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.000118944
0xf472d911e21636e2a6f2653eebbc72a084a86f3c529200a5aa4c566d6c8eed1531 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0002386008
0x56d84dc190bd662d4b716e941c44dd19ccb20ffddd389b6e7df455f8b80fae0231 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0001755592
0x27b515e467764d1ed58bae70a45508ca4fdcf14266efb4d654b2301a526141cb31 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0002793255
0x83ca68921f396fa1b0fefbbd40ab426251a50988ec8e9a942c69f47cfeac425931 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0002215663
0xe9d1825f03e5965345ada6f67b234a5d2efc6610f86b1db8d65448147bdec4d231 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0002032143
0xbd8e371d469aba76e6d3cbae96b990e80892fcc273f01f25e31bba803d55e89731 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.000217776
0xc40dff874b159eb41c8b7b7425b4439f78256a48306b95da1ec931a4a2fafa3e31 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0002097952
0x6a56ed181b4c03ccd72c6f53f778d3ac734b7205cf0b72c4b79a47cf58d742ec31 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0002930393
0x4bafda1cf124618c432383e3e823882bad0457c0c3f5de5fc047c786efbcd08b31 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0002688001
0xe25cc66b5930596c654dee6bae56bc55eed0e56ce976135b7d43b78effbeb0d931 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0004040928
0x9bf2fa578c2388d5793a60c89b0391302c70f5989546f17702b628c09cf08fc331 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0003972132
0xdd0a0edd0cb1ff70dc8be691fb63bd9b6c2d5fc196f592f26cd4ffd3ef9c520e31 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0003336336
0x365157b93f34a79873e1fa8c13ea801201acb6af2767b54182410d8568a98e6b31 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0003662616
0x9112c6c6cbd678909ada8c91fec9e8581a9a17ac05c1c569191a579a076f6ff031 days 4 hrs ago0x2831de120827570cf8c7cfcb9b788c222e307de4  IN   0x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether0.0003343203
[ 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
0xf4244e8b2a977a0e2fb4693265bfa19197d484332f6647a6d74a51a1e4bf9eb5483921631 days 3 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00xcea356a0dd37d65945b279e6afa3e40994fe76cb0 Ether
0xf4244e8b2a977a0e2fb4693265bfa19197d484332f6647a6d74a51a1e4bf9eb5483921631 days 3 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00xcea356a0dd37d65945b279e6afa3e40994fe76cb0 Ether
0x4cbaa1c3dd8c0a9f9496c62c47a1c5f32ab9ff2e4c777645445d03e626de1958483921231 days 3 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00xd22d680d1fa045a07e8d335c1bb815ebfc4d4e5e0 Ether
0x4cbaa1c3dd8c0a9f9496c62c47a1c5f32ab9ff2e4c777645445d03e626de1958483921231 days 3 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00x822afedd7d48ed1056247747c8ed6df7f02b50fc0 Ether
0x4cbaa1c3dd8c0a9f9496c62c47a1c5f32ab9ff2e4c777645445d03e626de1958483921231 days 3 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00xd22d680d1fa045a07e8d335c1bb815ebfc4d4e5e0 Ether
0x4cbaa1c3dd8c0a9f9496c62c47a1c5f32ab9ff2e4c777645445d03e626de1958483921231 days 3 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00x822afedd7d48ed1056247747c8ed6df7f02b50fc0 Ether
0x4cbaa1c3dd8c0a9f9496c62c47a1c5f32ab9ff2e4c777645445d03e626de1958483921231 days 3 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00x7605e92eb5826eb3ce4358c3118fb33362ec0b620 Ether
0x4cbaa1c3dd8c0a9f9496c62c47a1c5f32ab9ff2e4c777645445d03e626de1958483921231 days 3 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00xcea356a0dd37d65945b279e6afa3e40994fe76cb0 Ether
0x4cbaa1c3dd8c0a9f9496c62c47a1c5f32ab9ff2e4c777645445d03e626de1958483921231 days 3 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00xcea356a0dd37d65945b279e6afa3e40994fe76cb0 Ether
0xe5db4eb2135ed89c8eaeb10576a79b0d00982b5cfc0811bb667389ed06b709d8483921131 days 3 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00xd22d680d1fa045a07e8d335c1bb815ebfc4d4e5e0 Ether
0xe5db4eb2135ed89c8eaeb10576a79b0d00982b5cfc0811bb667389ed06b709d8483921131 days 3 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00x822afedd7d48ed1056247747c8ed6df7f02b50fc0 Ether
0xe5db4eb2135ed89c8eaeb10576a79b0d00982b5cfc0811bb667389ed06b709d8483921131 days 3 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00xd22d680d1fa045a07e8d335c1bb815ebfc4d4e5e0 Ether
0xe5db4eb2135ed89c8eaeb10576a79b0d00982b5cfc0811bb667389ed06b709d8483921131 days 3 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00x822afedd7d48ed1056247747c8ed6df7f02b50fc0 Ether
0xe5db4eb2135ed89c8eaeb10576a79b0d00982b5cfc0811bb667389ed06b709d8483921131 days 3 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00x7605e92eb5826eb3ce4358c3118fb33362ec0b620 Ether
0xe5db4eb2135ed89c8eaeb10576a79b0d00982b5cfc0811bb667389ed06b709d8483921131 days 3 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00xcea356a0dd37d65945b279e6afa3e40994fe76cb0 Ether
0xe5db4eb2135ed89c8eaeb10576a79b0d00982b5cfc0811bb667389ed06b709d8483921131 days 3 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00xcea356a0dd37d65945b279e6afa3e40994fe76cb0 Ether
0x9777ad2a41859c55af4213b8df5b27a757156fd21393d87847115d4b8521c742483921031 days 3 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00x8a01bc6a9358388588247127ff7be21b281b36d40 Ether
0x9777ad2a41859c55af4213b8df5b27a757156fd21393d87847115d4b8521c742483921031 days 3 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00xcea356a0dd37d65945b279e6afa3e40994fe76cb0 Ether
0x9777ad2a41859c55af4213b8df5b27a757156fd21393d87847115d4b8521c742483921031 days 3 hrs ago0x8a01bc6a9358388588247127ff7be21b281b36d40x141632d913af9bf799ca1ae25b4f04560d272fe00 Ether
0xb0346310ed11df154b8bb1cf5257d428e0a6d7a1783330a7fa782de89331fe25483920631 days 4 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00xcea356a0dd37d65945b279e6afa3e40994fe76cb0 Ether
0x29506704ef45a5d5f7e710726ce58f3016b71410cc5d1d73d874f75860e71f40483920331 days 4 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00xd22d680d1fa045a07e8d335c1bb815ebfc4d4e5e0 Ether
0x29506704ef45a5d5f7e710726ce58f3016b71410cc5d1d73d874f75860e71f40483920331 days 4 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00x822afedd7d48ed1056247747c8ed6df7f02b50fc0 Ether
0x29506704ef45a5d5f7e710726ce58f3016b71410cc5d1d73d874f75860e71f40483920331 days 4 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00xd22d680d1fa045a07e8d335c1bb815ebfc4d4e5e0 Ether
0x29506704ef45a5d5f7e710726ce58f3016b71410cc5d1d73d874f75860e71f40483920331 days 4 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00x822afedd7d48ed1056247747c8ed6df7f02b50fc0 Ether
0x29506704ef45a5d5f7e710726ce58f3016b71410cc5d1d73d874f75860e71f40483920331 days 4 hrs ago0x141632d913af9bf799ca1ae25b4f04560d272fe00x7605e92eb5826eb3ce4358c3118fb33362ec0b620 Ether
[ Download CSV Export  ] 
Warning: The Compiled Contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) SolidityCompiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: DragonKing
Compiler Version: v0.4.24+commit.e67f0147
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

/**
 * Note for the truffle testversion:
 * DragonKingTest inherits from DragonKing and adds one more function for testing the volcano from truffle.
 * For deployment on ropsten or mainnet, just deploy the DragonKing contract and remove this comment before verifying on
 * etherscan.
 * */

 /**
  * Dragonking is a blockchain game in which players may purchase dragons and knights of different levels and values.
  * Once every period of time the volcano erupts and wipes a few of them from the board. The value of the killed characters
  * gets distributed amongst all of the survivors. The dragon king receive a bigger share than the others.
  * In contrast to dragons, knights need to be teleported to the battlefield first with the use of teleport tokens.
  * Additionally, they may attack a dragon once per period.
  * Both character types can be protected from death up to three times.
  * Take a look at dragonking.io for more detailed information.
  * @author: Julia Altenried, Yuriy Kashnikov
  * */

pragma solidity ^0.4.24;


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

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 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 OwnershipRenounced(address indexed previousOwner);
  event OwnershipTransferred(
    address indexed previousOwner,
    address indexed newOwner
  );


  /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.
   */
  constructor() 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 relinquish control of the contract.
   * @notice Renouncing to ownership will leave the contract without an owner.
   * It will not be possible to call the functions with the `onlyOwner`
   * modifier anymore.
   */
  function renounceOwnership() public onlyOwner {
    emit OwnershipRenounced(owner);
    owner = address(0);
  }

  /**
   * @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 {
    _transferOwnership(_newOwner);
  }

  /**
   * @dev Transfers control of the contract to a newOwner.
   * @param _newOwner The address to transfer ownership to.
   */
  function _transferOwnership(address _newOwner) internal {
    require(_newOwner != address(0));
    emit OwnershipTransferred(owner, _newOwner);
    owner = _newOwner;
  }
}

/**
 * @title Destructible
 * @dev Base contract that can be destroyed by owner. All funds in contract will be sent to the owner.
 */
contract Destructible is Ownable {
  /**
   * @dev Transfers the current balance to the owner and terminates the contract.
   */
  function destroy() public onlyOwner {
    selfdestruct(owner);
  }

  function destroyAndSend(address _recipient) public onlyOwner {
    selfdestruct(_recipient);
  }
}

contract DragonKingConfig is Ownable {

  struct PurchaseRequirement {
    address[] tokens;
    uint256[] amounts;
  }

  /**
   * creates Configuration for the DragonKing game
   * tokens array should be in the following order:
      0    1    2    3     4    5    6    7     8
     [tpt, ndc, skl, xper, mag, stg, dex, luck, gift]
  */
  constructor(uint8 characterFee, uint8 eruptionThresholdInHours, uint8 percentageOfCharactersToKill, uint128[] charactersCosts, address[] tokens) public {
    fee = characterFee;
    for (uint8 i = 0; i < charactersCosts.length; i++) {
      costs.push(uint128(charactersCosts[i]) * 1 finney);
      values.push(costs[i] - costs[i] / 100 * fee);
    }
    eruptionThreshold = uint256(eruptionThresholdInHours) * 60 * 60; // convert to seconds
    castleLootDistributionThreshold = 1 days; // once per day
    percentageToKill = percentageOfCharactersToKill;
    maxCharacters = 600;
    teleportPrice = 1000000000000000000;
    protectionPrice = 1000000000000000000;
    luckThreshold = 4200;
    fightFactor = 4;
    giftTokenAmount = 1000000000000000000;
    giftToken = ERC20(tokens[8]);
    // purchase requirements
    // knights
    purchaseRequirements[7].tokens = [tokens[5]]; // 5 STG
    purchaseRequirements[7].amounts = [250];
    purchaseRequirements[8].tokens = [tokens[5]]; // 5 STG
    purchaseRequirements[8].amounts = [5*(10**2)];
    purchaseRequirements[9].tokens = [tokens[5]]; // 10 STG
    purchaseRequirements[9].amounts = [10*(10**2)];
    purchaseRequirements[10].tokens = [tokens[5]]; // 20 STG
    purchaseRequirements[10].amounts = [20*(10**2)];
    purchaseRequirements[11].tokens = [tokens[5]]; // 50 STG
    purchaseRequirements[11].amounts = [50*(10**2)];
    // wizards
    purchaseRequirements[15].tokens = [tokens[2], tokens[3]]; // 5 SKL % 10 XPER
    purchaseRequirements[15].amounts = [25*(10**17), 5*(10**2)];
    purchaseRequirements[16].tokens = [tokens[2], tokens[3], tokens[4]]; // 5 SKL & 10 XPER & 2.5 MAG
    purchaseRequirements[16].amounts = [5*(10**18), 10*(10**2), 250];
    purchaseRequirements[17].tokens = [tokens[2], tokens[3], tokens[4]]; // 10 SKL & 20 XPER & 5 MAG
    purchaseRequirements[17].amounts = [10*(10**18), 20*(10**2), 5*(10**2)];
    purchaseRequirements[18].tokens = [tokens[2], tokens[3], tokens[4]]; // 25 SKL & 50 XP & 10 MAG
    purchaseRequirements[18].amounts = [25*(10**18), 50*(10**2), 10*(10**2)];
    purchaseRequirements[19].tokens = [tokens[2], tokens[3], tokens[4]]; // 50 SKL & 100 XP & 20 MAG
    purchaseRequirements[19].amounts = [50*(10**18), 100*(10**2), 20*(10**2)]; 
    purchaseRequirements[20].tokens = [tokens[2], tokens[3], tokens[4]]; // 100 SKL & 200 XP & 50 MAG 
    purchaseRequirements[20].amounts = [100*(10**18), 200*(10**2), 50*(10**2)];
    // archers
    purchaseRequirements[21].tokens = [tokens[2], tokens[3]]; // 2.5 SKL & 5 XPER
    purchaseRequirements[21].amounts = [25*(10**17), 5*(10**2)];
    purchaseRequirements[22].tokens = [tokens[2], tokens[3], tokens[6]]; // 5 SKL & 10 XPER & 2.5 DEX
    purchaseRequirements[22].amounts = [5*(10**18), 10*(10**2), 250];
    purchaseRequirements[23].tokens = [tokens[2], tokens[3], tokens[6]]; // 10 SKL & 20 XPER & 5 DEX
    purchaseRequirements[23].amounts = [10*(10**18), 20*(10**2), 5*(10**2)];
    purchaseRequirements[24].tokens = [tokens[2], tokens[3], tokens[6]]; // 25 SKL & 50 XP & 10 DEX
    purchaseRequirements[24].amounts = [25*(10**18), 50*(10**2), 10*(10**2)];
    purchaseRequirements[25].tokens = [tokens[2], tokens[3], tokens[6]]; // 50 SKL & 100 XP & 20 DEX
    purchaseRequirements[25].amounts = [50*(10**18), 100*(10**2), 20*(10**2)]; 
    purchaseRequirements[26].tokens = [tokens[2], tokens[3], tokens[6]]; // 100 SKL & 200 XP & 50 DEX 
    purchaseRequirements[26].amounts = [100*(10**18), 200*(10**2), 50*(10**2)];
  }

  /** the Gift token contract **/
  ERC20 public giftToken;
  /** amount of gift tokens to send **/
  uint256 public giftTokenAmount;
  /** purchase requirements for each type of character **/
  PurchaseRequirement[30] purchaseRequirements; 
  /** the cost of each character type */
  uint128[] public costs;
  /** the value of each character type (cost - fee), so it's not necessary to compute it each time*/
  uint128[] public values;
  /** the fee to be paid each time an character is bought in percent*/
  uint8 fee;
  /** The maximum of characters allowed in the game */
  uint16 public maxCharacters;
  /** the amount of time that should pass since last eruption **/
  uint256 public eruptionThreshold;
  /** the amount of time that should pass ince last castle loot distribution **/
  uint256 public castleLootDistributionThreshold;
  /** how many characters to kill in %, e.g. 20 will stand for 20%, should be < 100 **/
  uint8 public percentageToKill;
  /* Cooldown threshold */
  uint256 public constant CooldownThreshold = 1 days;
  /** fight factor, used to compute extra probability in fight **/
  uint8 public fightFactor;

  /** the price for teleportation*/
  uint256 public teleportPrice;
  /** the price for protection */
  uint256 public protectionPrice;
  /** the luck threshold */
  uint256 public luckThreshold;

  function hasEnoughTokensToPurchase(address buyer, uint8 characterType) external returns (bool canBuy) {
    for (uint256 i = 0; i < purchaseRequirements[characterType].tokens.length; i++) {
      if (ERC20(purchaseRequirements[characterType].tokens[i]).balanceOf(buyer) < purchaseRequirements[characterType].amounts[i]) {
        return false;
      }
    }
    return true;
  }


  function setPurchaseRequirements(uint8 characterType, address[] tokens, uint256[] amounts) external {
    purchaseRequirements[characterType].tokens = tokens;
    purchaseRequirements[characterType].amounts = amounts;
  } 

  function getPurchaseRequirements(uint8 characterType) view external returns (address[] tokens, uint256[] amounts) {
    tokens = purchaseRequirements[characterType].tokens;
    amounts = purchaseRequirements[characterType].amounts;
  }

  /**
   * sets the prices of the character types
   * @param prices the prices in finney
   * */
  function setPrices(uint16[] prices) external onlyOwner {
    for (uint8 i = 0; i < prices.length; i++) {
      costs[i] = uint128(prices[i]) * 1 finney;
      values[i] = costs[i] - costs[i] / 100 * fee;
    }
  }

  /**
   * sets the eruption threshold
   * @param _value the threshold in seconds, e.g. 24 hours = 25*60*60
   * */
  function setEruptionThreshold(uint256 _value) external onlyOwner {
    eruptionThreshold = _value;
  }

  /**
   * sets the castle loot distribution threshold
   * @param _value the threshold in seconds, e.g. 24 hours = 25*60*60
   * */
  function setCastleLootDistributionThreshold(uint256 _value) external onlyOwner {
    castleLootDistributionThreshold = _value;
  }

  /**
   * sets the fee
   * @param _value for the fee, e.g. 3% = 3
   * */
  function setFee(uint8 _value) external onlyOwner {
    fee = _value;
  }

  /**
   * sets the percentage of characters to kill on eruption
   * @param _value the percentage, e.g. 10% = 10
   * */
  function setPercentageToKill(uint8 _value) external onlyOwner {
    percentageToKill = _value;
  }

  /**
   * sets the maximum amount of characters allowed to be present in the game
   * @param _value characters limit, e.g 600
   * */
  function setMaxCharacters(uint16 _value) external onlyOwner {
    maxCharacters = _value;
  }

  /**
   * sets the fight factor
   * @param _value fight factor, e.g 4
   * */
  function setFightFactor(uint8 _value) external onlyOwner {
    fightFactor = _value;
  }

  /**
   * sets the teleport price
   * @param _value base amount of TPT to transfer on teleport, e.g 10e18
   * */
  function setTeleportPrice(uint256 _value) external onlyOwner {
    teleportPrice = _value;
  }

  /**
   * sets the protection price
   * @param _value base amount of NDC to transfer on protection, e.g 10e18
   * */
  function setProtectionPrice(uint256 _value) external onlyOwner {
    protectionPrice = _value;
  }

  /**
   * sets the luck threshold
   * @param _value the minimum amount of luck tokens required for the second roll
   * */
  function setLuckThreshold(uint256 _value) external onlyOwner {
    luckThreshold = _value;
  }

  /**
   * sets the amount of tokens to gift threshold
   * @param _value new value of the amount to gift
   * */
  function setGiftTokenAmount(uint256 _value) {
    giftTokenAmount = _value;
  }

  /**
   * sets the gift token address
   * @param _value new gift token address
   * */
  function setGiftToken(address _value) {
    giftToken = ERC20(_value);
  }
}

contract DragonKing is Destructible {

  /**
   * @dev Throws if called by contract not a user 
   */
  modifier onlyUser() {
    require(msg.sender == tx.origin, 
            "contracts cannot execute this method"
           );
    _;
  }


  struct Character {
    uint8 characterType;
    uint128 value;
    address owner;
    uint64 purchaseTimestamp;
    uint8 fightCount;
  }

  DragonKingConfig public config;

  /** the neverdie token contract used to purchase protection from eruptions and fights */
  ERC20 neverdieToken;
  /** the teleport token contract used to send knights to the game scene */
  ERC20 teleportToken;
  /** the luck token contract **/
  ERC20 luckToken;
  /** the SKL token contract **/
  ERC20 sklToken;
  /** the XP token contract **/
  ERC20 xperToken;
  

  /** array holding ids of the curret characters **/
  uint32[] public ids;
  /** the id to be given to the next character **/
  uint32 public nextId;
  /** non-existant character **/
  uint16 public constant INVALID_CHARACTER_INDEX = ~uint16(0);

  /** the castle treasury **/
  uint128 public castleTreasury;
  /** the castle loot distribution factor **/
  uint8 public luckRounds = 2;
  /** the id of the oldest character **/
  uint32 public oldest;
  /** the character belonging to a given id **/
  mapping(uint32 => Character) characters;
  /** teleported knights **/
  mapping(uint32 => bool) teleported;

  /** constant used to signal that there is no King at the moment **/
  uint32 constant public noKing = ~uint32(0);

  /** total number of characters in the game **/
  uint16 public numCharacters;
  /** number of characters per type **/
  mapping(uint8 => uint16) public numCharactersXType;

  /** timestamp of the last eruption event **/
  uint256 public lastEruptionTimestamp;
  /** timestamp of the last castle loot distribution **/
  mapping(uint32 => uint256) public lastCastleLootDistributionTimestamp;

  /** character type range constants **/
  uint8 public constant DRAGON_MIN_TYPE = 0;
  uint8 public constant DRAGON_MAX_TYPE = 5;

  uint8 public constant KNIGHT_MIN_TYPE = 6;
  uint8 public constant KNIGHT_MAX_TYPE = 11;

  uint8 public constant BALLOON_MIN_TYPE = 12;
  uint8 public constant BALLOON_MAX_TYPE = 14;

  uint8 public constant WIZARD_MIN_TYPE = 15;
  uint8 public constant WIZARD_MAX_TYPE = 20;

  uint8 public constant ARCHER_MIN_TYPE = 21;
  uint8 public constant ARCHER_MAX_TYPE = 26;

  uint8 public constant NUMBER_OF_LEVELS = 6;

  uint8 public constant INVALID_CHARACTER_TYPE = 27;

    /** knight cooldown. contains the timestamp of the earliest possible moment to start a fight */
  mapping(uint32 => uint) public cooldown;

    /** tells the number of times a character is protected */
  mapping(uint32 => uint8) public protection;

  // EVENTS

  /** is fired when new characters are purchased (who bought how many characters of which type?) */
  event NewPurchase(address player, uint8 characterType, uint16 amount, uint32 startId);
  /** is fired when a player leaves the game */
  event NewExit(address player, uint256 totalBalance, uint32[] removedCharacters);
  /** is fired when an eruption occurs */
  event NewEruption(uint32[] hitCharacters, uint128 value, uint128 gasCost);
  /** is fired when a single character is sold **/
  event NewSell(uint32 characterId, address player, uint256 value);
  /** is fired when a knight fights a dragon **/
  event NewFight(uint32 winnerID, uint32 loserID, uint256 value, uint16 probability, uint16 dice);
  /** is fired when a knight is teleported to the field **/
  event NewTeleport(uint32 characterId);
  /** is fired when a protection is purchased **/
  event NewProtection(uint32 characterId, uint8 lifes);
  /** is fired when a castle loot distribution occurs**/
  event NewDistributionCastleLoot(uint128 castleLoot, uint32 characterId, uint128 luckFactor);

  /* initializes the contract parameter */
  constructor(address tptAddress, address ndcAddress, address sklAddress, address xperAddress, address luckAddress, address _configAddress) public {
    nextId = 1;
    teleportToken = ERC20(tptAddress);
    neverdieToken = ERC20(ndcAddress);
    sklToken = ERC20(sklAddress);
    xperToken = ERC20(xperAddress);
    luckToken = ERC20(luckAddress);
    config = DragonKingConfig(_configAddress);
  }

  /** 
    * gifts one character
    * @param receiver gift character owner
    * @param characterType type of the character to create as a gift
    */
  function giftCharacter(address receiver, uint8 characterType) payable public onlyUser {
    _addCharacters(receiver, characterType);
    assert(config.giftToken().transfer(receiver, config.giftTokenAmount()));
  }

  /**
   * buys as many characters as possible with the transfered value of the given type
   * @param characterType the type of the character
   */
  function addCharacters(uint8 characterType) payable public onlyUser {
    _addCharacters(msg.sender, characterType);
  }

  function _addCharacters(address receiver, uint8 characterType) internal {
    uint16 amount = uint16(msg.value / config.costs(characterType));
    require(
      amount > 0,
      "insufficient amount of ether to purchase a given type of character");
    uint16 nchars = numCharacters;
    require(
      config.hasEnoughTokensToPurchase(receiver, characterType),
      "insufficinet amount of tokens to purchase a given type of character"
    );
    if (characterType >= INVALID_CHARACTER_TYPE || msg.value < config.costs(characterType) || nchars + amount > config.maxCharacters()) revert();
    uint32 nid = nextId;
    //if type exists, enough ether was transferred and there are less than maxCharacters characters in the game
    if (characterType <= DRAGON_MAX_TYPE) {
      //dragons enter the game directly
      if (oldest == 0 || oldest == noKing)
        oldest = nid;
      for (uint8 i = 0; i < amount; i++) {
        addCharacter(nid + i, nchars + i);
        characters[nid + i] = Character(characterType, config.values(characterType), receiver, uint64(now), 0);
      }
      numCharactersXType[characterType] += amount;
      numCharacters += amount;
    }
    else {
      // to enter game knights, mages, and archers should be teleported later
      for (uint8 j = 0; j < amount; j++) {
        characters[nid + j] = Character(characterType, config.values(characterType), receiver, uint64(now), 0);
      }
    }
    nextId = nid + amount;
    emit NewPurchase(receiver, characterType, amount, nid);
  }



  /**
   * adds a single dragon of the given type to the ids array, which is used to iterate over all characters
   * @param nId the id the character is about to receive
   * @param nchars the number of characters currently in the game
   */
  function addCharacter(uint32 nId, uint16 nchars) internal {
    if (nchars < ids.length)
      ids[nchars] = nId;
    else
      ids.push(nId);
  }

  /**
   * leave the game.
   * pays out the sender's balance and removes him and his characters from the game
   * */
  function exit() public {
    uint32[] memory removed = new uint32[](50);
    uint8 count;
    uint32 lastId;
    uint playerBalance;
    uint16 nchars = numCharacters;
    for (uint16 i = 0; i < nchars; i++) {
      if (characters[ids[i]].owner == msg.sender 
          && characters[ids[i]].purchaseTimestamp + 1 days < now
          && (characters[ids[i]].characterType < BALLOON_MIN_TYPE || characters[ids[i]].characterType > BALLOON_MAX_TYPE)) {
        //first delete all characters at the end of the array
        while (nchars > 0 
            && characters[ids[nchars - 1]].owner == msg.sender 
            && characters[ids[nchars - 1]].purchaseTimestamp + 1 days < now
            && (characters[ids[i]].characterType < BALLOON_MIN_TYPE || characters[ids[i]].characterType > BALLOON_MAX_TYPE)) {
          nchars--;
          lastId = ids[nchars];
          numCharactersXType[characters[lastId].characterType]--;
          playerBalance += characters[lastId].value;
          removed[count] = lastId;
          count++;
          if (lastId == oldest) oldest = 0;
          delete characters[lastId];
        }
        //replace the players character by the last one
        if (nchars > i + 1) {
          playerBalance += characters[ids[i]].value;
          removed[count] = ids[i];
          count++;
          nchars--;
          replaceCharacter(i, nchars);
        }
      }
    }
    numCharacters = nchars;
    emit NewExit(msg.sender, playerBalance, removed); //fire the event to notify the client
    msg.sender.transfer(playerBalance);
    if (oldest == 0)
      findOldest();
  }

  /**
   * Replaces the character with the given id with the last character in the array
   * @param index the index of the character in the id array
   * @param nchars the number of characters
   * */
  function replaceCharacter(uint16 index, uint16 nchars) internal {
    uint32 characterId = ids[index];
    numCharactersXType[characters[characterId].characterType]--;
    if (characterId == oldest) oldest = 0;
    delete characters[characterId];
    ids[index] = ids[nchars];
    delete ids[nchars];
  }

  /**
   * The volcano eruption can be triggered by anybody but only if enough time has passed since the last eription.
   * The volcano hits up to a certain percentage of characters, but at least one.
   * The percantage is specified in 'percentageToKill'
   * */

  function triggerVolcanoEruption() public onlyUser {
    require(now >= lastEruptionTimestamp + config.eruptionThreshold(),
           "not enough time passed since last eruption");
    require(numCharacters > 0,
           "there are no characters in the game");
    lastEruptionTimestamp = now;
    uint128 pot;
    uint128 value;
    uint16 random;
    uint32 nextHitId;
    uint16 nchars = numCharacters;
    uint32 howmany = nchars * config.percentageToKill() / 100;
    uint128 neededGas = 80000 + 10000 * uint32(nchars);
    if(howmany == 0) howmany = 1;//hit at least 1
    uint32[] memory hitCharacters = new uint32[](howmany);
    bool[] memory alreadyHit = new bool[](nextId);
    uint16 i = 0;
    uint16 j = 0;
    while (i < howmany) {
      j++;
      random = uint16(generateRandomNumber(lastEruptionTimestamp + j) % nchars);
      nextHitId = ids[random];
      if (!alreadyHit[nextHitId]) {
        alreadyHit[nextHitId] = true;
        hitCharacters[i] = nextHitId;
        value = hitCharacter(random, nchars, 0);
        if (value > 0) {
          nchars--;
        }
        pot += value;
        i++;
      }
    }
    uint128 gasCost = uint128(neededGas * tx.gasprice);
    numCharacters = nchars;
    if (pot > gasCost){
      distribute(pot - gasCost); //distribute the pot minus the oraclize gas costs
      emit NewEruption(hitCharacters, pot - gasCost, gasCost);
    }
    else
      emit NewEruption(hitCharacters, 0, gasCost);
  }

  /**
   * Knight can attack a dragon.
   * Archer can attack only a balloon.
   * Dragon can attack wizards and archers.
   * Wizard can attack anyone, except balloon.
   * Balloon cannot attack.
   * The value of the loser is transfered to the winner.
   * @param characterID the ID of the knight to perfrom the attack
   * @param characterIndex the index of the knight in the ids-array. Just needed to save gas costs.
   *            In case it's unknown or incorrect, the index is looked up in the array.
   * */
  function fight(uint32 characterID, uint16 characterIndex) public onlyUser {
    if (characterIndex >= numCharacters || characterID != ids[characterIndex])
      characterIndex = getCharacterIndex(characterID);
    Character storage character = characters[characterID];
    require(cooldown[characterID] + config.CooldownThreshold() <= now,
            "not enough time passed since the last fight of this character");
    require(character.owner == msg.sender,
            "only owner can initiate a fight for this character");

    uint8 ctype = character.characterType;
    require(ctype < BALLOON_MIN_TYPE || ctype > BALLOON_MAX_TYPE,
            "balloons cannot fight");

    uint16 adversaryIndex = getRandomAdversary(characterID, ctype);
    require(adversaryIndex != INVALID_CHARACTER_INDEX);
    uint32 adversaryID = ids[adversaryIndex];

    Character storage adversary = characters[adversaryID];
    uint128 value;
    uint16 base_probability;
    uint16 dice = uint16(generateRandomNumber(characterID) % 100);
    if (luckToken.balanceOf(msg.sender) >= config.luckThreshold()) {
      base_probability = uint16(generateRandomNumber(dice) % 100);
      if (base_probability < dice) {
        dice = base_probability;
      }
      base_probability = 0;
    }
    uint256 characterPower = sklToken.balanceOf(character.owner) / 10**15 + xperToken.balanceOf(character.owner);
    uint256 adversaryPower = sklToken.balanceOf(adversary.owner) / 10**15 + xperToken.balanceOf(adversary.owner);
    
    if (character.value == adversary.value) {
        base_probability = 50;
      if (characterPower > adversaryPower) {
        base_probability += uint16(100 / config.fightFactor());
      } else if (adversaryPower > characterPower) {
        base_probability -= uint16(100 / config.fightFactor());
      }
    } else if (character.value > adversary.value) {
      base_probability = 100;
      if (adversaryPower > characterPower) {
        base_probability -= uint16((100 * adversary.value) / character.value / config.fightFactor());
      }
    } else if (characterPower > adversaryPower) {
        base_probability += uint16((100 * character.value) / adversary.value / config.fightFactor());
    }
    
    if (characters[characterID].fightCount < 3) {
      characters[characterID].fightCount++;
    }
    
    if (dice >= base_probability) {
      // adversary won
      if (adversary.characterType < BALLOON_MIN_TYPE || adversary.characterType > BALLOON_MAX_TYPE) {
        value = hitCharacter(characterIndex, numCharacters, adversary.characterType);
        if (value > 0) {
          numCharacters--;
        } else {
          cooldown[characterID] = now;
        }
        if (adversary.characterType >= ARCHER_MIN_TYPE && adversary.characterType <= ARCHER_MAX_TYPE) {
          castleTreasury += value;
        } else {
          adversary.value += value;
        }
        emit NewFight(adversaryID, characterID, value, base_probability, dice);
      } else {
        emit NewFight(adversaryID, characterID, 0, base_probability, dice); // balloons do not hit back
      }
    } else {
      // character won
      cooldown[characterID] = now;
      value = hitCharacter(adversaryIndex, numCharacters, character.characterType);
      if (value > 0) {
        numCharacters--;
      }
      if (character.characterType >= ARCHER_MIN_TYPE && character.characterType <= ARCHER_MAX_TYPE) {
        castleTreasury += value;
      } else {
        character.value += value;
      }
      if (oldest == 0) findOldest();
      emit NewFight(characterID, adversaryID, value, base_probability, dice);
    }
  }

  
  /*
  * @param characterType
  * @param adversaryType
  * @return whether adversaryType is a valid type of adversary for a given character
  */
  function isValidAdversary(uint8 characterType, uint8 adversaryType) pure returns (bool) {
    if (characterType >= KNIGHT_MIN_TYPE && characterType <= KNIGHT_MAX_TYPE) { // knight
      return (adversaryType <= DRAGON_MAX_TYPE);
    } else if (characterType >= WIZARD_MIN_TYPE && characterType <= WIZARD_MAX_TYPE) { // wizard
      return (adversaryType < BALLOON_MIN_TYPE || adversaryType > BALLOON_MAX_TYPE);
    } else if (characterType >= DRAGON_MIN_TYPE && characterType <= DRAGON_MAX_TYPE) { // dragon
      return (adversaryType >= WIZARD_MIN_TYPE);
    } else if (characterType >= ARCHER_MIN_TYPE && characterType <= ARCHER_MAX_TYPE) { // archer
      return ((adversaryType >= BALLOON_MIN_TYPE && adversaryType <= BALLOON_MAX_TYPE)
             || (adversaryType >= KNIGHT_MIN_TYPE && adversaryType <= KNIGHT_MAX_TYPE));
 
    }
    return false;
  }

  /**
   * pick a random adversary.
   * @param nonce a nonce to make sure there's not always the same adversary chosen in a single block.
   * @return the index of a random adversary character
   * */
  function getRandomAdversary(uint256 nonce, uint8 characterType) internal view returns(uint16) {
    uint16 randomIndex = uint16(generateRandomNumber(nonce) % numCharacters);
    // use 7, 11 or 13 as step size. scales for up to 1000 characters
    uint16 stepSize = numCharacters % 7 == 0 ? (numCharacters % 11 == 0 ? 13 : 11) : 7;
    uint16 i = randomIndex;
    //if the picked character is a knight or belongs to the sender, look at the character + stepSizes ahead in the array (modulo the total number)
    //will at some point return to the startingPoint if no character is suited
    do {
      if (isValidAdversary(characterType, characters[ids[i]].characterType) && characters[ids[i]].owner != msg.sender) {
        return i;
      }
      i = (i + stepSize) % numCharacters;
    } while (i != randomIndex);

    return INVALID_CHARACTER_INDEX;
  }


  /**
   * generate a random number.
   * @param nonce a nonce to make sure there's not always the same number returned in a single block.
   * @return the random number
   * */
  function generateRandomNumber(uint256 nonce) internal view returns(uint) {
    return uint(keccak256(block.blockhash(block.number - 1), now, numCharacters, nonce));
  }

	/**
   * Hits the character of the given type at the given index.
   * Wizards can knock off two protections. Other characters can do only one.
   * @param index the index of the character
   * @param nchars the number of characters
   * @return the value gained from hitting the characters (zero is the character was protected)
   * */
  function hitCharacter(uint16 index, uint16 nchars, uint8 characterType) internal returns(uint128 characterValue) {
    uint32 id = ids[index];
    uint8 knockOffProtections = 1;
    if (characterType >= WIZARD_MIN_TYPE && characterType <= WIZARD_MAX_TYPE) {
      knockOffProtections = 2;
    }
    if (protection[id] >= knockOffProtections) {
      protection[id] = protection[id] - knockOffProtections;
      return 0;
    }
    characterValue = characters[ids[index]].value;
    nchars--;
    replaceCharacter(index, nchars);
  }

  /**
   * finds the oldest character
   * */
  function findOldest() public {
    uint32 newOldest = noKing;
    for (uint16 i = 0; i < numCharacters; i++) {
      if (ids[i] < newOldest && characters[ids[i]].characterType <= DRAGON_MAX_TYPE)
        newOldest = ids[i];
    }
    oldest = newOldest;
  }

  /**
  * distributes the given amount among the surviving characters
  * @param totalAmount nthe amount to distribute
  */
  function distribute(uint128 totalAmount) internal {
    uint128 amount;
    castleTreasury += totalAmount / 20; //5% into castle treasury
    if (oldest == 0)
      findOldest();
    if (oldest != noKing) {
      //pay 10% to the oldest dragon
      characters[oldest].value += totalAmount / 10;
      amount  = totalAmount / 100 * 85;
    } else {
      amount  = totalAmount / 100 * 95;
    }
    //distribute the rest according to their type
    uint128 valueSum;
    uint8 size = ARCHER_MAX_TYPE + 1;
    uint128[] memory shares = new uint128[](size);
    for (uint8 v = 0; v < size; v++) {
      if ((v < BALLOON_MIN_TYPE || v > BALLOON_MAX_TYPE) && numCharactersXType[v] > 0) {
           valueSum += config.values(v);
      }
    }
    for (uint8 m = 0; m < size; m++) {
      if ((v < BALLOON_MIN_TYPE || v > BALLOON_MAX_TYPE) && numCharactersXType[m] > 0) {
        shares[m] = amount * config.values(m) / valueSum / numCharactersXType[m];
      }
    }
    uint8 cType;
    for (uint16 i = 0; i < numCharacters; i++) {
      cType = characters[ids[i]].characterType;
      if (cType < BALLOON_MIN_TYPE || cType > BALLOON_MAX_TYPE)
        characters[ids[i]].value += shares[characters[ids[i]].characterType];
    }
  }

  /**
   * allows the owner to collect the accumulated fees
   * sends the given amount to the owner's address if the amount does not exceed the
   * fees (cannot touch the players' balances) minus 100 finney (ensure that oraclize fees can be paid)
   * @param amount the amount to be collected
   * */
  function collectFees(uint128 amount) public onlyOwner {
    uint collectedFees = getFees();
    if (amount + 100 finney < collectedFees) {
      owner.transfer(amount);
    }
  }

  /**
  * withdraw NDC and TPT tokens
  */
  function withdraw() public onlyOwner {
    uint256 ndcBalance = neverdieToken.balanceOf(this);
    if(ndcBalance > 0)
      assert(neverdieToken.transfer(owner, ndcBalance));
    uint256 tptBalance = teleportToken.balanceOf(this);
    if(tptBalance > 0)
      assert(teleportToken.transfer(owner, tptBalance));
  }

  /**
   * pays out the players.
   * */
  function payOut() public onlyOwner {
    for (uint16 i = 0; i < numCharacters; i++) {
      characters[ids[i]].owner.transfer(characters[ids[i]].value);
      delete characters[ids[i]];
    }
    delete ids;
    numCharacters = 0;
  }

  /**
   * pays out the players and kills the game.
   * */
  function stop() public onlyOwner {
    withdraw();
    payOut();
    destroy();
  }

  function generateLuckFactor(uint128 nonce) internal view returns(uint128 luckFactor) {
    uint128 f;
    luckFactor = 50;
    for(uint8 i = 0; i < luckRounds; i++){
      f = roll(uint128(generateRandomNumber(nonce+i*7)%1000));
      if(f < luckFactor) luckFactor = f;
    }
  }
  
  function roll(uint128 nonce) internal view returns(uint128) {
    uint128 sum = 0;
    uint128 inc = 1;
    for (uint128 i = 45; i >= 3; i--) {
      if (sum > nonce) {
          return i;
      }
      sum += inc;
      if (i != 35) {
          inc += 1;
      }
    }
    return 3;
  }
  
  function distributeCastleLootMulti(uint32[] characterIds) external onlyUser {
    require(characterIds.length <= 50);
    for(uint i = 0; i < characterIds.length; i++){
      distributeCastleLoot(characterIds[i]);
    }
  }

  /* @dev distributes castle loot among archers */
  function distributeCastleLoot(uint32 characterId) public onlyUser {
    require(castleTreasury > 0, "empty treasury");
    Character archer = characters[characterId];
    require(archer.characterType >= ARCHER_MIN_TYPE && archer.characterType <= ARCHER_MAX_TYPE, "only archers can access the castle treasury");
    if(lastCastleLootDistributionTimestamp[characterId] == 0) 
      require(now - archer.purchaseTimestamp >= config.castleLootDistributionThreshold(), 
            "not enough time has passed since the purchase");
    else 
      require(now >= lastCastleLootDistributionTimestamp[characterId] + config.castleLootDistributionThreshold(),
            "not enough time passed since the last castle loot distribution");
    require(archer.fightCount >= 3, "need to fight 3 times");
    lastCastleLootDistributionTimestamp[characterId] = now;
    archer.fightCount = 0;
    
    uint128 luckFactor = generateLuckFactor(uint128(generateRandomNumber(characterId) % 1000));
    if (luckFactor < 3) {
      luckFactor = 3;
    }
    assert(luckFactor <= 50);
    uint128 amount = castleTreasury * luckFactor / 100; 
    archer.value += amount;
    castleTreasury -= amount;
    emit NewDistributionCastleLoot(amount, characterId, luckFactor);

  }

  /**
   * sell the character of the given id
   * throws an exception in case of a knight not yet teleported to the game
   * @param characterId the id of the character
   * */
  function sellCharacter(uint32 characterId, uint16 characterIndex) public onlyUser {
    if (characterIndex >= numCharacters || characterId != ids[characterIndex])
      characterIndex = getCharacterIndex(characterId);
    Character storage char = characters[characterId];
    require(msg.sender == char.owner,
            "only owners can sell their characters");
    require(char.characterType < BALLOON_MIN_TYPE || char.characterType > BALLOON_MAX_TYPE,
            "balloons are not sellable");
    require(char.purchaseTimestamp + 1 days < now,
            "character can be sold only 1 day after the purchase");
    uint128 val = char.value;
    numCharacters--;
    replaceCharacter(characterIndex, numCharacters);
    msg.sender.transfer(val);
    if (oldest == 0)
      findOldest();
    emit NewSell(characterId, msg.sender, val);
  }

  /**
   * receive approval to spend some tokens.
   * used for teleport and protection.
   * @param sender the sender address
   * @param value the transferred value
   * @param tokenContract the address of the token contract
   * @param callData the data passed by the token contract
   * */
  function receiveApproval(address sender, uint256 value, address tokenContract, bytes callData) public {
    require(tokenContract == address(teleportToken), "everything is paid with teleport tokens");
    bool forProtection = secondToUint32(callData) == 1 ? true : false;
    uint32 id;
    uint256 price;
    if (!forProtection) {
      id = toUint32(callData);
      price = config.teleportPrice();
      if (characters[id].characterType >= BALLOON_MIN_TYPE && characters[id].characterType <= WIZARD_MAX_TYPE) {
        price *= 2;
      }
      require(value >= price,
              "insufficinet amount of tokens to teleport this character");
      assert(teleportToken.transferFrom(sender, this, price));
      teleportCharacter(id);
    } else {
      id = toUint32(callData);
      // user can purchase extra lifes only right after character purchaes
      // in other words, user value should be equal the initial value
      uint8 cType = characters[id].characterType;
      require(characters[id].value == config.values(cType),
              "protection could be bought only before the first fight and before the first volcano eruption");

      // calc how many lifes user can actually buy
      // the formula is the following:

      uint256 lifePrice;
      uint8 max;
      if(cType <= KNIGHT_MAX_TYPE ){
        lifePrice = ((cType % NUMBER_OF_LEVELS) + 1) * config.protectionPrice();
        max = 3;
      } else if (cType >= BALLOON_MIN_TYPE && cType <= BALLOON_MAX_TYPE) {
        lifePrice = (((cType+3) % NUMBER_OF_LEVELS) + 1) * config.protectionPrice() * 2;
        max = 6;
      } else if (cType >= WIZARD_MIN_TYPE && cType <= WIZARD_MAX_TYPE) {
        lifePrice = (((cType+3) % NUMBER_OF_LEVELS) + 1) * config.protectionPrice() * 2;
        max = 3;
      } else if (cType >= ARCHER_MIN_TYPE && cType <= ARCHER_MAX_TYPE) {
        lifePrice = (((cType+3) % NUMBER_OF_LEVELS) + 1) * config.protectionPrice();
        max = 3;
      }

      price = 0;
      uint8 i = protection[id];
      for (i; i < max && value >= price + lifePrice * (i + 1); i++) {
        price += lifePrice * (i + 1);
      }
      assert(teleportToken.transferFrom(sender, this, price));
      protectCharacter(id, i);
    } 
  }

  /**
   * Knights, balloons, wizards, and archers are only entering the game completely, when they are teleported to the scene
   * @param id the character id
   * */
  function teleportCharacter(uint32 id) internal {
    // ensure we do not teleport twice
    require(teleported[id] == false,
           "already teleported");
    teleported[id] = true;
    Character storage character = characters[id];
    require(character.characterType > DRAGON_MAX_TYPE,
           "dragons do not need to be teleported"); //this also makes calls with non-existent ids fail
    addCharacter(id, numCharacters);
    numCharacters++;
    numCharactersXType[character.characterType]++;
    emit NewTeleport(id);
  }

  /**
   * adds protection to a character
   * @param id the character id
   * @param lifes the number of protections
   * */
  function protectCharacter(uint32 id, uint8 lifes) internal {
    protection[id] = lifes;
    emit NewProtection(id, lifes);
  }
  
  /**
   * set the castle loot factor (percent of the luck factor being distributed)
   * */
  function setLuckRound(uint8 rounds) public onlyOwner{
    require(rounds >= 1 && rounds <= 100);
    luckRounds = rounds;
  }


  /****************** GETTERS *************************/

  /**
   * returns the character of the given id
   * @param characterId the character id
   * @return the type, value and owner of the character
   * */
  function getCharacter(uint32 characterId) public view returns(uint8, uint128, address) {
    return (characters[characterId].characterType, characters[characterId].value, characters[characterId].owner);
  }

  /**
   * returns the index of a character of the given id
   * @param characterId the character id
   * @return the character id
   * */
  function getCharacterIndex(uint32 characterId) constant public returns(uint16) {
    for (uint16 i = 0; i < ids.length; i++) {
      if (ids[i] == characterId) {
        return i;
      }
    }
    revert();
  }

  /**
   * returns 10 characters starting from a certain indey
   * @param startIndex the index to start from
   * @return 4 arrays containing the ids, types, values and owners of the characters
   * */
  function get10Characters(uint16 startIndex) constant public returns(uint32[10] characterIds, uint8[10] types, uint128[10] values, address[10] owners) {
    uint32 endIndex = startIndex + 10 > numCharacters ? numCharacters : startIndex + 10;
    uint8 j = 0;
    uint32 id;
    for (uint16 i = startIndex; i < endIndex; i++) {
      id = ids[i];
      characterIds[j] = id;
      types[j] = characters[id].characterType;
      values[j] = characters[id].value;
      owners[j] = characters[id].owner;
      j++;
    }

  }

  /**
   * returns the number of dragons in the game
   * @return the number of dragons
   * */
  function getNumDragons() constant public returns(uint16 numDragons) {
    for (uint8 i = DRAGON_MIN_TYPE; i <= DRAGON_MAX_TYPE; i++)
      numDragons += numCharactersXType[i];
  }

  /**
   * returns the number of wizards in the game
   * @return the number of wizards
   * */
  function getNumWizards() constant public returns(uint16 numWizards) {
    for (uint8 i = WIZARD_MIN_TYPE; i <= WIZARD_MAX_TYPE; i++)
      numWizards += numCharactersXType[i];
  }
  /**
   * returns the number of archers in the game
   * @return the number of archers
   * */
  function getNumArchers() constant public returns(uint16 numArchers) {
    for (uint8 i = ARCHER_MIN_TYPE; i <= ARCHER_MAX_TYPE; i++)
      numArchers += numCharactersXType[i];
  }

  /**
   * returns the number of knights in the game
   * @return the number of knights
   * */
  function getNumKnights() constant public returns(uint16 numKnights) {
    for (uint8 i = KNIGHT_MIN_TYPE; i <= KNIGHT_MAX_TYPE; i++)
      numKnights += numCharactersXType[i];
  }

  /**
   * @return the accumulated fees
   * */
  function getFees() constant public returns(uint) {
    uint reserved = castleTreasury;
    for (uint16 j = 0; j < numCharacters; j++)
      reserved += characters[ids[j]].value;
    return address(this).balance - reserved;
  }


  /************* HELPERS ****************/

  /**
   * only works for bytes of length < 32
   * @param b the byte input
   * @return the uint
   * */
  function toUint32(bytes b) internal pure returns(uint32) {
    bytes32 newB;
    assembly {
      newB: = mload(0xa0)
    }
    return uint32(newB);
  }
  
  function secondToUint32(bytes b) internal pure returns(uint32){
    bytes32 newB;
    assembly {
      newB: = mload(0xc0)
    }
    return uint32(newB);
  }
}

contract DragonKingTest is DragonKing {
  /* Test contract can trigger volcano eruption any time (eruptionThreshold=0), harming 10% of all characters. It will have 5% fee and a given set of costs. */
  function DragonKingTest(address tpt, address ndc, address skl, address xper, address luck, address cfg) DragonKing(tpt, ndc, skl, xper, luck, cfg) public {
  }

  function getCosts() public pure returns(uint16[] costs) {
    costs = new uint16[](6);
    costs[0] = uint16(10);
    costs[1] = uint16(20);
    costs[2] = uint16(50);
    costs[3] = uint16(100);
    costs[4] = uint16(500);
    costs[5] = uint16(1000);
  }

  function getBalloonCosts() public pure returns(uint16[] costs) {
    costs = new uint16[](3);
    costs[0] = uint16(100);
    costs[1] = uint16(500);
    costs[2] = uint16(1000);
  }

  /** test random dragon selection **/
  function testGetRandomDragon(uint256 nonce) public view returns(uint16) {
    return getRandomAdversary(nonce, KNIGHT_MIN_TYPE);
  }

  function random(uint128 nonce) public view returns(uint128) {
    return generateLuckFactor(nonce);
  }
  

}

    Contract ABI  
[{"constant":false,"inputs":[{"name":"characterId","type":"uint32"},{"name":"characterIndex","type":"uint16"}],"name":"sellCharacter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"stop","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"receiver","type":"address"},{"name":"characterType","type":"uint8"}],"name":"giftCharacter","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"rounds","type":"uint8"}],"name":"setLuckRound","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getNumArchers","outputs":[{"name":"numArchers","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"triggerVolcanoEruption","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"KNIGHT_MAX_TYPE","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint128"}],"name":"collectFees","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"castleTreasury","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint8"}],"name":"numCharactersXType","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"BALLOON_MIN_TYPE","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"characterId","type":"uint32"}],"name":"getCharacter","outputs":[{"name":"","type":"uint8"},{"name":"","type":"uint128"},{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"oldest","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"INVALID_CHARACTER_INDEX","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"characterId","type":"uint32"}],"name":"getCharacterIndex","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint32"}],"name":"lastCastleLootDistributionTimestamp","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"startIndex","type":"uint16"}],"name":"get10Characters","outputs":[{"name":"characterIds","type":"uint32[10]"},{"name":"types","type":"uint8[10]"},{"name":"values","type":"uint128[10]"},{"name":"owners","type":"address[10]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"nextId","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint32"}],"name":"protection","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"luckRounds","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"characterID","type":"uint32"},{"name":"characterIndex","type":"uint16"}],"name":"fight","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"config","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"characterType","type":"uint8"}],"name":"addCharacters","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"destroy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getNumDragons","outputs":[{"name":"numDragons","type":"uint16"}],"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":"sender","type":"address"},{"name":"value","type":"uint256"},{"name":"tokenContract","type":"address"},{"name":"callData","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"KNIGHT_MIN_TYPE","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"WIZARD_MAX_TYPE","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getNumWizards","outputs":[{"name":"numWizards","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"NUMBER_OF_LEVELS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"characterType","type":"uint8"},{"name":"adversaryType","type":"uint8"}],"name":"isValidAdversary","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"ARCHER_MIN_TYPE","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint32"}],"name":"cooldown","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"WIZARD_MIN_TYPE","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getNumKnights","outputs":[{"name":"numKnights","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastEruptionTimestamp","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DRAGON_MAX_TYPE","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"payOut","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"ARCHER_MAX_TYPE","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"BALLOON_MAX_TYPE","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"characterIds","type":"uint32[]"}],"name":"distributeCastleLootMulti","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getFees","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"noKing","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"characterId","type":"uint32"}],"name":"distributeCastleLoot","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"exit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"DRAGON_MIN_TYPE","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"numCharacters","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_recipient","type":"address"}],"name":"destroyAndSend","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"INVALID_CHARACTER_TYPE","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"ids","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"findOldest","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"tptAddress","type":"address"},{"name":"ndcAddress","type":"address"},{"name":"sklAddress","type":"address"},{"name":"xperAddress","type":"address"},{"name":"luckAddress","type":"address"},{"name":"_configAddress","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"player","type":"address"},{"indexed":false,"name":"characterType","type":"uint8"},{"indexed":false,"name":"amount","type":"uint16"},{"indexed":false,"name":"startId","type":"uint32"}],"name":"NewPurchase","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"player","type":"address"},{"indexed":false,"name":"totalBalance","type":"uint256"},{"indexed":false,"name":"removedCharacters","type":"uint32[]"}],"name":"NewExit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"hitCharacters","type":"uint32[]"},{"indexed":false,"name":"value","type":"uint128"},{"indexed":false,"name":"gasCost","type":"uint128"}],"name":"NewEruption","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"characterId","type":"uint32"},{"indexed":false,"name":"player","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"NewSell","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"winnerID","type":"uint32"},{"indexed":false,"name":"loserID","type":"uint32"},{"indexed":false,"name":"value","type":"uint256"},{"indexed":false,"name":"probability","type":"uint16"},{"indexed":false,"name":"dice","type":"uint16"}],"name":"NewFight","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"characterId","type":"uint32"}],"name":"NewTeleport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"characterId","type":"uint32"},{"indexed":false,"name":"lifes","type":"uint8"}],"name":"NewProtection","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"castleLoot","type":"uint128"},{"indexed":false,"name":"characterId","type":"uint32"},{"indexed":false,"name":"luckFactor","type":"uint128"}],"name":"NewDistributionCastleLoot","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"}],"name":"OwnershipRenounced","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
60806040526008805460a060020a60ff0219167402000000000000000000000000000000000000000017905534801561003757600080fd5b5060405160c08062005d3183398101604090815281516020830151918301516060840151608085015160a0909501516000805433600160a060020a03199182161782556008805463ffffffff19166001908117909155600380548316600160a060020a0398891617905560028054831698881698909817909755600580548216958716959095179094556006805485169386169390931790925560048054841696851696909617909555835490911691909316179055615c33908190620000fe90396000f3006080604052600436106102785763ffffffff60e060020a600035041662bfd441811461027d57806307da68f5146102a45780630a3dfba7146102b95780630bc142c6146102d35780631d2a6dcf146102ee5780631e466eee1461031a57806326bdce711461032f57806328acb0021461035a578063291ed7731461037b57806329b20bb6146103ac57806330aaed53146103c75780633728bec2146103dc5780633c3c22b31461042d5780633ccfd60b1461045b5780634afe49c2146104705780634f255b80146104855780635c4c4a18146104a3578063603709e3146104d357806361b8ce8c146105ac578063715018a6146105c157806372ad21c7146105d6578063772ca5b8146105f4578063773e1e841461060957806379502c551461062e578063797e2aec1461065f57806383197ef01461066d578063851ad4d6146106825780638da5cb5b146106975780638f4ffcb1146106ac5780639271a9881461071c5780639ced242b14610731578063a050d07d14610746578063a9689b4f1461071c578063ad389d5d1461075b578063ad70ae1a14610790578063b066ef3c146107a5578063b0eee8db146107c3578063b32dbcd8146107d8578063c10435cc146107ed578063c125529914610802578063c205240314610817578063d0f9bad11461082c578063d39512b814610841578063d9f8695014610856578063db8d55f114610876578063dc9bb7db1461088b578063e4b971f8146108a0578063e9fad8ee146108be578063f10e2ec1146108d3578063f1be42f1146108e8578063f2fde38b146108fd578063f5074f411461091e578063f690648d1461093f578063fac333ac14610954578063fbe6529f1461096c575b600080fd5b34801561028957600080fd5b506102a263ffffffff6004351661ffff60243516610981565b005b3480156102b057600080fd5b506102a2610cd4565b6102a2600160a060020a036004351660ff60243516610d05565b3480156102df57600080fd5b506102a260ff60043516610efe565b3480156102fa57600080fd5b50610303610f69565b6040805161ffff9092168252519081900360200190f35b34801561032657600080fd5b506102a2610fa1565b34801561033b57600080fd5b50610344611597565b6040805160ff9092168252519081900360200190f35b34801561036657600080fd5b506102a26001608060020a036004351661159c565b34801561038757600080fd5b50610390611621565b604080516001608060020a039092168252519081900360200190f35b3480156103b857600080fd5b5061030360ff60043516611638565b3480156103d357600080fd5b5061034461164e565b3480156103e857600080fd5b506103fa63ffffffff60043516611653565b6040805160ff90941684526001608060020a039092166020840152600160a060020a031682820152519081900360600190f35b34801561043957600080fd5b50610442611692565b6040805163ffffffff9092168252519081900360200190f35b34801561046757600080fd5b506102a26116a5565b34801561047c57600080fd5b506103036118ed565b34801561049157600080fd5b5061030363ffffffff600435166118f3565b3480156104af57600080fd5b506104c163ffffffff6004351661195f565b60408051918252519081900360200190f35b3480156104df57600080fd5b506104ef61ffff60043516611971565b604051808561014080838360005b838110156105155781810151838201526020016104fd565b5050505090500184600a60200280838360005b83811015610540578181015183820152602001610528565b5050505090500183600a60200280838360005b8381101561056b578181015183820152602001610553565b5050505090500182600a60200280838360005b8381101561059657818101518382015260200161057e565b5050505090500194505050505060405180910390f35b3480156105b857600080fd5b50610442611b18565b3480156105cd57600080fd5b506102a2611b24565b3480156105e257600080fd5b5061034463ffffffff60043516611b90565b34801561060057600080fd5b50610344611ba5565b34801561061557600080fd5b506102a263ffffffff6004351661ffff60243516611bb5565b34801561063a57600080fd5b506106436129bf565b60408051600160a060020a039092168252519081900360200190f35b6102a260ff600435166129ce565b34801561067957600080fd5b506102a2612a2f565b34801561068e57600080fd5b50610303612a54565b3480156106a357600080fd5b50610643612a87565b3480156106b857600080fd5b50604080516020601f6064356004818101359283018490048402850184019095528184526102a294600160a060020a03813581169560248035966044359093169536956084949201918190840183828082843750949750612a969650505050505050565b34801561072857600080fd5b506103446132bb565b34801561073d57600080fd5b506103446132c0565b34801561075257600080fd5b506103036132c5565b34801561076757600080fd5b5061077c60ff600435811690602435166132f9565b604080519115158252519081900360200190f35b34801561079c57600080fd5b506103446133ec565b3480156107b157600080fd5b506104c163ffffffff600435166133f1565b3480156107cf57600080fd5b50610344613403565b3480156107e457600080fd5b50610303613408565b3480156107f957600080fd5b506104c161343c565b34801561080e57600080fd5b50610344613442565b34801561082357600080fd5b506102a2613447565b34801561083857600080fd5b5061034461361f565b34801561084d57600080fd5b50610344613624565b34801561086257600080fd5b506102a26004803560248101910135613629565b34801561088257600080fd5b506104c16136c2565b34801561089757600080fd5b506104426118ed565b3480156108ac57600080fd5b506102a263ffffffff6004351661375b565b3480156108ca57600080fd5b506102a2613ccc565b3480156108df57600080fd5b5061034461437b565b3480156108f457600080fd5b50610303614380565b34801561090957600080fd5b506102a2600160a060020a036004351661438a565b34801561092a57600080fd5b506102a2600160a060020a03600435166143aa565b34801561094b57600080fd5b506103446143cd565b34801561096057600080fd5b506104426004356143d2565b34801561097857600080fd5b506102a261440a565b6000803332146109d8576040805160e560020a62461bcd02815260206004820152602480820152600080516020615be8833981519152604482015260e260020a631d1a1bd902606482015290519081900360840190fd5b600b5461ffff908116908416101580610a3457506007805461ffff85169081106109fe57fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1663ffffffff168463ffffffff1614155b15610a4557610a42846118f3565b92505b63ffffffff841660009081526009602052604090206001810154909250600160a060020a03163314610ae7576040805160e560020a62461bcd02815260206004820152602560248201527f6f6e6c79206f776e6572732063616e2073656c6c20746865697220636861726160448201527f6374657273000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b8154600c60ff9091161080610b0257508154600e60ff909116115b1515610b58576040805160e560020a62461bcd02815260206004820152601960248201527f62616c6c6f6f6e7320617265206e6f742073656c6c61626c6500000000000000604482015290519081900360640190fd5b60018201544260a060020a90910467ffffffffffffffff90811662015180011610610bf3576040805160e560020a62461bcd02815260206004820152603360248201527f6368617261637465722063616e20626520736f6c64206f6e6c7920312064617960448201527f2061667465722074686520707572636861736500000000000000000000000000606482015290519081900360840190fd5b508054600b805461ffff19811661ffff91821660001901821617918290556101009092046001608060020a031691610c2d9185911661453e565b60405133906001608060020a03831680156108fc02916000818181858888f19350505050158015610c62573d6000803e3d6000fd5b5060085460a860020a900463ffffffff161515610c8157610c8161440a565b6040805163ffffffff861681523360208201526001608060020a0383168183015290517fe5cc68f68d9672681158062a835b6abc2ff3fba89f8db70f3a227d4ac35da3c39181900360600190a150505050565b600054600160a060020a03163314610ceb57600080fd5b610cf36116a5565b610cfb613447565b610d03612a2f565b565b333214610d59576040805160e560020a62461bcd02815260206004820152602480820152600080516020615be8833981519152604482015260e260020a631d1a1bd902606482015290519081900360840190fd5b610d6382826146f9565b600160009054906101000a9004600160a060020a0316600160a060020a0316632091f9556040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610db657600080fd5b505af1158015610dca573d6000803e3d6000fd5b505050506040513d6020811015610de057600080fd5b5051600154604080517f5bdaa8e70000000000000000000000000000000000000000000000000000000081529051600160a060020a039384169363a9059cbb938793911691635bdaa8e7916004808201926020929091908290030181600087803b158015610e4d57600080fd5b505af1158015610e61573d6000803e3d6000fd5b505050506040513d6020811015610e7757600080fd5b50516040805160e060020a63ffffffff8616028152600160a060020a03909316600484015260248301919091525160448083019260209291908290030181600087803b158015610ec657600080fd5b505af1158015610eda573d6000803e3d6000fd5b505050506040513d6020811015610ef057600080fd5b50511515610efa57fe5b5050565b600054600160a060020a03163314610f1557600080fd5b60018160ff1610158015610f2d575060648160ff1611155b1515610f3857600080fd5b6008805460ff90921660a060020a0274ff000000000000000000000000000000000000000019909216919091179055565b600060155b601a60ff821611610f9d5760ff81166000908152600c602052604090205461ffff169190910190600101610f6e565b5090565b6000808080808080606080828080333214611003576040805160e560020a62461bcd02815260206004820152602480820152600080516020615be8833981519152604482015260e260020a631d1a1bd902606482015290519081900360840190fd5b600160009054906101000a9004600160a060020a0316600160a060020a031663afb7e4956040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561105657600080fd5b505af115801561106a573d6000803e3d6000fd5b505050506040513d602081101561108057600080fd5b5051600d5401421015611103576040805160e560020a62461bcd02815260206004820152602a60248201527f6e6f7420656e6f7567682074696d65207061737365642073696e6365206c617360448201527f74206572757074696f6e00000000000000000000000000000000000000000000606482015290519081900360840190fd5b600b54600061ffff90911611611189576040805160e560020a62461bcd02815260206004820152602360248201527f746865726520617265206e6f206368617261637465727320696e20746865206760448201527f616d650000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b42600d55600b54600154604080517f11a5a793000000000000000000000000000000000000000000000000000000008152905161ffff9093169a50606492600160a060020a03909216916311a5a793916004808201926020929091908290030181600087803b1580156111fb57600080fd5b505af115801561120f573d6000803e3d6000fd5b505050506040513d602081101561122557600080fd5b505160ff16890261ffff1681151561123957fe5b0461ffff1696508761ffff1661271002620138800163ffffffff1695508663ffffffff166000141561126a57600196505b8663ffffffff1660405190808252806020026020018201604052801561129a578160200160208202803883390190505b506008546040805163ffffffff90921680835260208082028401019091529196509080156112d2578160200160208202803883390190505b50935060009250600091505b8663ffffffff168361ffff1610156113fe5781806001019250508761ffff1661130e8361ffff16600d5401614f98565b81151561131757fe5b06995060078a61ffff1681548110151561132d57fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff169850838963ffffffff1681518110151561136957fe5b9060200190602002015115156113f9576001848a63ffffffff1681518110151561138f57fe5b91151560209283029091019091015284518990869061ffff86169081106113b257fe5b63ffffffff9092166020928302909101909101526113d28a896000614ff1565b9a5060008b6001608060020a031611156113ee57600019909701965b9a8a019a6001909201915b6112de565b50600b805461ffff891661ffff199091161790556001608060020a038086163a0290818116908d1611156114e757611437818d0361511b565b7fa06ad7d0261a795ad8f33fdbef7cf65a0f9f9a825353b13358a96a750acd6b3d85828e03836040518080602001846001608060020a03166001608060020a03168152602001836001608060020a03166001608060020a03168152602001828103825285818151815260200191508051906020019060200280838360005b838110156114cd5781810151838201526020016114b5565b5050505090500194505050505060405180910390a1611589565b7fa06ad7d0261a795ad8f33fdbef7cf65a0f9f9a825353b13358a96a750acd6b3d856000836040518080602001846001608060020a03168152602001836001608060020a03166001608060020a03168152602001828103825285818151815260200191508051906020019060200280838360005b8381101561157357818101518382015260200161155b565b5050505090500194505050505060405180910390a15b505050505050505050505050565b600b81565b60008054600160a060020a031633146115b457600080fd5b6115bc6136c2565b9050808267016345785d8a0000016001608060020a03161015610efa5760008054604051600160a060020a03909116916001608060020a03851680156108fc02929091818181858888f1935050505015801561161c573d6000803e3d6000fd5b505050565b60085464010000000090046001608060020a031681565b600c6020526000908152604090205461ffff1681565b600c81565b63ffffffff166000908152600960205260409020805460019091015460ff8216926101009092046001608060020a031691600160a060020a0390911690565b60085460a860020a900463ffffffff1681565b600080548190600160a060020a031633146116bf57600080fd5b6002546040805160e060020a6370a082310281523060048201529051600160a060020a03909216916370a08231916024808201926020929091908290030181600087803b15801561170f57600080fd5b505af1158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051915060008211156117f05760025460008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018790529051919093169263a9059cbb9260448083019360209390929083900390910190829087803b1580156117bc57600080fd5b505af11580156117d0573d6000803e3d6000fd5b505050506040513d60208110156117e657600080fd5b505115156117f057fe5b6003546040805160e060020a6370a082310281523060048201529051600160a060020a03909216916370a08231916024808201926020929091908290030181600087803b15801561184057600080fd5b505af1158015611854573d6000803e3d6000fd5b505050506040513d602081101561186a57600080fd5b505190506000811115610efa5760035460008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018690529051919093169263a9059cbb9260448083019360209390929083900390910190829087803b158015610ec657600080fd5b60001981565b6000805b60075461ffff82161015610278578263ffffffff1660078261ffff1681548110151561191f57fe5b6000918252602090912060088204015460079091166004026101000a900463ffffffff16141561195157809150611959565b6001016118f7565b50919050565b600e6020526000908152604090205481565b611979615b8a565b611981615b8a565b611989615b8a565b611991615b8a565b600b5460009081908190819061ffff908116600a8b01909116116119b85788600a016119c0565b600b5461ffff165b61ffff169350600092508890505b8363ffffffff168161ffff161015611b0d576007805461ffff83169081106119f257fe5b6000918252602090912060088204015460079091166004026101000a900463ffffffff169150818860ff8516600a8110611a2857fe5b63ffffffff9283166020918202929092019190915290831660009081526009909152604090205460ff9081169088908516600a8110611a6357fe5b60ff9283166020918202929092019190915263ffffffff841660009081526009909152604090205461010090046001608060020a03169087908516600a8110611aa857fe5b6001608060020a039092166020928302919091015263ffffffff8316600090815260099091526040902060010154600160a060020a03168560ff8516600a8110611aee57fe5b600160a060020a039092166020929092020152600192830192016119ce565b505050509193509193565b60085463ffffffff1681565b600054600160a060020a03163314611b3b57600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b60106020526000908152604090205460ff1681565b60085460a060020a900460ff1681565b6000808080808080808080333214611c14576040805160e560020a62461bcd02815260206004820152602480820152600080516020615be8833981519152604482015260e260020a631d1a1bd902606482015290519081900360840190fd5b600b5461ffff908116908c16101580611c7057506007805461ffff8d16908110611c3a57fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1663ffffffff168c63ffffffff1614155b15611c8157611c7e8c6118f3565b9a505b63ffffffff8c16600090815260096020908152604080832060015482517f4597dc8e0000000000000000000000000000000000000000000000000000000081529251919e504294600160a060020a0390911693634597dc8e936004808201949293918390030190829087803b158015611cf957600080fd5b505af1158015611d0d573d6000803e3d6000fd5b505050506040513d6020811015611d2357600080fd5b505163ffffffff8e166000908152600f6020526040902054011115611db8576040805160e560020a62461bcd02815260206004820152603d60248201527f6e6f7420656e6f7567682074696d65207061737365642073696e63652074686560448201527f206c617374206669676874206f66207468697320636861726163746572000000606482015290519081900360840190fd5b60018a0154600160a060020a03163314611e42576040805160e560020a62461bcd02815260206004820152603260248201527f6f6e6c79206f776e65722063616e20696e69746961746520612066696768742060448201527f666f722074686973206368617261637465720000000000000000000000000000606482015290519081900360840190fd5b895460ff169850600c891080611e5b5750600e60ff8a16115b1515611eb1576040805160e560020a62461bcd02815260206004820152601560248201527f62616c6c6f6f6e732063616e6e6f742066696768740000000000000000000000604482015290519081900360640190fd5b611ec18c63ffffffff168a6155dc565b975061ffff8089161415611ed457600080fd5b6007805461ffff8a16908110611ee657fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff908116808452600990925260409092209098509650606490611f2d908e16614f98565b811515611f3657fe5b069250600160009054906101000a9004600160a060020a0316600160a060020a0316638f7561476040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015611f8c57600080fd5b505af1158015611fa0573d6000803e3d6000fd5b505050506040513d6020811015611fb657600080fd5b5051600480546040805160e060020a6370a08231028152339381019390935251600160a060020a03909116916370a082319160248083019260209291908290030181600087803b15801561200957600080fd5b505af115801561201d573d6000803e3d6000fd5b505050506040513d602081101561203357600080fd5b50511061206e5760646120498461ffff16614f98565b81151561205257fe5b0693508261ffff168461ffff161015612069578392505b600093505b60065460018b01546040805160e060020a6370a08231028152600160a060020a039283166004820152905191909216916370a082319160248083019260209291908290030181600087803b1580156120c557600080fd5b505af11580156120d9573d6000803e3d6000fd5b505050506040513d60208110156120ef57600080fd5b505160055460018c01546040805160e060020a6370a08231028152600160a060020a039283166004820152905166038d7ea4c680009392909216916370a08231916024808201926020929091908290030181600087803b15801561215257600080fd5b505af1158015612166573d6000803e3d6000fd5b505050506040513d602081101561217c57600080fd5b505181151561218757fe5b60065460018a01546040805160e060020a6370a08231028152600160a060020a03928316600482015290519490930494909401955092909216916370a082319160248083019260209291908290030181600087803b1580156121e857600080fd5b505af11580156121fc573d6000803e3d6000fd5b505050506040513d602081101561221257600080fd5b505160055460018801546040805160e060020a6370a08231028152600160a060020a039283166004820152905166038d7ea4c680009392909216916370a08231916024808201926020929091908290030181600087803b15801561227557600080fd5b505af1158015612289573d6000803e3d6000fd5b505050506040513d602081101561229f57600080fd5b50518115156122aa57fe5b88548d5492909104929092019250610100918290046001608060020a039081169290910416141561241e57603293508082111561237b57600160009054906101000a9004600160a060020a0316600160a060020a0316634ad6e6486040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561233457600080fd5b505af1158015612348573d6000803e3d6000fd5b505050506040513d602081101561235e57600080fd5b505160ff16606481151561236e57fe5b0460ff1684019350612419565b8181111561241957600160009054906101000a9004600160a060020a0316600160a060020a0316634ad6e6486040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156123d657600080fd5b505af11580156123ea573d6000803e3d6000fd5b505050506040513d602081101561240057600080fd5b505160ff16606481151561241057fe5b0460ff16840393505b6125e4565b85548a546001608060020a036101009283900481169290910416111561251557606493508181111561241957600160009054906101000a9004600160a060020a0316600160a060020a0316634ad6e6486040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561249d57600080fd5b505af11580156124b1573d6000803e3d6000fd5b505050506040513d60208110156124c757600080fd5b50518a54875460ff90921691610100918290046001608060020a03908116929091048116606402168115156124f857fe5b046001608060020a031681151561250b57fe5b04840393506125e4565b808211156125e457600160009054906101000a9004600160a060020a0316600160a060020a0316634ad6e6486040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561257057600080fd5b505af1158015612584573d6000803e3d6000fd5b505050506040513d602081101561259a57600080fd5b505186548b5460ff90921691610100918290046001608060020a03908116929091048116606402168115156125cb57fe5b046001608060020a03168115156125de57fe5b04840193505b63ffffffff8c16600090815260096020526040902060010154600360e060020a90910460ff1610156126525763ffffffff8c1660009081526009602052604090206001908101805460ff60e060020a80830482169094011690920260e060020a60ff02199092169190911790555b61ffff8085169084161061283e578554600c60ff909116108061267b57508554600e60ff909116115b156127df57600b54865461269a918d9161ffff9091169060ff16614ff1565b94506000856001608060020a031611156126cd57600b805461ffff19811661ffff918216600019019091161790556126e6565b63ffffffff8c166000908152600f602052604090204290555b8554601560ff9091161080159061270457508554601a60ff90911611155b1561274757600880546001608060020a03640100000000808304821689019091160273ffffffffffffffffffffffffffffffff0000000019909116179055612779565b85546001608060020a03610100808304821688019091160270ffffffffffffffffffffffffffffffff00199091161786555b6040805163ffffffff808a1682528e1660208201526001608060020a0387168183015261ffff80871660608301528516608082015290517f24758388bd6bf650dde3bbde100b1056920770025a9f1c5998b4587670d4f3859181900360a00190a1612839565b6040805163ffffffff808a1682528e16602082015260008183015261ffff80871660608301528516608082015290517f24758388bd6bf650dde3bbde100b1056920770025a9f1c5998b4587670d4f3859181900360a00190a15b611589565b63ffffffff8c166000908152600f60205260409020429055600b548a54612870918a9161ffff9091169060ff16614ff1565b94506000856001608060020a0316111561289f57600b805461ffff19811661ffff918216600019019091161790555b8954601560ff909116108015906128bd57508954601a60ff90911611155b1561290057600880546001608060020a03640100000000808304821689019091160273ffffffffffffffffffffffffffffffff0000000019909116179055612932565b89546001608060020a03610100808304821688019091160270ffffffffffffffffffffffffffffffff0019909116178a555b60085460a860020a900463ffffffff1615156129505761295061440a565b6040805163ffffffff808f168252891660208201526001608060020a0387168183015261ffff80871660608301528516608082015290517f24758388bd6bf650dde3bbde100b1056920770025a9f1c5998b4587670d4f3859181900360a00190a1505050505050505050505050565b600154600160a060020a031681565b333214612a22576040805160e560020a62461bcd02815260206004820152602480820152600080516020615be8833981519152604482015260e260020a631d1a1bd902606482015290519081900360840190fd5b612a2c33826146f9565b50565b600054600160a060020a03163314612a4657600080fd5b600054600160a060020a0316ff5b6000805b600560ff821611610f9d5760ff81166000908152600c602052604090205461ffff169190910190600101612a58565b600054600160a060020a031681565b600354600090819081908190819081908190600160a060020a038a8116911614612b30576040805160e560020a62461bcd02815260206004820152602760248201527f65766572797468696e67206973207061696420776974682074656c65706f727460448201527f20746f6b656e7300000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b612b398861574c565b63ffffffff16600114612b4d576000612b50565b60015b9650861515612d6d57612b6288615753565b9550600160009054906101000a9004600160a060020a0316600160a060020a0316636121e5226040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015612bb757600080fd5b505af1158015612bcb573d6000803e3d6000fd5b505050506040513d6020811015612be157600080fd5b505163ffffffff8716600090815260096020526040902054909550600c60ff90911610801590612c2c575063ffffffff8616600090815260096020526040902054601460ff90911611155b15612c38576002850294505b848a1015612cb6576040805160e560020a62461bcd02815260206004820152603860248201527f696e737566666963696e657420616d6f756e74206f6620746f6b656e7320746f60448201527f2074656c65706f72742074686973206368617261637465720000000000000000606482015290519081900360840190fd5b600354604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a038e8116600483015230602483015260448201899052915191909216916323b872dd9160648083019260209291908290030181600087803b158015612d2b57600080fd5b505af1158015612d3f573d6000803e3d6000fd5b505050506040513d6020811015612d5557600080fd5b50511515612d5f57fe5b612d688661575a565b6132ae565b612d7688615753565b63ffffffff8116600090815260096020908152604080832054600154825160e060020a635e383d2102815260ff909216600483018190529251959b50919850600160a060020a0390911693635e383d2193602480840194938390030190829087803b158015612de457600080fd5b505af1158015612df8573d6000803e3d6000fd5b505050506040513d6020811015612e0e57600080fd5b505163ffffffff871660009081526009602052604090205461010090046001608060020a03908116911614612ed9576040805160e560020a62461bcd02815260206004820152605c60248201527f70726f74656374696f6e20636f756c6420626520626f75676874206f6e6c792060448201527f6265666f72652074686520666972737420666967687420616e64206265666f7260648201527f652074686520666972737420766f6c63616e6f206572757074696f6e00000000608482015290519081900360a40190fd5b600b60ff851611612f7c57600160009054906101000a9004600160a060020a0316600160a060020a03166319f353bb6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015612f3757600080fd5b505af1158015612f4b573d6000803e3d6000fd5b505050506040513d6020811015612f6157600080fd5b5051600660ff86160660010160ff16029250600391506131a6565b600c60ff851610801590612f945750600e60ff851611155b1561303757600160009054906101000a9004600160a060020a0316600160a060020a03166319f353bb6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015612fec57600080fd5b505af1158015613000573d6000803e3d6000fd5b505050506040513d602081101561301657600080fd5b505160066003860160ff160660010160ff16026002029250600691506131a6565b600f60ff85161080159061304f5750601460ff851611155b156130f257600160009054906101000a9004600160a060020a0316600160a060020a03166319f353bb6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156130a757600080fd5b505af11580156130bb573d6000803e3d6000fd5b505050506040513d60208110156130d157600080fd5b505160066003860160ff160660010160ff16026002029250600391506131a6565b601560ff85161080159061310a5750601a60ff851611155b156131a657600160009054906101000a9004600160a060020a0316600160a060020a03166319f353bb6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561316257600080fd5b505af1158015613176573d6000803e3d6000fd5b505050506040513d602081101561318c57600080fd5b505160066003860160ff160660010160ff16029250600391505b5063ffffffff851660009081526010602052604081205490945060ff165b8160ff168160ff161080156131e357508060010160ff16830285018a10155b156131fb5760010160ff8116830294909401936131c4565b600354604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a038e8116600483015230602483015260448201899052915191909216916323b872dd9160648083019260209291908290030181600087803b15801561327057600080fd5b505af1158015613284573d6000803e3d6000fd5b505050506040513d602081101561329a57600080fd5b505115156132a457fe5b6132ae868261590c565b5050505050505050505050565b600681565b601481565b6000600f5b601460ff821611610f9d5760ff81166000908152600c602052604090205461ffff1691909101906001016132ca565b6000600660ff8416108015906133135750600b60ff841611155b156133265750600560ff821611156133e6565b600f60ff84161080159061333e5750601460ff841611155b1561335f57600c60ff831610806133585750600e60ff8316115b90506133e6565b600060ff8416108015906133775750600560ff841611155b1561338a5750600f60ff821610156133e6565b601560ff8416108015906133a25750601a60ff841611155b156133e257600c60ff8316108015906133bf5750600e60ff831611155b806133585750600660ff831610801590613358575050600b60ff821611156133e6565b5060005b92915050565b601581565b600f6020526000908152604090205481565b600f81565b600060065b600b60ff821611610f9d5760ff81166000908152600c602052604090205461ffff16919091019060010161340d565b600d5481565b600581565b60008054600160a060020a0316331461345f57600080fd5b5060005b600b5461ffff9081169082161015613605576009600060078361ffff1681548110151561348c57fe5b6000918252602080832060088304015460079283166004026101000a900463ffffffff16845283019390935260409091018120600101548254600160a060020a03909116926108fc9260099290919061ffff87169081106134e957fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1663ffffffff1663ffffffff16815260200190815260200160002060000160019054906101000a90046001608060020a03166001608060020a03169081150290604051600060405180830381858888f19350505050158015613574573d6000803e3d6000fd5b506009600060078361ffff1681548110151561358c57fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff1683528201929092526040019020805470ffffffffffffffffffffffffffffffffff19168155600190810180547cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916905501613463565b61361160076000615baa565b50600b805461ffff19169055565b601a81565b600e81565b600033321461367f576040805160e560020a62461bcd02815260206004820152602480820152600080516020615be8833981519152604482015260e260020a631d1a1bd902606482015290519081900360840190fd5b603282111561368d57600080fd5b5060005b8181101561161c576136ba8383838181106136a857fe5b9050602002013563ffffffff1661375b565b600101613691565b60085460009064010000000090046001608060020a0316815b600b5461ffff9081169082161015613752576009600060078361ffff1681548110151561370457fe5b60009182526020808320600883040154600790921660040261010090810a90920463ffffffff1684528301939093526040909101902054046001608060020a031691909101906001016136db565b50303103919050565b600080803332146137b3576040805160e560020a62461bcd02815260206004820152602480820152600080516020615be8833981519152604482015260e260020a631d1a1bd902606482015290519081900360840190fd5b60085460006401000000009091046001608060020a03161161381f576040805160e560020a62461bcd02815260206004820152600e60248201527f656d707479207472656173757279000000000000000000000000000000000000604482015290519081900360640190fd5b63ffffffff841660009081526009602052604090208054909350601560ff9091161080159061385557508254601a60ff90911611155b15156138d1576040805160e560020a62461bcd02815260206004820152602b60248201527f6f6e6c7920617263686572732063616e2061636365737320746865206361737460448201527f6c65207472656173757279000000000000000000000000000000000000000000606482015290519081900360840190fd5b63ffffffff84166000908152600e60205260409020541515613a0557600160009054906101000a9004600160a060020a0316600160a060020a03166399bd59ee6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561394057600080fd5b505af1158015613954573d6000803e3d6000fd5b505050506040513d602081101561396a57600080fd5b5051600184015460a060020a900467ffffffffffffffff1642031015613a00576040805160e560020a62461bcd02815260206004820152602d60248201527f6e6f7420656e6f7567682074696d6520686173207061737365642073696e636560448201527f2074686520707572636861736500000000000000000000000000000000000000606482015290519081900360840190fd5b613b18565b600160009054906101000a9004600160a060020a0316600160a060020a03166399bd59ee6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015613a5857600080fd5b505af1158015613a6c573d6000803e3d6000fd5b505050506040513d6020811015613a8257600080fd5b505163ffffffff85166000908152600e602052604090205401421015613b18576040805160e560020a62461bcd02815260206004820152603e60248201527f6e6f7420656e6f7567682074696d65207061737365642073696e63652074686560448201527f206c61737420636173746c65206c6f6f7420646973747269627574696f6e0000606482015290519081900360840190fd5b6001830154600360e060020a90910460ff161015613b80576040805160e560020a62461bcd02815260206004820152601560248201527f6e65656420746f20666967687420332074696d65730000000000000000000000604482015290519081900360640190fd5b63ffffffff84166000818152600e6020526040902042905560018401805460e060020a60ff0219169055613bca906103e890613bbb90614f98565b811515613bc457fe5b0661596e565b91506003826001608060020a03161015613be357600391505b60326001608060020a0383161115613bf757fe5b6008546064906001608060020a03640100000000909104811684021684546001608060020a03610100808304821694909304938401811690920270ffffffffffffffffffffffffffffffff001990911617855560088054640100000000808204841685900384160273ffffffffffffffffffffffffffffffff000000001990911617905560408051828416815263ffffffff8816602082015291851682820152519192507f044748c9c1d4b639839f14eae2bf0670989e54a214f284e8713a6bce527b656f919081900360600190a150505050565b606060008060008060006032604051908082528060200260200182016040528015613d01578160200160208202803883390190505b50600b5490965061ffff169150600090505b8161ffff168161ffff16101561428a5733600160a060020a03166009600060078461ffff16815481101515613d4457fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff168352820192909252604001902060010154600160a060020a0316148015613df45750426009600060078461ffff16815481101515613da357fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190206001015460a060020a900467ffffffffffffffff908116620151800116105b8015613ea85750600c60ff166009600060078461ffff16815481101515613e1757fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190205460ff161080613ea85750600e60ff166009600060078461ffff16815481101515613e7057fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190205460ff16115b15614282575b60008261ffff16118015613f22575033600160a060020a03166009600060076001860361ffff16815481101515613ee157fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff168352820192909252604001902060010154600160a060020a0316145b8015613f955750426009600060076001860361ffff16815481101515613f4457fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190206001015460a060020a900467ffffffffffffffff908116620151800116105b80156140495750600c60ff166009600060078461ffff16815481101515613fb857fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190205460ff1610806140495750600e60ff166009600060078461ffff1681548110151561401157fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190205460ff16115b1561419c57600780546000199093019261ffff841690811061406757fe5b60009182526020808320600883040154600790921660040261010090810a90920463ffffffff1680845260098083526040808620805460ff9081168852600c8652918720805461ffff19811661ffff9182166000190190911617905595839052925292548951939750919091046001608060020a031694909401938591889188169081106140f157fe5b63ffffffff9283166020918202909201015260085460019096019585821660a860020a9091049091161415614143576008805478ffffffff000000000000000000000000000000000000000000191690555b63ffffffff84166000908152600960205260409020805470ffffffffffffffffffffffffffffffffff1916815560010180547cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19169055613eae565b8060010161ffff168261ffff161115614282576009600060078361ffff168154811015156141c657fe5b60009182526020808320600883040154600792831660040261010090810a90910463ffffffff16855290840194909452604090920190205481549290046001608060020a031694909401939061ffff831690811061422057fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff16868660ff1681518110151561425757fe5b63ffffffff90921660209283029091019091015260019094019360001990910190614282818361453e565b600101613d13565b600b805461ffff191661ffff84161790556040805133808252602080830187905260609383018481528a519484019490945289517f1e6d26af567145cb0b46ea7135e21671f1e58e8d1f818dab12b0e10eb5ebb07b94929388938c93919290916080840191858201910280838360005b838110156143125781810151838201526020016142fa565b5050505090500194505050505060405180910390a1604051339084156108fc029085906000818181858888f19350505050158015614354573d6000803e3d6000fd5b5060085460a860020a900463ffffffff1615156143735761437361440a565b505050505050565b600081565b600b5461ffff1681565b600054600160a060020a031633146143a157600080fd5b612a2c816159ea565b600054600160a060020a031633146143c157600080fd5b80600160a060020a0316ff5b601b81565b60078054829081106143e057fe5b9060005260206000209060089182820401919006600402915054906101000a900463ffffffff1681565b60001960005b600b5461ffff9081169082161015614505578163ffffffff1660078261ffff1681548110151561443c57fe5b6000918252602090912060088204015460079091166004026101000a900463ffffffff161080156144bd5750600560ff166009600060078461ffff1681548110151561448457fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190205460ff1611155b156144fd576007805461ffff83169081106144d457fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1691505b600101614410565b506008805463ffffffff90921660a860020a0278ffffffff00000000000000000000000000000000000000000019909216919091179055565b600060078361ffff1681548110151561455357fe5b6000918252602080832060088084049091015460079093166004026101000a90920463ffffffff9081168085526009835260408086205460ff168652600c90935291909320805461ffff19811661ffff91821660001901909116179055905490925060a860020a9004168114156145e7576008805478ffffffff000000000000000000000000000000000000000000191690555b63ffffffff81166000908152600960205260409020805470ffffffffffffffffffffffffffffffffff1916815560010180547cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690556007805461ffff841690811061464d57fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1660078461ffff1681548110151561468657fe5b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908363ffffffff16021790555060078261ffff168154811015156146cc57fe5b90600052602060002090600891828204019190066004026101000a81549063ffffffff0219169055505050565b6000806000806000600160009054906101000a9004600160a060020a0316600160a060020a03166349b3b29f876040518263ffffffff1660e060020a028152600401808260ff168152602001915050602060405180830381600087803b15801561476257600080fd5b505af1158015614776573d6000803e3d6000fd5b505050506040513d602081101561478c57600080fd5b50516001608060020a0316348115156147a157fe5b049450600061ffff86161161484c576040805160e560020a62461bcd02815260206004820152604260248201527f696e73756666696369656e7420616d6f756e74206f6620657468657220746f2060448201527f7075726368617365206120676976656e2074797065206f66206368617261637460648201527f6572000000000000000000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b600b54600154604080517f49e77c8b000000000000000000000000000000000000000000000000000000008152600160a060020a038b8116600483015260ff8b166024830152915161ffff90941697509116916349e77c8b916044808201926020929091908290030181600087803b1580156148c757600080fd5b505af11580156148db573d6000803e3d6000fd5b505050506040513d60208110156148f157600080fd5b50511515614995576040805160e560020a62461bcd02815260206004820152604360248201527f696e737566666963696e657420616d6f756e74206f6620746f6b656e7320746f60448201527f207075726368617365206120676976656e2074797065206f662063686172616360648201527f7465720000000000000000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b601b60ff8716101580614a445750600154604080517f49b3b29f00000000000000000000000000000000000000000000000000000000815260ff891660048201529051600160a060020a03909216916349b3b29f916024808201926020929091908290030181600087803b158015614a0c57600080fd5b505af1158015614a20573d6000803e3d6000fd5b505050506040513d6020811015614a3657600080fd5b50516001608060020a031634105b80614ad75750600160009054906101000a9004600160a060020a0316600160a060020a0316638882ddc96040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015614a9d57600080fd5b505af1158015614ab1573d6000803e3d6000fd5b505050506040513d6020811015614ac757600080fd5b505161ffff908116858701909116115b15614ae157600080fd5b60085463ffffffff169250600560ff871611614d655760085460a860020a900463ffffffff161580614b22575060085460a860020a900463ffffffff908116145b15614b58576008805478ffffffff000000000000000000000000000000000000000000191660a860020a63ffffffff8616021790555b600091505b8461ffff168260ff161015614d2257614b7e60ff8316848101908601615a67565b6040805160a08101825260ff8816808252600154835160e060020a635e383d21028152600481019290925292519192602080850193600160a060020a0390921692635e383d2192602480830193928290030181600087803b158015614be257600080fd5b505af1158015614bf6573d6000803e3d6000fd5b505050506040513d6020811015614c0c57600080fd5b50516001608060020a039081168252600160a060020a038a81166020808501919091524267ffffffffffffffff9081166040808701919091526000606096870181905260ff8a81168c0163ffffffff168252600985529082902088518154958a015160ff199096169083161770ffffffffffffffffffffffffffffffff0019166101009590971694909402959095178355860151600192830180549688015160809098015173ffffffffffffffffffffffffffffffffffffffff1990971691909416177bffffffffffffffff0000000000000000000000000000000000000000191660a060020a96909116959095029490941760e060020a60ff02191660e060020a939092169290920217905590910190614b5d565b60ff86166000908152600c60205260409020805461ffff1980821661ffff9283168901831617909255600b80549283169282168801909116919091179055614f19565b5060005b8461ffff168160ff161015614f19576040805160a08101825260ff8816808252600154835160e060020a635e383d21028152600481019290925292519192602080850193600160a060020a0390921692635e383d2192602480830193928290030181600087803b158015614ddc57600080fd5b505af1158015614df0573d6000803e3d6000fd5b505050506040513d6020811015614e0657600080fd5b50516001608060020a039081168252600160a060020a038a81166020808501919091524267ffffffffffffffff9081166040808701919091526000606096870181905260ff8981168c0163ffffffff168252600985529082902088518154958a015160ff199096169083161770ffffffffffffffffffffffffffffffff0019166101009590971694909402959095178355860151600192830180549688015160809098015173ffffffffffffffffffffffffffffffffffffffff1990971691909416177bffffffffffffffff0000000000000000000000000000000000000000191660a060020a96909116959095029490941760e060020a60ff02191660e060020a939092169290920217905501614d69565b6008805463ffffffff191661ffff871685810163ffffffff9081169290921790925560408051600160a060020a038b16815260ff8a166020820152808201939093529085166060830152517ff7ad76543f114c7bb00ff2cd992ff749d502ed5c0c6f87901ad48f6871fceca1916080908290030190a150505050505050565b600b546040805160001943014081524260208201527e0100000000000000000000000000000000000000000000000000000000000061ffff90931692909202828201526042820183905251908190036062019020919050565b600080600060078661ffff1681548110151561500957fe5b6000918252602090912060088204015460079091166004026101000a900463ffffffff16915060019050600f60ff85161080159061504b5750601460ff851611155b15615054575060025b63ffffffff821660009081526010602052604090205460ff8083169116106150a65763ffffffff82166000908152601060205260408120805460ff8082168590031660ff199091161790559250615112565b6009600060078861ffff168154811015156150bd57fe5b60009182526020808320600883040154600790921660040261010090810a90920463ffffffff16845283019390935260409091019020546000199690960195046001608060020a03169250615112868661453e565b50509392505050565b600880546401000000008082046001608060020a0390811660148683160401160273ffffffffffffffffffffffffffffffff0000000019909116179081905560009081908190606090829081908190819063ffffffff60a860020a9091041615156151885761518861440a565b60085460a860020a900463ffffffff908116146152055760085460a860020a900463ffffffff166000908152600960205260409020805470ffffffffffffffffffffffffffffffff00198116600a6001608060020a038d811691820461010094859004821601169092021790915560556064909104029750615218565b60646001608060020a038a1604605f0297505b60408051601b8082526103808201909252909650866020820161036080388339019050509450600093505b8560ff168460ff16101561531b57600c60ff851610806152665750600e60ff8516115b8015615286575060ff84166000908152600c602052604081205461ffff16115b15615310576001546040805160e060020a635e383d2102815260ff871660048201529051600160a060020a0390921691635e383d21916024808201926020929091908290030181600087803b1580156152de57600080fd5b505af11580156152f2573d6000803e3d6000fd5b505050506040513d602081101561530857600080fd5b505196909601955b600190930192615243565b600092505b8560ff168360ff16101561546457600c60ff851610806153435750600e60ff8516115b8015615363575060ff83166000908152600c602052604081205461ffff16115b156154595760ff83166000818152600c6020908152604080832054600154825160e060020a635e383d210281526004810196909652915161ffff909116946001608060020a038d1694600160a060020a0390931693635e383d219360248084019492938390030190829087803b1580156153dc57600080fd5b505af11580156153f0573d6000803e3d6000fd5b505050506040513d602081101561540657600080fd5b50518a026001608060020a031681151561541c57fe5b046001608060020a031681151561542f57fe5b04858460ff1681518110151561544157fe5b6001608060020a039092166020928302909101909101525b600190920191615320565b5060005b600b5461ffff90811690821610156155d1576009600060078361ffff1681548110151561549157fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190205460ff169150600c8210806154db5750600e60ff8316115b156155c957846009600060078461ffff168154811015156154f857fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff168352820192909252604001902054815160ff90911690811061553b57fe5b906020019060200201516009600060078461ffff1681548110151561555c57fe5b60009182526020808320600883040154600790921660040261010090810a90920463ffffffff16845283019390935260409091019020805470ffffffffffffffffffffffffffffffff00198116908390046001608060020a03908116949094019093169091029190911790555b600101615468565b505050505050505050565b600b5460009081908190819061ffff166155f587614f98565b8115156155fe57fe5b600b549190069350600761ffff91821606161561561c57600761563a565b600b805461ffff160661ffff1660001461563757600b61563a565b600d5b60ff1691508290505b615699856009600060078561ffff1681548110151561565e57fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190205460ff166132f9565b8015615703575033600160a060020a03166009600060078461ffff168154811015156156c157fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff168352820192909252604001902060010154600160a060020a031614155b1561571057809350615743565b600b5461ffff908116908284011681151561572757fe5b06905061ffff8082169084161461573d57615643565b60001993505b50505092915050565b5060c05190565b5060a05190565b63ffffffff81166000908152600a602052604081205460ff16156157c8576040805160e560020a62461bcd02815260206004820152601260248201527f616c72656164792074656c65706f727465640000000000000000000000000000604482015290519081900360640190fd5b5063ffffffff81166000908152600a60209081526040808320805460ff19166001179055600990915290208054600560ff9190911611615877576040805160e560020a62461bcd028152602060048201526024808201527f647261676f6e7320646f206e6f74206e65656420746f2062652074656c65706f60448201527f7274656400000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600b5461588990839061ffff16615a67565b600b805461ffff8082166001908101821661ffff1993841617909355835460ff166000908152600c6020908152604091829020805480851690960190931694909316939093179055815163ffffffff8516815291517f663f46f5a2fd740de613966ad0391fbc9d840f82898698e6d7f16ba0ed126b3b9281900390910190a15050565b63ffffffff8216600081815260106020908152604091829020805460ff191660ff861690811790915582519384529083015280517f088ba7785fd329abbf01eaa732bad30e14b205b9fc8ab9378f9f5295731135559281900390910190a15050565b60326000805b60085460ff60a060020a909104811690821610156159e3576159bb6103e86159ac8360070260ff1687016001608060020a0316614f98565b8115156159b557fe5b06615b1d565b9150826001608060020a0316826001608060020a031610156159db578192505b600101615974565b5050919050565b600160a060020a03811615156159ff57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60075461ffff82161015615ac1578160078261ffff16815481101515615a8957fe5b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908363ffffffff160217905550610efa565b506007805460018101825560008290527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68860088204018054919092166004026101000a63ffffffff818102199092169390911602919091179055565b6000806001602d5b60036001608060020a03821610615b7d57846001608060020a0316836001608060020a03161115615b5857809350615b82565b9181019160236001608060020a03821614615b74576001820191505b60001901615b25565b600393505b505050919050565b61014060405190810160405280600a906020820280388339509192915050565b508054600082556007016008900490600052602060002090810190612a2c9190615be491905b80821115610f9d5760008155600101615bd0565b905600636f6e7472616374732063616e6e6f7420657865637574652074686973206d65a165627a7a7230582080e8fd5bc97d6b4e084a99ef89ea1307fe7a00ef51b4c0ca428acf24d5c9e62900290000000000000000000000008a01bc6a9358388588247127ff7be21b281b36d4000000000000000000000000ee7acd6b0fb65eebc11cf733fdc606619cf633d4000000000000000000000000d22d680d1fa045a07e8d335c1bb815ebfc4d4e5e000000000000000000000000822afedd7d48ed1056247747c8ed6df7f02b50fc0000000000000000000000007605e92eb5826eb3ce4358c3118fb33362ec0b62000000000000000000000000cea356a0dd37d65945b279e6afa3e40994fe76cb

    Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000008a01bc6a9358388588247127ff7be21b281b36d4000000000000000000000000ee7acd6b0fb65eebc11cf733fdc606619cf633d4000000000000000000000000d22d680d1fa045a07e8d335c1bb815ebfc4d4e5e000000000000000000000000822afedd7d48ed1056247747c8ed6df7f02b50fc0000000000000000000000007605e92eb5826eb3ce4358c3118fb33362ec0b62000000000000000000000000cea356a0dd37d65945b279e6afa3e40994fe76cb

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000008a01bc6a9358388588247127ff7be21b281b36d4
Arg [1] : 000000000000000000000000ee7acd6b0fb65eebc11cf733fdc606619cf633d4
Arg [2] : 000000000000000000000000d22d680d1fa045a07e8d335c1bb815ebfc4d4e5e
Arg [3] : 000000000000000000000000822afedd7d48ed1056247747c8ed6df7f02b50fc
Arg [4] : 0000000000000000000000007605e92eb5826eb3ce4358c3118fb33362ec0b62
Arg [5] : 000000000000000000000000cea356a0dd37d65945b279e6afa3e40994fe76cb


   Swarm Source:
bzzr://80e8fd5bc97d6b4e084a99ef89ea1307fe7a00ef51b4c0ca428acf24d5c9e629

 

View All
Block Age transaction Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward