Latest 25 transactions from a total of 138 transactions

TxHash Age From To Value [TxFee]
0x508cbc88e07dcfc48f5eb376a0f580b4230c4650ed36c55d41f0ffb3670d818a150 days 15 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0 Ether0.000256456
0x5a10b9929486d99988a8c2d48f9f79f03d73514e6929320c40ccd6d2c8aeed25152 days 14 hrs ago0x24def1747d6e244018ae54d475862593284bad7f  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0.1 Ether0.0005740215
0x78493adc112857598bcaaf2526a47d27347fd5b9cddcebdd362d1ac191a7957f152 days 14 hrs ago0x24def1747d6e244018ae54d475862593284bad7f  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0.05 Ether0.0005749965
0x24e6c62d7247edc70e50b024211955718df0dcb60edce7861199e1b4989edfaf152 days 14 hrs ago0x24def1747d6e244018ae54d475862593284bad7f  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0.01 Ether0.0005749965
0x8b21ff8615f2053d8a8d76951ac4704c53331f1fd9b892c794bf91c2f73ea814152 days 14 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0.02 Ether0.0002397135
0x61b59c739b47ce012bcb16b349fe80cf05a4f058741b29b93e28c0b28b8af679152 days 14 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0.05 Ether0.0002403635
0x2431b43015f06819a52d8d75e7c2f81e4fa7288bc84803fb407316a4ef81cf4b152 days 14 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0.01 Ether0.0002403635
0xab0763b6b40184fad96218cfdb892bb11deee6c0710f0723ffa9c926de56e16e152 days 14 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0.01 Ether0.0002403635
0x03ca78a9746cc3a16f659ae43fc9e9a070d9c767a33c613b1588e6419b446e8c152 days 14 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0 Ether0.0006479185
0xe99f2d8cf5a047c17bffab33377fdca142e10dc2fce92a082d9e9dd4c1767077152 days 14 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0 Ether0.0003690169
0x933fd8f4afa81626335ef477c901556893ed50c9cd721bfc00dfeda99c749f05152 days 18 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0 Ether0.00026396
0x466287bef1b77057c18daa2d97f7ce6e15fd17a2937fe2984eda52ae7ec989c1152 days 19 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0 Ether0.0002863665
0x06043d7da74aaab3a19085bfc06a266cf1e07405b42c3ef8dc27e57ae393cd49152 days 19 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0 Ether0.000353349
0x49b40eba6655c8ce610c7ece73ccb3a2173e6d285c65b965e58e4e2f9ecda3ba152 days 19 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0 Ether0.0001147275
0x2f390246affc1918dfff93a8ceff5bb6b7569c7fafcd2647dc6c1d809d6a180c152 days 20 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0 Ether0.0002057168
0x0e17318f6fab6dffb7b770f80f15957a3d84ae353169757a01882f45207827cf152 days 21 hrs ago0x24def1747d6e244018ae54d475862593284bad7f  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0 Ether0.000348564
0xa46ef60c5331d6eda0388f5ef5dccd590e0abc4a4ec8d5a75e3987cef7e1a23a152 days 21 hrs ago0x24def1747d6e244018ae54d475862593284bad7f  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0.5 Ether0.002453196
0x1c50fd4d6e1d3e0de5a7a3706cdf6d27903f9d5f7800567b33257e0f1f68a672153 days 14 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0 Ether0.00039804
0xe21fb8e36b6db67d5ed69eb42c3f5539b1ed9c3f86d51d6339f652a39455b778153 days 14 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0 Ether0.0003060666
0xc3735894f5325bfe3682497e5f50f956f3746a0fd956250c4e045ac497de64cd153 days 14 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0 Ether0.000500562
0x05360a62dae9e011d14ac7150d53e171378d124756427137ba047eb92d6e7e0b153 days 14 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0.01 Ether0.000221874
0xc5b5d3c18edf0234fbd5b0e11d7365df2ed2f79c44a1740d967349b638004fb6153 days 15 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0 Ether0.000506724
0xfb9467d9ee585b53918121a14a8c2f45af0400f06bea50791819b0e5da7af4d5153 days 15 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0.05 Ether0.00062595
0x80e4717b2c6d0104ebaacbd021159b3f5180df662b186a9df052ed10492a2d09153 days 15 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0.05 Ether0.00062595
0x3a55ee3cedb53f6dd7579b9a335088f1d513bcfdf4651208b54fd218022accb5153 days 15 hrs ago0x1659acf7231739825c900e0caadd37aca5d272ab  IN   0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0.05 Ether0.000787215
[ 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
0x508cbc88e07dcfc48f5eb376a0f580b4230c4650ed36c55d41f0ffb3670d818a3895642150 days 15 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xd22d680d1fa045a07e8d335c1bb815ebfc4d4e5e0 Ether
0x508cbc88e07dcfc48f5eb376a0f580b4230c4650ed36c55d41f0ffb3670d818a3895642150 days 15 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0x822afedd7d48ed1056247747c8ed6df7f02b50fc0 Ether
0x508cbc88e07dcfc48f5eb376a0f580b4230c4650ed36c55d41f0ffb3670d818a3895642150 days 15 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xd22d680d1fa045a07e8d335c1bb815ebfc4d4e5e0 Ether
0x508cbc88e07dcfc48f5eb376a0f580b4230c4650ed36c55d41f0ffb3670d818a3895642150 days 15 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0x822afedd7d48ed1056247747c8ed6df7f02b50fc0 Ether
0x508cbc88e07dcfc48f5eb376a0f580b4230c4650ed36c55d41f0ffb3670d818a3895642150 days 15 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xc21013e6743c7e66170b463ff3a5e322760593460 Ether
0x5a10b9929486d99988a8c2d48f9f79f03d73514e6929320c40ccd6d2c8aeed253881810152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xc21013e6743c7e66170b463ff3a5e322760593460 Ether
0x5a10b9929486d99988a8c2d48f9f79f03d73514e6929320c40ccd6d2c8aeed253881810152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0x822afedd7d48ed1056247747c8ed6df7f02b50fc0 Ether
0x5a10b9929486d99988a8c2d48f9f79f03d73514e6929320c40ccd6d2c8aeed253881810152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xd22d680d1fa045a07e8d335c1bb815ebfc4d4e5e0 Ether
0x5a10b9929486d99988a8c2d48f9f79f03d73514e6929320c40ccd6d2c8aeed253881810152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xc21013e6743c7e66170b463ff3a5e322760593460 Ether
0x5a10b9929486d99988a8c2d48f9f79f03d73514e6929320c40ccd6d2c8aeed253881810152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xc21013e6743c7e66170b463ff3a5e322760593460 Ether
0x5a10b9929486d99988a8c2d48f9f79f03d73514e6929320c40ccd6d2c8aeed253881810152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xc21013e6743c7e66170b463ff3a5e322760593460 Ether
0x78493adc112857598bcaaf2526a47d27347fd5b9cddcebdd362d1ac191a7957f3881810152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xc21013e6743c7e66170b463ff3a5e322760593460 Ether
0x78493adc112857598bcaaf2526a47d27347fd5b9cddcebdd362d1ac191a7957f3881810152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0x822afedd7d48ed1056247747c8ed6df7f02b50fc0 Ether
0x78493adc112857598bcaaf2526a47d27347fd5b9cddcebdd362d1ac191a7957f3881810152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xd22d680d1fa045a07e8d335c1bb815ebfc4d4e5e0 Ether
0x78493adc112857598bcaaf2526a47d27347fd5b9cddcebdd362d1ac191a7957f3881810152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xc21013e6743c7e66170b463ff3a5e322760593460 Ether
0x78493adc112857598bcaaf2526a47d27347fd5b9cddcebdd362d1ac191a7957f3881810152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xc21013e6743c7e66170b463ff3a5e322760593460 Ether
0x78493adc112857598bcaaf2526a47d27347fd5b9cddcebdd362d1ac191a7957f3881810152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xc21013e6743c7e66170b463ff3a5e322760593460 Ether
0x24e6c62d7247edc70e50b024211955718df0dcb60edce7861199e1b4989edfaf3881810152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xc21013e6743c7e66170b463ff3a5e322760593460 Ether
0x24e6c62d7247edc70e50b024211955718df0dcb60edce7861199e1b4989edfaf3881810152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0x822afedd7d48ed1056247747c8ed6df7f02b50fc0 Ether
0x24e6c62d7247edc70e50b024211955718df0dcb60edce7861199e1b4989edfaf3881810152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xd22d680d1fa045a07e8d335c1bb815ebfc4d4e5e0 Ether
0x24e6c62d7247edc70e50b024211955718df0dcb60edce7861199e1b4989edfaf3881810152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xc21013e6743c7e66170b463ff3a5e322760593460 Ether
0x24e6c62d7247edc70e50b024211955718df0dcb60edce7861199e1b4989edfaf3881810152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xc21013e6743c7e66170b463ff3a5e322760593460 Ether
0x24e6c62d7247edc70e50b024211955718df0dcb60edce7861199e1b4989edfaf3881810152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xc21013e6743c7e66170b463ff3a5e322760593460 Ether
0x8b21ff8615f2053d8a8d76951ac4704c53331f1fd9b892c794bf91c2f73ea8143881803152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0x822afedd7d48ed1056247747c8ed6df7f02b50fc0 Ether
0x8b21ff8615f2053d8a8d76951ac4704c53331f1fd9b892c794bf91c2f73ea8143881803152 days 14 hrs ago0xe1152f5563f0609bad6a1f7bf2bfaadc8f7dc3fc0xd22d680d1fa045a07e8d335c1bb815ebfc4d4e5e0 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 Text: 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.23;


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


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


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


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


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

}


/**
 * @title Destructible
 * @dev Base contract that can be destroyed by owner. All funds in contract will be sent to the owner.
 */
contract Destructible is Ownable {

  function Destructible() public payable { }

  /**
   * @dev Transfers the current balance to the owner and terminates the contract.
   */
  function destroy() onlyOwner public {
    selfdestruct(owner);
  }

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

contract DragonKingConfig is Ownable {

  constructor(uint8 characterFee, uint8 eruptionThresholdInHours, uint8 percentageOfCharactersToKill, uint128[] charactersCosts) 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
    percentageToKill = percentageOfCharactersToKill;
    maxCharacters = 600;
    teleportPrice = 1000000000000000000;
    protectionPrice = 1000000000000000000;
    fightFactor = 4;
  }

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

	/**
	 * 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 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 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;
  }
}

interface Token {
  function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
  function transfer(address _to, uint256 _value) external returns (bool success);
  function balanceOf(address who) external view returns (uint256);
}


contract DragonKing is Destructible {

  /**
   * @dev Throws if called by contract not a user 
   */
  modifier onlyUser() {
    require(msg.sender == tx.origin);
    _;
  }


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

  DragonKingConfig public config;

  /** the neverdue token contract used to purchase protection from eruptions and fights */
  Token public neverdieToken;
  /** the teleport token contract used to send knights to the game scene */
  Token public teleportToken;

  /** the SKL token contract **/
  Token public sklToken;
  /** the XP token contract **/
  Token public 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 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;

  /** timestampt of the last eruption event **/
  uint256 public lastEruptionTimestamp;

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

  /** minimum amount of XPER and SKL to purchase wizards **/
  uint8 public MIN_XPER_AMOUNT_TO_PURCHASE_WIZARD = 100;
  uint8 public MIN_SKL_AMOUNT_TO_PURCHASE_WIZARD = 50;

  /** minimum amount of XPER and SKL to purchase archer **/
  uint8 public MIN_XPER_AMOUNT_TO_PURCHASE_ARCHER = 10;
  uint8 public MIN_SKL_AMOUNT_TO_PURCHASE_ARCHER = 5;

    /** 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);

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

  /**
   * 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 {
    require(tx.origin == msg.sender);
    uint16 amount = uint16(msg.value / config.costs(characterType));
    uint16 nchars = numCharacters;
    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), msg.sender, uint64(now));
      }
      numCharactersXType[characterType] += amount;
      numCharacters += amount;
    }
    else {
      uint256 amountSKL = sklToken.balanceOf(msg.sender);
      uint256 amountXPER = xperToken.balanceOf(msg.sender);
      if (characterType >= WIZARD_MIN_TYPE && characterType <= WIZARD_MAX_TYPE) {
        require(amountSKL >= MIN_SKL_AMOUNT_TO_PURCHASE_WIZARD && amountXPER >= MIN_XPER_AMOUNT_TO_PURCHASE_WIZARD);
      }
      if (characterType >= ARCHER_MIN_TYPE && characterType <= ARCHER_MAX_TYPE) {
        require(amountSKL >= MIN_SKL_AMOUNT_TO_PURCHASE_ARCHER && amountXPER >= MIN_XPER_AMOUNT_TO_PURCHASE_ARCHER);
      }
      // 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), msg.sender, uint64(now));
      }
    }
    nextId = nid + amount;
    emit NewPurchase(msg.sender, 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());
    require(numCharacters>0);
    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);
    uint8 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 (characterID != ids[characterIndex])
      characterIndex = getCharacterIndex(characterID);
    Character storage character = characters[characterID];
    require(cooldown[characterID] + config.CooldownThreshold() <= now);
    require(character.owner == msg.sender);

    uint8 ctype = character.characterType;
    require(ctype < BALLOON_MIN_TYPE || ctype > BALLOON_MAX_TYPE); // character is not a balloon

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

    Character storage adversary = characters[adversaryID];
    uint128 value;
    uint16 base_probability;
    uint16 dice = uint16(generateRandomNumber(characterID) % 100);
    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 (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--;
        }
        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
      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);
    }
    cooldown[characterID] = now;
  }

  /*
  * @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;
    if (oldest == 0)
      findOldest();
    if (oldest != noKing) {
      //pay 10% to the oldest dragon
      characters[oldest].value += totalAmount / 10;
      amount  = totalAmount / 10 * 9;
    } else {
      amount  = totalAmount;
    }
    //distribute the rest according to their type
    uint128 valueSum;
    uint8 size = ARCHER_MAX_TYPE;
    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);
    assert(neverdieToken.transfer(owner, ndcBalance));
    uint256 tptBalance = teleportToken.balanceOf(this);
    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();
  }

  /* @dev distributes castle loot among archers */
  function distributeCastleLoot() external onlyUser {
    uint128 luckFactor = uint128(generateRandomNumber(now) % 51);
    if (luckFactor < 5) {
      luckFactor = 5;
    }
    uint128 amount = castleTreasury * luckFactor / 100; 
    uint128 valueSum;
    uint128[] memory shares = new uint128[](NUMBER_OF_LEVELS);
    uint16 archersCount;
    uint32[] memory archers = new uint32[](numCharacters);

    uint8 cType;
    for (uint8 i = 0; i < ids.length; i++) {
      cType = characters[ids[i]].characterType; 
      if ((cType >= ARCHER_MIN_TYPE && cType <= ARCHER_MAX_TYPE) && (uint64(now) - characters[ids[i]].purchaseTimestamp >= uint64(7 days))) {
        valueSum += config.values(cType);
        archers[archersCount] = ids[i];
        archersCount++;
      }
    }

    if (valueSum > 0) {
      for (uint8 j = 0; j < NUMBER_OF_LEVELS; j++) {
          shares[j] = amount * config.values(ARCHER_MIN_TYPE + j) / valueSum;
      }

      for (uint16 k = 0; k < archersCount; k++) {
        characters[ids[k]].value += shares[characters[archers[k]].characterType - ARCHER_MIN_TYPE];
      }
      castleTreasury -= amount;
      emit NewDistributionCastleLoot(amount);
    } else {
      emit NewDistributionCastleLoot(0);
    }
  }

  /**
   * 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) public onlyUser {
    require(msg.sender == characters[characterId].owner);
    require(characters[characterId].characterType < BALLOON_MIN_TYPE || characters[characterId].characterType > BALLOON_MAX_TYPE);
    require(characters[characterId].purchaseTimestamp + 1 days < now);
    uint128 val = characters[characterId].value;
    numCharacters--;
    replaceCharacter(getCharacterIndex(characterId), 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 {
    uint32 id;
    uint256 price;
    if (msg.sender == address(teleportToken)) {
      id = toUint32(callData);
      price = config.teleportPrice();
      if (characters[id].characterType >= BALLOON_MIN_TYPE && characters[id].characterType <= WIZARD_MAX_TYPE) {
        price *= 2;
      }
      require(value >= price);
      assert(teleportToken.transferFrom(sender, this, price));
      teleportKnight(id);
    } else if (msg.sender == address(neverdieToken)) {
      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));

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

      uint256 lifePrice;
      uint8 max;
      if(cType <= KNIGHT_MAX_TYPE || (cType >= ARCHER_MIN_TYPE && cType <= ARCHER_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;
      }

      price = 0;
      uint8 i = protection[id];
      for (i; i < max && value >= price + lifePrice * (i + 1); i++) {
        price += lifePrice * (i + 1);
      }
      assert(neverdieToken.transferFrom(sender, this, price));
      protectCharacter(id, i);
    } else {
      revert("Should be either from Neverdie or Teleport tokens");
    }
  }

  /**
   * knights are only entering the game completely, when they are teleported to the scene
   * @param id the character id
   * */
  function teleportKnight(uint32 id) internal {
    // ensure we do not teleport twice
    require(teleported[id] == false);
    teleported[id] = true;
    Character storage knight = characters[id];
    require(knight.characterType > DRAGON_MAX_TYPE); //this also makes calls with non-existent ids fail
    addCharacter(id, numCharacters);
    numCharacters++;
    numCharactersXType[knight.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);
  }


  /****************** 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 = 0;
    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);
  }
}

    Contract ABI  
[{"constant":false,"inputs":[],"name":"stop","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"characterId","type":"uint32"}],"name":"sellCharacter","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":"xperToken","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","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":"MIN_XPER_AMOUNT_TO_PURCHASE_WIZARD","outputs":[{"name":"","type":"uint8"}],"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":true,"inputs":[{"name":"","type":"uint32"}],"name":"protection","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":false,"inputs":[],"name":"distributeCastleLoot","outputs":[],"payable":false,"stateMutability":"nonpayable","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":"teleportToken","outputs":[{"name":"","type":"address"}],"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":"sklToken","outputs":[{"name":"","type":"address"}],"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":"MIN_SKL_AMOUNT_TO_PURCHASE_WIZARD","outputs":[{"name":"","type":"uint8"}],"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":"MIN_XPER_AMOUNT_TO_PURCHASE_ARCHER","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"neverdieToken","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","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":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":true,"inputs":[],"name":"MIN_SKL_AMOUNT_TO_PURCHASE_ARCHER","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","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":"_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"}],"name":"NewDistributionCastleLoot","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
6080604052600d8054606460ff199091161761ff0019166132001762ff00001916620a00001763ff0000001916630500000017905534801561004057600080fd5b5060405160a080614f78833981016040908152815160208301519183015160608401516080909401516000805433600160a060020a03199182161782556007805463ffffffff19166001908117909155600380548316600160a060020a0397881617905560028054831697871697909717909655600480548216948616949094179093556005805484169685169690961790955583549091169116179055614e8a9081906100ee90396000f30060806040526004361061028f5763ffffffff60e060020a60003504166307da68f581146102945780630fa6002e146102ab5780631d2a6dcf146102c95780631e466eee146102f55780632345fe811461030a57806326bdce711461033b57806328acb00214610366578063291ed7731461038757806329b20bb6146103b857806330aaed53146103d35780633728bec2146103e85780633c3c22b3146104395780633ccfd60b146104675780634afe49c21461047c5780634f255b8014610491578063537e9636146104af578063603709e3146104c457806361b8ce8c1461059d57806372ad21c7146105b2578063773e1e84146105d057806379502c55146105f5578063797e2aec1461060a57806383197ef014610618578063851ad4d61461062d5780638da5cb5b146106425780638f4ffcb1146106575780639271a988146106c75780639c73048b146106dc5780639ced242b146106f1578063a050d07d14610706578063a7f879ea1461071b578063a9689b4f146106c7578063ad389d5d14610730578063ad70ae1a14610765578063b066ef3c1461077a578063b0eee8db146107aa578063b2a7239d146107bf578063b32dbcd8146107d4578063b37c2e39146107e9578063c10435cc146107fe578063c125529914610813578063c205240314610828578063c7d0749e1461083d578063cfedc04a14610852578063d0f9bad114610867578063d39512b81461087c578063db8d55f114610891578063dc9bb7db146108a6578063e6dcae76146108bb578063e9fad8ee146108d0578063f10e2ec1146108e5578063f1be42f1146108fa578063f2fde38b1461090f578063f5074f4114610930578063f690648d14610951578063fac333ac14610966578063fbe6529f1461097e575b600080fd5b3480156102a057600080fd5b506102a9610993565b005b3480156102b757600080fd5b506102a963ffffffff600435166109c4565b3480156102d557600080fd5b506102de610b87565b6040805161ffff9092168252519081900360200190f35b34801561030157600080fd5b506102a9610bbf565b34801561031657600080fd5b5061031f611089565b60408051600160a060020a039092168252519081900360200190f35b34801561034757600080fd5b50610350611098565b6040805160ff9092168252519081900360200190f35b34801561037257600080fd5b506102a96001608060020a036004351661109d565b34801561039357600080fd5b5061039c611123565b604080516001608060020a039092168252519081900360200190f35b3480156103c457600080fd5b506102de60ff6004351661113a565b3480156103df57600080fd5b50610350611150565b3480156103f457600080fd5b5061040663ffffffff60043516611155565b6040805160ff90941684526001608060020a039092166020840152600160a060020a031682820152519081900360600190f35b34801561044557600080fd5b5061044e611194565b6040805163ffffffff9092168252519081900360200190f35b34801561047357600080fd5b506102a96111a7565b34801561048857600080fd5b506102de61140b565b34801561049d57600080fd5b506102de63ffffffff60043516611411565b3480156104bb57600080fd5b5061035061147d565b3480156104d057600080fd5b506104e061ffff60043516611486565b604051808561014080838360005b838110156105065781810151838201526020016104ee565b5050505090500184600a60200280838360005b83811015610531578181015183820152602001610519565b5050505090500183600a60200280838360005b8381101561055c578181015183820152602001610544565b5050505090500182600a60200280838360005b8381101561058757818101518382015260200161056f565b5050505090500194505050505060405180910390f35b3480156105a957600080fd5b5061044e61162b565b3480156105be57600080fd5b5061035063ffffffff60043516611637565b3480156105dc57600080fd5b506102a963ffffffff6004351661ffff6024351661164c565b34801561060157600080fd5b5061031f612105565b6102a960ff60043516612114565b34801561062457600080fd5b506102a9612920565b34801561063957600080fd5b506102de612945565b34801561064e57600080fd5b5061031f612978565b34801561066357600080fd5b50604080516020601f6064356004818101359283018490048402850184019095528184526102a994600160a060020a038135811695602480359660443590931695369560849492019181908401838280828437509497506129879650505050505050565b3480156106d357600080fd5b50610350613008565b3480156106e857600080fd5b506102a961300d565b3480156106fd57600080fd5b50610350613554565b34801561071257600080fd5b506102de613559565b34801561072757600080fd5b5061031f61358d565b34801561073c57600080fd5b5061075160ff6004358116906024351661359c565b604080519115158252519081900360200190f35b34801561077157600080fd5b5061035061368f565b34801561078657600080fd5b5061079863ffffffff60043516613694565b60408051918252519081900360200190f35b3480156107b657600080fd5b506103506136a6565b3480156107cb57600080fd5b5061031f6136ab565b3480156107e057600080fd5b506102de6136ba565b3480156107f557600080fd5b506103506136ee565b34801561080a57600080fd5b506107986136fc565b34801561081f57600080fd5b50610350613702565b34801561083457600080fd5b506102a9613707565b34801561084957600080fd5b506103506138fb565b34801561085e57600080fd5b5061031f61390a565b34801561087357600080fd5b50610350613919565b34801561088857600080fd5b5061035061391e565b34801561089d57600080fd5b50610798613923565b3480156108b257600080fd5b5061044e61140b565b3480156108c757600080fd5b506103506139a8565b3480156108dc57600080fd5b506102a96139b8565b3480156108f157600080fd5b50610350614086565b34801561090657600080fd5b506102de61408b565b34801561091b57600080fd5b506102a9600160a060020a0360043516614095565b34801561093c57600080fd5b506102a9600160a060020a0360043516614129565b34801561095d57600080fd5b5061035061414c565b34801561097257600080fd5b5061044e600435614151565b34801561098a57600080fd5b506102a9614189565b600054600160a060020a031633146109aa57600080fd5b6109b26111a7565b6109ba613707565b6109c2612920565b565b60003332146109d257600080fd5b63ffffffff8216600090815260086020526040902060010154600160a060020a031633146109ff57600080fd5b63ffffffff8216600090815260086020526040902054600c60ff9091161080610a42575063ffffffff8216600090815260086020526040902054600e60ff909116115b1515610a4d57600080fd5b63ffffffff82166000908152600860205260409020600101544260a060020a90910467ffffffffffffffff90811662015180011610610a8b57600080fd5b5063ffffffff8116600090815260086020526040902054600a805461ffff19811661ffff9182166000190190911617905561010090046001608060020a0316610ae2610ad683611411565b600a5461ffff166142bc565b60405133906001608060020a03831680156108fc02916000818181858888f19350505050158015610b17573d6000803e3d6000fd5b5060075460a060020a900463ffffffff161515610b3657610b36614189565b6040805163ffffffff841681523360208201526001608060020a0383168183015290517fe5cc68f68d9672681158062a835b6abc2ff3fba89f8db70f3a227d4ac35da3c39181900360600190a15050565b600060155b601a60ff821611610bbb5760ff81166000908152600b602052604090205461ffff169190910190600101610b8c565b5090565b6000808080808080606080828080333214610bd957600080fd5b600160009054906101000a9004600160a060020a0316600160a060020a031663afb7e4956040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610c2c57600080fd5b505af1158015610c40573d6000803e3d6000fd5b505050506040513d6020811015610c5657600080fd5b5051600c5401421015610c6857600080fd5b600a54600061ffff90911611610c7d57600080fd5b42600c55600a54600154604080517f11a5a793000000000000000000000000000000000000000000000000000000008152905161ffff9093169a50606492600160a060020a03909216916311a5a793916004808201926020929091908290030181600087803b158015610cef57600080fd5b505af1158015610d03573d6000803e3d6000fd5b505050506040513d6020811015610d1957600080fd5b505160ff16890261ffff16811515610d2d57fe5b0461ffff1696508761ffff1661271002620138800163ffffffff1695508663ffffffff1660001415610d5e57600196505b8663ffffffff16604051908082528060200260200182016040528015610d8e578160200160208202803883390190505b506007546040805163ffffffff9092168083526020808202840101909152919650908015610dc6578160200160208202803883390190505b50935060009250600091505b8663ffffffff168360ff161015610ef05781806001019250508761ffff16610e018361ffff16600c5401614474565b811515610e0a57fe5b06995060068a61ffff16815481101515610e2057fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff169850838963ffffffff16815181101515610e5c57fe5b906020019060200201511515610eeb576001848a63ffffffff16815181101515610e8257fe5b91151560209283029091019091015284518990869060ff8616908110610ea457fe5b63ffffffff909216602092830290910190910152610ec48a8960006144cd565b9a5060008b6001608060020a03161115610ee057600019909701965b9a8a019a6001909201915b610dd2565b50600a805461ffff891661ffff199091161790556001608060020a038086163a0290818116908d161115610fd957610f29818d036145f7565b7fa06ad7d0261a795ad8f33fdbef7cf65a0f9f9a825353b13358a96a750acd6b3d85828e03836040518080602001846001608060020a03166001608060020a03168152602001836001608060020a03166001608060020a03168152602001828103825285818151815260200191508051906020019060200280838360005b83811015610fbf578181015183820152602001610fa7565b5050505090500194505050505060405180910390a161107b565b7fa06ad7d0261a795ad8f33fdbef7cf65a0f9f9a825353b13358a96a750acd6b3d856000836040518080602001846001608060020a03168152602001836001608060020a03166001608060020a03168152602001828103825285818151815260200191508051906020019060200280838360005b8381101561106557818101518382015260200161104d565b5050505090500194505050505060405180910390a15b505050505050505050505050565b600554600160a060020a031681565b600b81565b60008054600160a060020a031633146110b557600080fd5b6110bd613923565b9050808267016345785d8a0000016001608060020a0316101561111f5760008054604051600160a060020a03909116916001608060020a03851680156108fc02929091818181858888f1935050505015801561111d573d6000803e3d6000fd5b505b5050565b60075464010000000090046001608060020a031681565b600b6020526000908152604090205461ffff1681565b600c81565b63ffffffff166000908152600860205260409020805460019091015460ff8216926101009092046001608060020a031691600160a060020a0390911690565b60075460a060020a900463ffffffff1681565b600080548190600160a060020a031633146111c157600080fd5b6002546040805160e060020a6370a082310281523060048201529051600160a060020a03909216916370a08231916024808201926020929091908290030181600087803b15801561121157600080fd5b505af1158015611225573d6000803e3d6000fd5b505050506040513d602081101561123b57600080fd5b505160025460008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101869052905194965092169263a9059cbb926044808201936020939283900390910190829087803b1580156112b257600080fd5b505af11580156112c6573d6000803e3d6000fd5b505050506040513d60208110156112dc57600080fd5b505115156112e657fe5b6003546040805160e060020a6370a082310281523060048201529051600160a060020a03909216916370a08231916024808201926020929091908290030181600087803b15801561133657600080fd5b505af115801561134a573d6000803e3d6000fd5b505050506040513d602081101561136057600080fd5b505160035460008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101869052905194955092169263a9059cbb926044808201936020939283900390910190829087803b1580156113d757600080fd5b505af11580156113eb573d6000803e3d6000fd5b505050506040513d602081101561140157600080fd5b5051151561111f57fe5b60001981565b6000805b60065461ffff8216101561028f578263ffffffff1660068261ffff1681548110151561143d57fe5b6000918252602090912060088204015460079091166004026101000a900463ffffffff16141561146f57809150611477565b600101611415565b50919050565b600d5460ff1681565b61148e614df9565b611496614df9565b61149e614df9565b6114a6614df9565b600a805460009182918291829161ffff908116918b0116116114cb5788600a016114d3565b600a5461ffff165b61ffff169350600092508890505b8363ffffffff168161ffff161015611620576006805461ffff831690811061150557fe5b6000918252602090912060088204015460079091166004026101000a900463ffffffff169150818860ff8516600a811061153b57fe5b63ffffffff9283166020918202929092019190915290831660009081526008909152604090205460ff9081169088908516600a811061157657fe5b60ff9283166020918202929092019190915263ffffffff841660009081526008909152604090205461010090046001608060020a03169087908516600a81106115bb57fe5b6001608060020a039092166020928302919091015263ffffffff8316600090815260089091526040902060010154600160a060020a03168560ff8516600a811061160157fe5b600160a060020a039092166020929092020152600192830192016114e1565b505050509193509193565b60075463ffffffff1681565b600f6020526000908152604090205460ff1681565b600080808080808080808033321461166357600080fd5b6006805461ffff8d1690811061167557fe5b6000918252602090912060088204015460079091166004026101000a900463ffffffff908116908d16146116af576116ac8c611411565b9a505b63ffffffff8c16600090815260086020908152604080832060015482517f4597dc8e0000000000000000000000000000000000000000000000000000000081529251919e504294600160a060020a0390911693634597dc8e936004808201949293918390030190829087803b15801561172757600080fd5b505af115801561173b573d6000803e3d6000fd5b505050506040513d602081101561175157600080fd5b505163ffffffff8e166000908152600e602052604090205401111561177557600080fd5b60018a0154600160a060020a0316331461178e57600080fd5b895460ff169850600c8910806117a75750600e60ff8a16115b15156117b257600080fd5b6117c28c63ffffffff168a614a71565b975061ffff80891614156117d257fe5b6006805461ffff8a169081106117e457fe5b6000918252602080832060088084049091015463ffffffff60046007909516949094026101000a900483168085529152604090922091985090965060649061182d908e16614474565b81151561183657fe5b60055460018d01546040805160e060020a6370a08231028152600160a060020a039283166004820152905194909306965016916370a08231916024808201926020929091908290030181600087803b15801561189157600080fd5b505af11580156118a5573d6000803e3d6000fd5b505050506040513d60208110156118bb57600080fd5b50516004805460018d01546040805160e060020a6370a08231028152600160a060020a03928316948101949094525166038d7ea4c680009391909216916370a08231916024808201926020929091908290030181600087803b15801561192057600080fd5b505af1158015611934573d6000803e3d6000fd5b505050506040513d602081101561194a57600080fd5b505181151561195557fe5b60055460018a01546040805160e060020a6370a08231028152600160a060020a03928316600482015290519490930494909401955092909216916370a082319160248083019260209291908290030181600087803b1580156119b657600080fd5b505af11580156119ca573d6000803e3d6000fd5b505050506040513d60208110156119e057600080fd5b50516004805460018901546040805160e060020a6370a08231028152600160a060020a03928316948101949094525166038d7ea4c680009391909216916370a08231916024808201926020929091908290030181600087803b158015611a4557600080fd5b505af1158015611a59573d6000803e3d6000fd5b505050506040513d6020811015611a6f57600080fd5b5051811515611a7a57fe5b88548d5492909104929092019250610100918290046001608060020a0390811692909104161415611bee576032935080821115611b4b57600160009054906101000a9004600160a060020a0316600160a060020a0316634ad6e6486040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015611b0457600080fd5b505af1158015611b18573d6000803e3d6000fd5b505050506040513d6020811015611b2e57600080fd5b505160ff166064811515611b3e57fe5b0460ff1684019350611be9565b81811115611be957600160009054906101000a9004600160a060020a0316600160a060020a0316634ad6e6486040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015611ba657600080fd5b505af1158015611bba573d6000803e3d6000fd5b505050506040513d6020811015611bd057600080fd5b505160ff166064811515611be057fe5b0460ff16840393505b611db4565b85548a546001608060020a0361010092839004811692909104161115611ce5576064935081811115611be957600160009054906101000a9004600160a060020a0316600160a060020a0316634ad6e6486040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015611c6d57600080fd5b505af1158015611c81573d6000803e3d6000fd5b505050506040513d6020811015611c9757600080fd5b50518a54875460ff90921691610100918290046001608060020a0390811692909104811660640216811515611cc857fe5b046001608060020a0316811515611cdb57fe5b0484039350611db4565b80821115611db457600160009054906101000a9004600160a060020a0316600160a060020a0316634ad6e6486040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015611d4057600080fd5b505af1158015611d54573d6000803e3d6000fd5b505050506040513d6020811015611d6a57600080fd5b505186548b5460ff90921691610100918290046001608060020a0390811692909104811660640216811515611d9b57fe5b046001608060020a0316811515611dae57fe5b04840193505b61ffff80851690841610611f83578554600c60ff9091161080611ddd57508554600e60ff909116115b15611f2457600a548654611dfc918d9161ffff9091169060ff166144cd565b94506000856001608060020a03161115611e2b57600a805461ffff19811661ffff918216600019019091161790555b8554601560ff90911610801590611e4957508554601a60ff90911611155b15611e8c57600780546001608060020a03640100000000808304821689019091160273ffffffffffffffffffffffffffffffff0000000019909116179055611ebe565b85546001608060020a03610100808304821688019091160270ffffffffffffffffffffffffffffffff00199091161786555b6040805163ffffffff808a1682528e1660208201526001608060020a0387168183015261ffff80871660608301528516608082015290517f24758388bd6bf650dde3bbde100b1056920770025a9f1c5998b4587670d4f3859181900360a00190a1611f7e565b6040805163ffffffff808a1682528e16602082015260008183015261ffff80871660608301528516608082015290517f24758388bd6bf650dde3bbde100b1056920770025a9f1c5998b4587670d4f3859181900360a00190a15b6120df565b600a548a54611f9d918a9161ffff9091169060ff166144cd565b94506000856001608060020a03161115611fcc57600a805461ffff19811661ffff918216600019019091161790555b8954601560ff90911610801590611fea57508954601a60ff90911611155b1561202d57600780546001608060020a03640100000000808304821689019091160273ffffffffffffffffffffffffffffffff000000001990911617905561205f565b89546001608060020a03610100808304821688019091160270ffffffffffffffffffffffffffffffff0019909116178a555b60075460a060020a900463ffffffff16151561207d5761207d614189565b6040805163ffffffff808f168252891660208201526001608060020a0387168183015261ffff80871660608301528516608082015290517f24758388bd6bf650dde3bbde100b1056920770025a9f1c5998b4587670d4f3859181900360a00190a15b50505063ffffffff9098166000908152600e602052604090204290555050505050505050565b600154600160a060020a031681565b600080808080808032331461212857600080fd5b600154604080517f49b3b29f00000000000000000000000000000000000000000000000000000000815260ff8b1660048201529051600160a060020a03909216916349b3b29f916024808201926020929091908290030181600087803b15801561219157600080fd5b505af11580156121a5573d6000803e3d6000fd5b505050506040513d60208110156121bb57600080fd5b50516001608060020a0316348115156121d057fe5b600a54919004975061ffff169550601b60ff891610158061228d5750600154604080517f49b3b29f00000000000000000000000000000000000000000000000000000000815260ff8b1660048201529051600160a060020a03909216916349b3b29f916024808201926020929091908290030181600087803b15801561225557600080fd5b505af1158015612269573d6000803e3d6000fd5b505050506040513d602081101561227f57600080fd5b50516001608060020a031634105b806123205750600160009054906101000a9004600160a060020a0316600160a060020a0316638882ddc96040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156122e657600080fd5b505af11580156122fa573d6000803e3d6000fd5b505050506040513d602081101561231057600080fd5b505161ffff908116878901909116115b1561232a57600080fd5b60075463ffffffff169450600560ff8916116125875760075460a060020a900463ffffffff16158061236b575060075460a060020a900463ffffffff908116145b156123a0576007805477ffffffff0000000000000000000000000000000000000000191660a060020a63ffffffff8816021790555b600093505b8661ffff168460ff161015612544576123c660ff8516868101908801614bdf565b6040805160808101825260ff8a16808252600154835160e060020a635e383d21028152600481019290925292519192602080850193600160a060020a0390921692635e383d2192602480830193928290030181600087803b15801561242a57600080fd5b505af115801561243e573d6000803e3d6000fd5b505050506040513d602081101561245457600080fd5b50516001608060020a039081168252336020808401919091524267ffffffffffffffff90811660409485015260ff8981168b0163ffffffff16600090815260088452859020865181549488015160ff1990951692169190911770ffffffffffffffffffffffffffffffff0019166101009390941692909202929092178155918301516001928301805460609095015173ffffffffffffffffffffffffffffffffffffffff19909516600160a060020a03909216919091177bffffffffffffffff0000000000000000000000000000000000000000191660a060020a949092169390930217909155909301926123a5565b60ff88166000908152600b60205260409020805461ffff1980821661ffff9283168b01831617909255600a80549283169282168a019091169190911790556128a9565b600480546040805160e060020a6370a08231028152339381019390935251600160a060020a03909116916370a082319160248083019260209291908290030181600087803b1580156125d857600080fd5b505af11580156125ec573d6000803e3d6000fd5b505050506040513d602081101561260257600080fd5b50516005546040805160e060020a6370a082310281523360048201529051929550600160a060020a03909116916370a08231916024808201926020929091908290030181600087803b15801561265757600080fd5b505af115801561266b573d6000803e3d6000fd5b505050506040513d602081101561268157600080fd5b50519150600f60ff89161080159061269d5750601460ff891611155b156126cc57600d54610100900460ff1683108015906126c15750600d5460ff168210155b15156126cc57600080fd5b601560ff8916108015906126e45750601a60ff891611155b1561271b57600d546301000000900460ff1683108015906127105750600d5462010000900460ff168210155b151561271b57600080fd5b5060005b8661ffff168160ff1610156128a9576040805160808101825260ff8a16808252600154835160e060020a635e383d21028152600481019290925292519192602080850193600160a060020a0390921692635e383d2192602480830193928290030181600087803b15801561279257600080fd5b505af11580156127a6573d6000803e3d6000fd5b505050506040513d60208110156127bc57600080fd5b50516001608060020a039081168252336020808401919091524267ffffffffffffffff90811660409485015260ff8681168b0163ffffffff16600090815260088452859020865181549488015160ff1990951692169190911770ffffffffffffffffffffffffffffffff0019166101009390941692909202929092178155918301516001928301805460609095015173ffffffffffffffffffffffffffffffffffffffff19909516600160a060020a03909216919091177bffffffffffffffff0000000000000000000000000000000000000000191660a060020a9490921693909302179091550161271f565b6007805463ffffffff191661ffff891687810163ffffffff908116929092179092556040805133815260ff8c166020820152808201939093529087166060830152517ff7ad76543f114c7bb00ff2cd992ff749d502ed5c0c6f87901ad48f6871fceca1916080908290030190a15050505050505050565b600054600160a060020a0316331461293757600080fd5b600054600160a060020a0316ff5b6000805b600560ff821611610bbb5760ff81166000908152600b602052604090205461ffff169190910190600101612949565b600054600160a060020a031681565b60035460009081908190819081908190600160a060020a0316331415612b4a576129b087614c99565b9550600160009054906101000a9004600160a060020a0316600160a060020a0316636121e5226040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015612a0557600080fd5b505af1158015612a19573d6000803e3d6000fd5b505050506040513d6020811015612a2f57600080fd5b505163ffffffff8716600090815260086020526040902054909550600c60ff90911610801590612a7a575063ffffffff8616600090815260086020526040902054601460ff90911611155b15612a86576002850294505b84891015612a9357600080fd5b600354604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a038d8116600483015230602483015260448201899052915191909216916323b872dd9160648083019260209291908290030181600087803b158015612b0857600080fd5b505af1158015612b1c573d6000803e3d6000fd5b505050506040513d6020811015612b3257600080fd5b50511515612b3c57fe5b612b4586614ca0565b612ffc565b600254600160a060020a0316331415612f6f57612b6687614c99565b63ffffffff8116600090815260086020908152604080832054600154825160e060020a635e383d2102815260ff909216600483018190529251959b50919850600160a060020a0390911693635e383d2193602480840194938390030190829087803b158015612bd457600080fd5b505af1158015612be8573d6000803e3d6000fd5b505050506040513d6020811015612bfe57600080fd5b505163ffffffff871660009081526008602052604090205461010090046001608060020a03908116911614612c3257600080fd5b600b60ff8516111580612c585750601560ff851610801590612c585750601a60ff851611155b15612cf557600160009054906101000a9004600160a060020a0316600160a060020a03166319f353bb6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015612cb057600080fd5b505af1158015612cc4573d6000803e3d6000fd5b505050506040513d6020811015612cda57600080fd5b5051600660ff86160660010160ff1602925060039150612e67565b600c60ff851610801590612d0d5750600e60ff851611155b15612db057600160009054906101000a9004600160a060020a0316600160a060020a03166319f353bb6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015612d6557600080fd5b505af1158015612d79573d6000803e3d6000fd5b505050506040513d6020811015612d8f57600080fd5b505160066003860160ff160660010160ff1602600202925060069150612e67565b600f60ff851610801590612dc85750601460ff851611155b15612e6757600160009054906101000a9004600160a060020a0316600160a060020a03166319f353bb6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015612e2057600080fd5b505af1158015612e34573d6000803e3d6000fd5b505050506040513d6020811015612e4a57600080fd5b505160066003860160ff160660010160ff16026002029250600391505b5063ffffffff85166000908152600f602052604081205490945060ff165b8160ff168160ff16108015612ea457508060010160ff16830285018910155b15612ebc5760010160ff811683029490940193612e85565b600254604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a038d8116600483015230602483015260448201899052915191909216916323b872dd9160648083019260209291908290030181600087803b158015612f3157600080fd5b505af1158015612f45573d6000803e3d6000fd5b505050506040513d6020811015612f5b57600080fd5b50511515612f6557fe5b612b458682614d97565b604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f53686f756c64206265206569746865722066726f6d204e65766572646965206f60448201527f722054656c65706f727420746f6b656e73000000000000000000000000000000606482015290519081900360840190fd5b50505050505050505050565b600681565b60008080606081818180808033321461302557600080fd5b603361303042614474565b81151561303957fe5b06995060058a6001608060020a0316101561305357600599505b6007546064906001608060020a0364010000000090910481168c021660408051600680825260e08201909252929091049a506020820160c08038833901905050600a546040805161ffff90921680835260208082028401019091529198509080156130c8578160200160208202803883390190505b509450600092505b60065460ff841610156132b2576008600060068560ff168154811015156130f357fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190205460ff169350601584108015906131405750601a60ff851611155b80156131ba575062093a8067ffffffffffffffff166008600060068660ff1681548110151561316b57fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190206001015460a060020a900467ffffffffffffffff90811642031610155b156132a7576001546040805160e060020a635e383d2102815260ff871660048201529051600160a060020a0390921691635e383d21916024808201926020929091908290030181600087803b15801561321257600080fd5b505af1158015613226573d6000803e3d6000fd5b505050506040513d602081101561323c57600080fd5b505160068054999091019860ff851690811061325457fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff16858761ffff1681518110151561328c57fe5b63ffffffff9092166020928302909101909101526001909501945b6001909201916130d0565b6000886001608060020a0316111561351457600091505b600660ff831610156133a7576001546040805160e060020a635e383d2102815260ff6015860116600482015290516001608060020a038b1692600160a060020a031691635e383d219160248083019260209291908290030181600087803b15801561333357600080fd5b505af1158015613347573d6000803e3d6000fd5b505050506040513d602081101561335d57600080fd5b50518a026001608060020a031681151561337357fe5b04878360ff1681518110151561338557fe5b6001608060020a039092166020928302909101909101526001909101906132c9565b5060005b8561ffff168161ffff16101561349e5786601560086000888561ffff168151811015156133d457fe5b602090810290910181015163ffffffff16825281019190915260400160002054825160ff918216929092031690811061340957fe5b906020019060200201516008600060068461ffff1681548110151561342a57fe5b60009182526020808320600883040154600790921660040261010090810a90920463ffffffff16845283019390935260409091019020805470ffffffffffffffffffffffffffffffff00198116908390046001608060020a03908116949094019093169091029190911790556001016133ab565b600780546001608060020a0364010000000080830482168d900382160273ffffffffffffffffffffffffffffffff00000000199092169190911790915560408051918b168252517f2359110bd6bbc405457edff9ea27ed0310d86730da626b57da3ba05cae1ce22d9181900360200190a1612ffc565b604080516000815290517f2359110bd6bbc405457edff9ea27ed0310d86730da626b57da3ba05cae1ce22d9181900360200190a150505050505050505050565b601481565b6000600f5b601460ff821611610bbb5760ff81166000908152600b602052604090205461ffff16919091019060010161355e565b600354600160a060020a031681565b6000600660ff8416108015906135b65750600b60ff841611155b156135c95750600560ff82161115613689565b600f60ff8416108015906135e15750601460ff841611155b1561360257600c60ff831610806135fb5750600e60ff8316115b9050613689565b600060ff84161080159061361a5750600560ff841611155b1561362d5750600f60ff82161015613689565b601560ff8416108015906136455750601a60ff841611155b1561368557600c60ff8316108015906136625750600e60ff831611155b806135fb5750600660ff8316108015906135fb575050600b60ff82161115613689565b5060005b92915050565b601581565b600e6020526000908152604090205481565b600f81565b600454600160a060020a031681565b600060065b600b60ff821611610bbb5760ff81166000908152600b602052604090205461ffff1691909101906001016136bf565b600d54610100900460ff1681565b600c5481565b600581565b60008054600160a060020a0316331461371f57600080fd5b5060005b600a5461ffff90811690821610156138e1576008600060068361ffff1681548110151561374c57fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1663ffffffff1663ffffffff16815260200190815260200160002060010160009054906101000a9004600160a060020a0316600160a060020a03166108fc6008600060068561ffff168154811015156137c657fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1663ffffffff1663ffffffff16815260200190815260200160002060000160019054906101000a90046001608060020a03166001608060020a03169081150290604051600060405180830381858888f19350505050158015613851573d6000803e3d6000fd5b506008600060068361ffff1681548110151561386957fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff1683528201929092526040019020805470ffffffffffffffffffffffffffffffffff19168155600190810180547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916905501613723565b6138ed60066000614e19565b50600a805461ffff19169055565b600d5462010000900460ff1681565b600254600160a060020a031681565b601a81565b600e81565b600080805b600a5461ffff908116908216101561399f576008600060068361ffff1681548110151561395157fe5b60009182526020808320600883040154600790921660040261010090810a90920463ffffffff1684528301939093526040909101902054046001608060020a03169190910190600101613928565b50303103919050565b600d546301000000900460ff1681565b6060600080600080600060326040519080825280602002602001820160405280156139ed578160200160208202803883390190505b50600a5490965061ffff169150600090505b8161ffff168161ffff161015613f955733600160a060020a03166008600060068461ffff16815481101515613a3057fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff168352820192909252604001902060010154600160a060020a0316148015613ae05750426008600060068461ffff16815481101515613a8f57fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190206001015460a060020a900467ffffffffffffffff908116620151800116105b8015613b945750600c60ff166008600060068461ffff16815481101515613b0357fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190205460ff161080613b945750600e60ff166008600060068461ffff16815481101515613b5c57fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190205460ff16115b15613f8d575b60008261ffff16118015613c0e575033600160a060020a03166008600060066001860361ffff16815481101515613bcd57fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff168352820192909252604001902060010154600160a060020a0316145b8015613c815750426008600060066001860361ffff16815481101515613c3057fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190206001015460a060020a900467ffffffffffffffff908116620151800116105b8015613d355750600c60ff166008600060068461ffff16815481101515613ca457fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190205460ff161080613d355750600e60ff166008600060068461ffff16815481101515613cfd57fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190205460ff16115b15613e8a57600680546000199093019261ffff8416908110613d5357fe5b60009182526020808320600880840490910154600790931660040261010090810a90930463ffffffff168085528183526040808620805460ff9081168852600b8652918720805461ffff19811661ffff91821660001901909116179055958290529190925292548951919750919091046001608060020a0316949094019385918891908816908110613de157fe5b63ffffffff9283166020918202909201015260075460019096019585821660a060020a9091049091161415613e32576007805477ffffffff0000000000000000000000000000000000000000191690555b63ffffffff84166000908152600860205260409020805470ffffffffffffffffffffffffffffffffff1916815560010180547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19169055613b9a565b8060010161ffff168261ffff161115613f8d576008600060068361ffff16815481101515613eb457fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1663ffffffff1663ffffffff16815260200190815260200160002060000160019054906101000a90046001608060020a03166001608060020a03168301925060068161ffff16815481101515613f2b57fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff16868660ff16815181101515613f6257fe5b63ffffffff90921660209283029091019091015260019094019360001990910190613f8d81836142bc565b6001016139ff565b600a805461ffff191661ffff84161790556040805133808252602080830187905260609383018481528a519484019490945289517f1e6d26af567145cb0b46ea7135e21671f1e58e8d1f818dab12b0e10eb5ebb07b94929388938c93919290916080840191858201910280838360005b8381101561401d578181015183820152602001614005565b5050505090500194505050505060405180910390a1604051339084156108fc029085906000818181858888f1935050505015801561405f573d6000803e3d6000fd5b5060075460a060020a900463ffffffff16151561407e5761407e614189565b505050505050565b600081565b600a5461ffff1681565b600054600160a060020a031633146140ac57600080fd5b600160a060020a03811615156140c157600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a0316331461414057600080fd5b80600160a060020a0316ff5b601b81565b600680548290811061415f57fe5b9060005260206000209060089182820401919006600402915054906101000a900463ffffffff1681565b60001960005b600a5461ffff9081169082161015614284578163ffffffff1660068261ffff168154811015156141bb57fe5b6000918252602090912060088204015460079091166004026101000a900463ffffffff1610801561423c5750600560ff166008600060068461ffff1681548110151561420357fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190205460ff1611155b1561427c576006805461ffff831690811061425357fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1691505b60010161418f565b506007805463ffffffff90921660a060020a0277ffffffff000000000000000000000000000000000000000019909216919091179055565b600060068361ffff168154811015156142d157fe5b6000918252602080832060088084049091015460079384166004026101000a900463ffffffff90811680865291835260408086205460ff168652600b90935291909320805461ffff19811661ffff91821660001901909116179055905491925060a060020a90910416811415614363576007805477ffffffff0000000000000000000000000000000000000000191690555b63ffffffff81166000908152600860205260409020805470ffffffffffffffffffffffffffffffffff1916815560010180547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690556006805461ffff84169081106143c857fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1660068461ffff1681548110151561440157fe5b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908363ffffffff16021790555060068261ffff1681548110151561444757fe5b90600052602060002090600891828204019190066004026101000a81549063ffffffff0219169055505050565b600a546040805160001943014081524260208201527e0100000000000000000000000000000000000000000000000000000000000061ffff90931692909202828201526042820183905251908190036062019020919050565b600080600060068661ffff168154811015156144e557fe5b6000918252602090912060088204015460079091166004026101000a900463ffffffff16915060019050600f60ff8516108015906145275750601460ff851611155b15614530575060025b63ffffffff82166000908152600f602052604090205460ff8083169116106145825763ffffffff82166000908152600f60205260408120805460ff8082168590031660ff1990911617905592506145ee565b6008600060068861ffff1681548110151561459957fe5b60009182526020808320600883040154600790921660040261010090810a90920463ffffffff16845283019390935260409091019020546000199690960195046001608060020a031692506145ee86866142bc565b50509392505050565b60008060006060600080600080600760149054906101000a900463ffffffff1663ffffffff166000141561462d5761462d614189565b60075460a060020a900463ffffffff908116146146a95760075460a060020a900463ffffffff166000908152600860205260409020805470ffffffffffffffffffffffffffffffff00198116600a6001608060020a038d81169190910461010093849004821681019091169092021790915560090297506146ad565b8897505b60408051601a8082526103608201909252909650866020820161034080388339019050509450600093505b8560ff168460ff1610156147b057600c60ff851610806146fb5750600e60ff8516115b801561471b575060ff84166000908152600b602052604081205461ffff16115b156147a5576001546040805160e060020a635e383d2102815260ff871660048201529051600160a060020a0390921691635e383d21916024808201926020929091908290030181600087803b15801561477357600080fd5b505af1158015614787573d6000803e3d6000fd5b505050506040513d602081101561479d57600080fd5b505196909601955b6001909301926146d8565b600092505b8560ff168360ff1610156148f957600c60ff851610806147d85750600e60ff8516115b80156147f8575060ff83166000908152600b602052604081205461ffff16115b156148ee5760ff83166000818152600b6020908152604080832054600154825160e060020a635e383d210281526004810196909652915161ffff909116946001608060020a038d1694600160a060020a0390931693635e383d219360248084019492938390030190829087803b15801561487157600080fd5b505af1158015614885573d6000803e3d6000fd5b505050506040513d602081101561489b57600080fd5b50518a026001608060020a03168115156148b157fe5b046001608060020a03168115156148c457fe5b04858460ff168151811015156148d657fe5b6001608060020a039092166020928302909101909101525b6001909201916147b5565b5060005b600a5461ffff9081169082161015614a66576008600060068361ffff1681548110151561492657fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190205460ff169150600c8210806149705750600e60ff8316115b15614a5e57846008600060068461ffff1681548110151561498d57fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff168352820192909252604001902054815160ff9091169081106149d057fe5b906020019060200201516008600060068461ffff168154811015156149f157fe5b60009182526020808320600883040154600790921660040261010090810a90920463ffffffff16845283019390935260409091019020805470ffffffffffffffffffffffffffffffff00198116908390046001608060020a03908116949094019093169091029190911790555b6001016148fd565b505050505050505050565b600a5460009081908190819061ffff16614a8a87614474565b811515614a9357fe5b600a549190069350600761ffff918216061615614ab1576007614acd565b600a54600b61ffff918216061615614aca57600b614acd565b600d5b60ff1691508290505b614b2c856008600060068561ffff16815481101515614af157fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16835282019290925260400190205460ff1661359c565b8015614b96575033600160a060020a03166008600060068461ffff16815481101515614b5457fe5b6000918252602080832060088304015460079092166004026101000a90910463ffffffff168352820192909252604001902060010154600160a060020a031614155b15614ba357809350614bd6565b600a5461ffff9081169082840116811515614bba57fe5b06905061ffff80821690841614614bd057614ad6565b60001993505b50505092915050565b60065461ffff82161015614c39578160068261ffff16815481101515614c0157fe5b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908363ffffffff16021790555061111f565b60068054600181018255600091909152600881047ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f01805463ffffffff80861660046007909516949094026101000a938402930219169190911790555050565b5060a05190565b63ffffffff811660009081526009602052604081205460ff1615614cc357600080fd5b5063ffffffff81166000908152600960209081526040808320805460ff19166001179055600890915290208054600560ff9190911611614d0257600080fd5b600a54614d1490839061ffff16614bdf565b600a805461ffff8082166001908101821661ffff1993841617909355835460ff166000908152600b6020908152604091829020805480851690960190931694909316939093179055815163ffffffff8516815291517f663f46f5a2fd740de613966ad0391fbc9d840f82898698e6d7f16ba0ed126b3b9281900390910190a15050565b63ffffffff82166000818152600f6020908152604091829020805460ff191660ff861690811790915582519384529083015280517f088ba7785fd329abbf01eaa732bad30e14b205b9fc8ab9378f9f5295731135559281900390910190a15050565b61014060405190810160405280600a906020820280388339509192915050565b508054600082556007016008900490600052602060002090810190614e3e9190614e41565b50565b614e5b91905b80821115610bbb5760008155600101614e47565b905600a165627a7a72305820111e20e13bd123c58426c79aa96878d3847898ffffd0adee46174e3325b5d4d200290000000000000000000000008a01bc6a9358388588247127ff7be21b281b36d4000000000000000000000000ee7acd6b0fb65eebc11cf733fdc606619cf633d4000000000000000000000000d22d680d1fa045a07e8d335c1bb815ebfc4d4e5e000000000000000000000000822afedd7d48ed1056247747c8ed6df7f02b50fc000000000000000000000000c21013e6743c7e66170b463ff3a5e32276059346

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

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


   Swarm Source:
bzzr://111e20e13bd123c58426c79aa96878d3847898ffffd0adee46174e3325b5d4d2

 

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