Contract 0x533baFa16AA76218Ec4a365ad71bF8816cF21Bbb

Token Contract 
 

Contract Overview

PlanetCrypto: PLANET Token
Balance:
0.00117942734829 Ether

EtherValue:
$1.45 (@ $1,226.99/ETH)

Token:
 
Txn Hash
Method
Block
From
To
Value
0x41122e89c2254d445e768e77e6da363b73549a468cbabc07002f32d9fe94a4e5Set Approval For...155440282022-09-16 5:10:3582 days 5 hrs ago0xd71c9831d5bc11a48170d0cbfd5f8a5e39e91edd IN  PlanetCrypto: PLANET Token0 Ether0.00025695 5.48156057
0x23df9e1e677ef457e0bf3d6af3eb586b1aec14d786b036f063ae168fa0c55fbaUpdate Card Deta...153147522022-08-10 13:59:15118 days 20 hrs agoPlanetCrypto: Deployer IN  PlanetCrypto: PLANET Token0.001 Ether0.00124899 25.17938768
0x72391ce022e6833f3a7b4800409cca3fd7d9e773cc3d89918d2611bd9c883909P_update_action153147482022-08-10 13:58:31118 days 20 hrs agoPlanetCrypto: Deployer IN  PlanetCrypto: PLANET Token0 Ether0.00073803 22.48673536
0x7785872dd2055ac4720a005719163fb84b87730c9212437102f8fafdf0eb2e0fUpdate Card Deta...153147322022-08-10 13:55:58118 days 20 hrs agoPlanetCrypto: Deployer IN  PlanetCrypto: PLANET Token0.001 Ether0.00163695 31.23716086
0x82cda3c6a238f70465db595dffaacc1c74327b1a38d14c3ee5589635f9896bedP_update_action153147242022-08-10 13:54:39118 days 20 hrs agoPlanetCrypto: Deployer IN  PlanetCrypto: PLANET Token0 Ether0.00125835 38.33999374
0x772caf6d05f9ac42d9d618d8492b68d1f8078ba3b61e848e62e3edc7da936521P_update_action153147112022-08-10 13:52:12118 days 20 hrs agoPlanetCrypto: Deployer IN  PlanetCrypto: PLANET Token0 Ether0.00157777 51.56139913
0x9de86e8dea73f079e75aa565040674fcc7f90303a017d7d48c5c0e46d14ff187Set Approval For...150119022022-06-23 7:48:23167 days 2 hrs ago0xe2feebe43a6c3df939e09515bd2911be19ace4bf IN  PlanetCrypto: PLANET Token0 Ether0.00122618 26.15745853
0x98319c7c84f717da4a3e8ec1b6eecc18b71b47a9e961e5262d874f381af49c45Set Approval For...142498062022-02-21 13:56:54288 days 20 hrs ago0xa81832435db087710d8dbdb2e8a726d5fdc2207e IN  PlanetCrypto: PLANET Token0 Ether0.00179358 66.27914892
0xfa664702dc654e5141c2be841fa7ccc8d36cdcf229f2602b8a9a8375c32a3a6bSet Approval For...142498052022-02-21 13:56:38288 days 20 hrs ago0xa81832435db087710d8dbdb2e8a726d5fdc2207e IN  PlanetCrypto: PLANET Token0 Ether0.00310632 66.1468861
0x61c44ae0ca0e89771e8c0827a184a25ca0be4bffe08af3e222fe5ad558a9026eSet Approval For...142145522022-02-16 2:38:06294 days 8 hrs ago0xc360614e540aa7d38ae9b1f93cbf978979b12f32 IN  PlanetCrypto: PLANET Token0 Ether0.00298351 63.53175669
0x6671f4d12db50c7acb436f3a743bccca0b20974ac3b59510d52873a430baa83eSet Approval For...137555922021-12-07 0:59:35365 days 9 hrs ago0xeeb88986771fccb495a3044bbabb55cc48346a38 IN  PlanetCrypto: PLANET Token0 Ether0.00499698106.40703619
0x02a96b78ffb95f0f10da372cc07f1f3cd7dd7feb41359dc8748a4a4cf45d6259Withdraw Tax Ear...135677272021-11-07 6:08:21395 days 4 hrs ago0x83d94fdc84b5647151d8de040cceca6917fdb6c0 IN  PlanetCrypto: PLANET Token0 Ether0.00205164 60
0x710174f879eaa7a75e47e8a6917253d2b962b47f84ab3fe71fcbf8dc53c19c6eSet Approval For...98378752020-04-09 11:56:14971 days 22 hrs agoENS Name dreadnaught.eth IN  PlanetCrypto: PLANET Token0 Ether0.00025255.53000023
0x3f952ba377c3256398d6aadaf7cc795d96828cc2f4963e08869ac985230130beWithdraw Tax Ear...93845382020-01-30 16:13:451041 days 18 hrs agoENS Name ry4n.blahblahblah.eth IN  PlanetCrypto: PLANET Token0 Ether0.000026451.01
0x8c922e9cc9472eeebdddf11ea95c18ad35054de7557583744d7f2a13e857208aWithdraw Tax Ear...86590142019-10-01 21:54:351162 days 12 hrs ago0xba21d01125d6932ce8abf3625977899fd2c7fa30 IN  PlanetCrypto: PLANET Token0 Ether0.00003351
0x4dfaed55e8538ae83ffb55109adfb574e4c864238c878414eda45feeecb3fdf2Withdraw Tax Ear...86590142019-10-01 21:54:351162 days 12 hrs ago0xba21d01125d6932ce8abf3625977899fd2c7fa30 IN  PlanetCrypto: PLANET Token0 Ether0.00002521
0x787ee8af8a150518a4a2667341adbc2fcb08d941b991566bbf41a07d687ffd6cWithdraw Tax Ear...85659652019-09-17 8:49:091177 days 1 hr agoENS Name dreadnaught.eth IN  PlanetCrypto: PLANET Token0 Ether0.0005544422
0xa0c98e52fe4453c628cbce4bfbc72fa737cc7b435100c2242475ab9dcdae04f7Set Approval For...83191332019-08-09 22:45:081215 days 12 hrs ago0xd736144c39dac0122d70a2ca6b1725a67b0fc00b IN  PlanetCrypto: PLANET Token0 Ether0.000278166
0xa99f15c1a8e4f15b82cbbc8e8b44c969ea4c342be6c9d79424ce2321cb7f5ec1Withdraw Tax Ear...82443402019-07-29 7:57:381227 days 2 hrs ago0xd71c9831d5bc11a48170d0cbfd5f8a5e39e91edd IN  PlanetCrypto: PLANET Token0 Ether0.000055442.2
0x562f320c49d58ddac8f7635a49b7c20b66640584611211c91ff048b273421819Withdraw Tax Ear...82337412019-07-27 16:33:281228 days 18 hrs agoENS Name rarart.eth IN  PlanetCrypto: PLANET Token0 Ether0.000030241.2
0xa0d476c06ef58943ba1ecc7301f3ee43056383683ec03fbb0440decbb2dee4e5Withdraw Tax Ear...80892792019-07-05 4:59:461251 days 5 hrs agoSybil Delegate: AlvaroCabreraO1 IN  PlanetCrypto: PLANET Token0 Ether0.000027721.1
0xfa682ee760da2be7d12be108b810fc4a4f3a6a632d09e536d5a731d67ccda01dWithdraw Tax Ear...80517572019-06-29 8:42:441257 days 2 hrs ago0x8a820adf409345e382261f558185749e9bba9434 IN  PlanetCrypto: PLANET Token0 Ether0.00007563
0xb13bda159aa7ce8923ae8a51037d09284d5f96b5d7a43f6fc8ce5bb37839e5a9Set Approval For...80175882019-06-24 0:46:061262 days 10 hrs ago0xd71c9831d5bc11a48170d0cbfd5f8a5e39e91edd IN  PlanetCrypto: PLANET Token0 Ether0.000185444
0x808cb58d75a73b3bbd208c9e29f383ba887247298f5c113d4a27faaf30238c35Withdraw Tax Ear...79188522019-06-08 14:18:251277 days 20 hrs agoENS Name shortcut2.eth IN  PlanetCrypto: PLANET Token0 Ether0.0005040420
0xb80342fd80e8a1eda13ac2d03f29d53192c74a3dc935e1518f461bee35f70481Withdraw Tax Ear...77482102019-05-12 21:58:421304 days 12 hrs ago0x6af8c99bbc553e2252f8969f97f6b327dfc88496 IN  PlanetCrypto: PLANET Token0 Ether0.00002521
[ Download CSV Export 

OVERVIEW

Planet Crypto lets you own virtual plots of the entire planet! We've put the entire globe onto the blockchain. Buy up landmarks, building and other properties around the world and add them to your collection.... use hostile take-overs to increase your Empire Score to earn more ETH!

Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x23df9e1e677ef457e0bf3d6af3eb586b1aec14d786b036f063ae168fa0c55fba153147522022-08-10 13:59:15118 days 20 hrs ago PlanetCrypto: PLANET TokenPlanetCrypto: Deployer0.423 Ether
0x7785872dd2055ac4720a005719163fb84b87730c9212437102f8fafdf0eb2e0f153147322022-08-10 13:55:58118 days 20 hrs ago PlanetCrypto: PLANET TokenPlanetCrypto: Deployer0.05 Ether
0x02a96b78ffb95f0f10da372cc07f1f3cd7dd7feb41359dc8748a4a4cf45d6259135677272021-11-07 6:08:21395 days 4 hrs ago PlanetCrypto: PLANET Token0x83d94fdc84b5647151d8de040cceca6917fdb6c00.08505691 Ether
0x3f952ba377c3256398d6aadaf7cc795d96828cc2f4963e08869ac985230130be93845382020-01-30 16:13:451041 days 18 hrs ago PlanetCrypto: PLANET TokenENS Name ry4n.blahblahblah.eth0.00512904 Ether
0x4dfaed55e8538ae83ffb55109adfb574e4c864238c878414eda45feeecb3fdf286590142019-10-01 21:54:351162 days 12 hrs ago PlanetCrypto: PLANET Token0xba21d01125d6932ce8abf3625977899fd2c7fa300.00599938 Ether
0x787ee8af8a150518a4a2667341adbc2fcb08d941b991566bbf41a07d687ffd6c85659652019-09-17 8:49:091177 days 1 hr ago PlanetCrypto: PLANET TokenENS Name dreadnaught.eth0.02723901 Ether
0xa99f15c1a8e4f15b82cbbc8e8b44c969ea4c342be6c9d79424ce2321cb7f5ec182443402019-07-29 7:57:381227 days 2 hrs ago PlanetCrypto: PLANET Token0xd71c9831d5bc11a48170d0cbfd5f8a5e39e91edd0.00907961 Ether
0x562f320c49d58ddac8f7635a49b7c20b66640584611211c91ff048b27342181982337412019-07-27 16:33:281228 days 18 hrs ago PlanetCrypto: PLANET TokenENS Name rarart.eth0.02045922 Ether
0xa0d476c06ef58943ba1ecc7301f3ee43056383683ec03fbb0440decbb2dee4e580892792019-07-05 4:59:461251 days 5 hrs ago PlanetCrypto: PLANET TokenSybil Delegate: AlvaroCabreraO10.00678499 Ether
0xfa682ee760da2be7d12be108b810fc4a4f3a6a632d09e536d5a731d67ccda01d80517572019-06-29 8:42:441257 days 2 hrs ago PlanetCrypto: PLANET Token0x8a820adf409345e382261f558185749e9bba94340.12164971 Ether
0x808cb58d75a73b3bbd208c9e29f383ba887247298f5c113d4a27faaf30238c3579188522019-06-08 14:18:251277 days 20 hrs ago PlanetCrypto: PLANET TokenENS Name shortcut2.eth0.00569894 Ether
0xb80342fd80e8a1eda13ac2d03f29d53192c74a3dc935e1518f461bee35f7048177482102019-05-12 21:58:421304 days 12 hrs ago PlanetCrypto: PLANET Token0x6af8c99bbc553e2252f8969f97f6b327dfc884960.00047994 Ether
0xcb170094751cdcc7dc397e0c7f00bd32e5789c7cb58635c57953b33dd94bf2d577013942019-05-05 14:12:541311 days 20 hrs ago PlanetCrypto: PLANET Token0x37878b61525441ac2ece66b4a6e0d9f67f22a9d80.00112974 Ether
0xf5a8aee9f56cbc07233bfb09ff41902c72b7db851b998fe9f5ee4e17084dfa6676813922019-05-02 11:38:561314 days 23 hrs ago PlanetCrypto: PLANET Token0xad24c49769d79e713d864d74a4ee75b3835b83a80.00230439 Ether
0x0c176cef640340ee109c7b327cfac097a9f07299bfa2e10dda3a2062c31f1dc776723952019-05-01 2:00:491316 days 8 hrs ago PlanetCrypto: PLANET TokenENS Name gdw.eth0.00159569 Ether
0xe8a5d1e9d5d5d5c6eeaec56d327326f5ea0518cc4e4656d248a392678f081f4d76676152019-04-30 8:08:441317 days 2 hrs ago PlanetCrypto: PLANET Token0xefc538603b0a2727a9f372db039781c538944ab90.0472229 Ether
0xead8c4cb0ecdf02ba0bfe2b42e512404bc9e6bdf37acfb2b8433c8e9cc1dee9276673282019-04-30 6:58:221317 days 3 hrs ago PlanetCrypto: PLANET TokenPlanetCrypto: Deployer0.035865 Ether
0x859812805a0fe892950ce024de203c4d7044277bb0d191c9138fa04215ea6cb576672982019-04-30 6:53:361317 days 3 hrs ago PlanetCrypto: PLANET TokenPlanetCrypto: Deployer0.286536 Ether
0xed38774221339efffcb7461c16399d307d1e956223b19356b7bef64c5052582f76661612019-04-30 2:40:121317 days 8 hrs ago PlanetCrypto: PLANET TokenPlanetCrypto: Deployer0.178935 Ether
0x4fbbe09354f9f17db6a6b06f9b01fd58b4f3e895b14e239562fbff1302ceed9576584052019-04-28 21:44:221318 days 13 hrs ago PlanetCrypto: PLANET TokenPlanetCrypto: Deployer0.07155 Ether
0xc4ea1e84757b5a192257432388006d902e267936870bebf1d473477d40666f5776293002019-04-24 9:17:401323 days 1 hr ago PlanetCrypto: PLANET Token0xefc538603b0a2727a9f372db039781c538944ab90.01248309 Ether
0xbbc6af85f62070b56b1aa00537798127a1f8c7daf7be681b63e4a6c976cb607576271752019-04-24 1:17:041323 days 9 hrs ago PlanetCrypto: PLANET TokenPlanetCrypto: Deployer0.035769 Ether
0x639dd04e4793b10b4a71f0ac9f3d1fcda0914b6e4711b11328246719ceeefed275664252019-04-14 13:48:021332 days 20 hrs ago PlanetCrypto: PLANET Token0xd9b02a10935d8aa1db1fd31919365fe1725869060.01239084 Ether
0xf71687f10c8fcc79a5bd80e7772f8fd0887cbaee7b012671270b3cc7d3a1186b75660232019-04-14 12:18:431332 days 22 hrs ago PlanetCrypto: PLANET TokenPlanetCrypto: Deployer0.017883 Ether
0xa4c0dea157150695ae6177cc4b3e1aead1e09e2a08e3996a6b8f95df2bbcc40c75659952019-04-14 12:11:011332 days 22 hrs ago PlanetCrypto: PLANET TokenPlanetCrypto: Deployer0.0178815 Ether
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PlanetCryptoToken

Compiler Version
v0.4.25+commit.59dbf8f1

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2019-01-11
*/

pragma solidity ^0.4.24;

/**
 * @title IERC165
 * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
 */
interface IERC165 {

  /**
   * @notice Query if a contract implements an interface
   * @param interfaceId The interface identifier, as specified in ERC-165
   * @dev Interface identification is specified in ERC-165. This function
   * uses less than 30,000 gas.
   */
  function supportsInterface(bytes4 interfaceId)
    external
    view
    returns (bool);
}



/**
 * @title ERC165
 * @author Matt Condon (@shrugs)
 * @dev Implements ERC165 using a lookup table.
 */
contract ERC165 is IERC165 {

  bytes4 private constant _InterfaceId_ERC165 = 0x01ffc9a7;
  /**
   * 0x01ffc9a7 ===
   *   bytes4(keccak256('supportsInterface(bytes4)'))
   */

  /**
   * @dev a mapping of interface id to whether or not it's supported
   */
  mapping(bytes4 => bool) private _supportedInterfaces;

  /**
   * @dev A contract implementing SupportsInterfaceWithLookup
   * implement ERC165 itself
   */
  constructor()
    internal
  {
    _registerInterface(_InterfaceId_ERC165);
  }

  /**
   * @dev implement supportsInterface(bytes4) using a lookup table
   */
  function supportsInterface(bytes4 interfaceId)
    external
    view
    returns (bool)
  {
    return _supportedInterfaces[interfaceId];
  }

  /**
   * @dev internal method for registering an interface
   */
  function _registerInterface(bytes4 interfaceId)
    internal
  {
    require(interfaceId != 0xffffffff);
    _supportedInterfaces[interfaceId] = true;
  }
}




/**
 * @title ERC721 Non-Fungible Token Standard basic interface
 * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract IERC721 is IERC165 {

  event Transfer(
    address indexed from,
    address indexed to,
    uint256 indexed tokenId
  );
  event Approval(
    address indexed owner,
    address indexed approved,
    uint256 indexed tokenId
  );
  event ApprovalForAll(
    address indexed owner,
    address indexed operator,
    bool approved
  );

  function balanceOf(address owner) public view returns (uint256 balance);
  function ownerOf(uint256 tokenId) public view returns (address owner);

  function approve(address to, uint256 tokenId) public;
  function getApproved(uint256 tokenId)
    public view returns (address operator);

  function setApprovalForAll(address operator, bool _approved) public;
  function isApprovedForAll(address owner, address operator)
    public view returns (bool);

  /*function transferFrom(address from, address to, uint256 tokenId) public;*/
  /*function safeTransferFrom(address from, address to, uint256 tokenId)
    public;*/

  /*function safeTransferFrom(
    address from,
    address to,
    uint256 tokenId,
    bytes data
  )
    public;*/
}


/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
contract IERC721Receiver {
  /**
   * @notice Handle the receipt of an NFT
   * @dev The ERC721 smart contract calls this function on the recipient
   * after a `safeTransfer`. This function MUST return the function selector,
   * otherwise the caller will revert the transaction. The selector to be
   * returned can be obtained as `this.onERC721Received.selector`. This
   * function MAY throw to revert and reject the transfer.
   * Note: the ERC721 contract address is always the message sender.
   * @param operator The address which called `safeTransferFrom` function
   * @param from The address which previously owned the token
   * @param tokenId The NFT identifier which is being transferred
   * @param data Additional data with no specified format
   * @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
   */
  function onERC721Received(
    address operator,
    address from,
    uint256 tokenId,
    bytes data
  )
    public
    returns(bytes4);
}


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

  /**
  * @dev Multiplies two numbers, reverts on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
    // benefit is lost if 'b' is also tested.
    // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
    if (a == 0) {
      return 0;
    }

    uint256 c = a * b;
    require(c / a == b);

    return c;
  }

  /**
  * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
  */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b > 0); // Solidity only automatically asserts when dividing by 0
    uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold

    return c;
  }

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

    return c;
  }

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

    return c;
  }

  /**
  * @dev Divides two numbers and returns the remainder (unsigned integer modulo),
  * reverts when dividing by zero.
  */
  /*
  function mod(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b != 0);
    return a % b;
  }
  */
}


/**
 * Utility library of inline functions on addresses
 */
library Address {

  /**
   * Returns whether the target address is a contract
   * @dev This function will return false if invoked during the constructor of a contract,
   * as the code is not actually created until after the constructor finishes.
   * @param account address of the account to check
   * @return whether the target address is a contract
   */
  function isContract(address account) internal view returns (bool) {
    uint256 size;
    // XXX Currently there is no better way to check if there is a contract in an address
    // than to check the size of the code at that address.
    // See https://ethereum.stackexchange.com/a/14016/36603
    // for more details about how this works.
    // TODO Check this again before the Serenity release, because all addresses will be
    // contracts then.
    // solium-disable-next-line security/no-inline-assembly
    assembly { size := extcodesize(account) }
    return size > 0;
  }

}


/**
 * @title ERC721 Non-Fungible Token Standard basic implementation
 * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract ERC721_custom is ERC165, IERC721 {

  using SafeMath for uint256;
  using Address for address;

  // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
  // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
  bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;

  // Mapping from token ID to owner
  mapping (uint256 => address) private _tokenOwner;

  // Mapping from token ID to approved address
  mapping (uint256 => address) private _tokenApprovals;

  // Mapping from owner to number of owned token
  mapping (address => uint256) private _ownedTokensCount;

  // Mapping from owner to operator approvals
  mapping (address => mapping (address => bool)) private _operatorApprovals;

  bytes4 private constant _InterfaceId_ERC721 = 0x80ac58cd;
  /*
   * 0x80ac58cd ===
   *   bytes4(keccak256('balanceOf(address)')) ^
   *   bytes4(keccak256('ownerOf(uint256)')) ^
   *   bytes4(keccak256('approve(address,uint256)')) ^
   *   bytes4(keccak256('getApproved(uint256)')) ^
   *   bytes4(keccak256('setApprovalForAll(address,bool)')) ^
   *   bytes4(keccak256('isApprovedForAll(address,address)')) ^
   *   bytes4(keccak256('transferFrom(address,address,uint256)')) ^
   *   bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^
   *   bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)'))
   */

  constructor()
    public
  {
    // register the supported interfaces to conform to ERC721 via ERC165
    _registerInterface(_InterfaceId_ERC721);
  }

  /**
   * @dev Gets the balance of the specified address
   * @param owner address to query the balance of
   * @return uint256 representing the amount owned by the passed address
   */
  function balanceOf(address owner) public view returns (uint256) {
    require(owner != address(0));
    return _ownedTokensCount[owner];
  }

  /**
   * @dev Gets the owner of the specified token ID
   * @param tokenId uint256 ID of the token to query the owner of
   * @return owner address currently marked as the owner of the given token ID
   */
  function ownerOf(uint256 tokenId) public view returns (address) {
    address owner = _tokenOwner[tokenId];
    require(owner != address(0));
    return owner;
  }

  /**
   * @dev Approves another address to transfer the given token ID
   * The zero address indicates there is no approved address.
   * There can only be one approved address per token at a given time.
   * Can only be called by the token owner or an approved operator.
   * @param to address to be approved for the given token ID
   * @param tokenId uint256 ID of the token to be approved
   */
  function approve(address to, uint256 tokenId) public {
    address owner = ownerOf(tokenId);
    require(to != owner);
    require(msg.sender == owner || isApprovedForAll(owner, msg.sender));

    _tokenApprovals[tokenId] = to;
    emit Approval(owner, to, tokenId);
  }

  /**
   * @dev Gets the approved address for a token ID, or zero if no address set
   * Reverts if the token ID does not exist.
   * @param tokenId uint256 ID of the token to query the approval of
   * @return address currently approved for the given token ID
   */
  function getApproved(uint256 tokenId) public view returns (address) {
    require(_exists(tokenId));
    return _tokenApprovals[tokenId];
  }

  /**
   * @dev Sets or unsets the approval of a given operator
   * An operator is allowed to transfer all tokens of the sender on their behalf
   * @param to operator address to set the approval
   * @param approved representing the status of the approval to be set
   */
  function setApprovalForAll(address to, bool approved) public {
    require(to != msg.sender);
    _operatorApprovals[msg.sender][to] = approved;
    emit ApprovalForAll(msg.sender, to, approved);
  }

  /**
   * @dev Tells whether an operator is approved by a given owner
   * @param owner owner address which you want to query the approval of
   * @param operator operator address which you want to query the approval of
   * @return bool whether the given operator is approved by the given owner
   */
  function isApprovedForAll(
    address owner,
    address operator
  )
    public
    view
    returns (bool)
  {
    return _operatorApprovals[owner][operator];
  }

  /**
   * @dev Transfers the ownership of a given token ID to another address
   * Usage of this method is discouraged, use `safeTransferFrom` whenever possible
   * Requires the msg sender to be the owner, approved, or operator
   * @param from current owner of the token
   * @param to address to receive the ownership of the given token ID
   * @param tokenId uint256 ID of the token to be transferred
  */
  function transferFrom(
    address from,
    address to,
    uint256 tokenId
  )
    public
  {
    require(_isApprovedOrOwner(msg.sender, tokenId));
  //  require(to != address(0));

    _clearApproval(from, tokenId);
    _removeTokenFrom(from, tokenId);
    _addTokenTo(to, tokenId);

    emit Transfer(from, to, tokenId);
  }
  
  
  
  
    function internal_transferFrom(
        address _from,
        address to,
        uint256 tokenId
    )
    internal
  {
    // permissions already checked on price basis
    
   // require(to != address(0));

    if (_tokenApprovals[tokenId] != address(0)) {
      _tokenApprovals[tokenId] = address(0);
    }
    
    //_removeTokenFrom(from, tokenId);
    if(_ownedTokensCount[_from] > 1) {
    _ownedTokensCount[_from] = _ownedTokensCount[_from] -1; //.sub(1); // error here
    // works without .sub()????
    
    }
    _tokenOwner[tokenId] = address(0); 
    
    _addTokenTo(to, tokenId); // error here?

    emit Transfer(_from, to, tokenId);
    
  }

  /**
   * @dev Safely transfers the ownership of a given token ID to another address
   * If the target address is a contract, it must implement `onERC721Received`,
   * which is called upon a safe transfer, and return the magic value
   * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
   * the transfer is reverted.
   *
   * Requires the msg sender to be the owner, approved, or operator
   * @param from current owner of the token
   * @param to address to receive the ownership of the given token ID
   * @param tokenId uint256 ID of the token to be transferred
  */
  /*function safeTransferFrom(
    address from,
    address to,
    uint256 tokenId
  )
    public
  {
    // solium-disable-next-line arg-overflow
    safeTransferFrom(from, to, tokenId, "");
  }*/

  /**
   * @dev Safely transfers the ownership of a given token ID to another address
   * If the target address is a contract, it must implement `onERC721Received`,
   * which is called upon a safe transfer, and return the magic value
   * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
   * the transfer is reverted.
   * Requires the msg sender to be the owner, approved, or operator
   * @param from current owner of the token
   * @param to address to receive the ownership of the given token ID
   * @param tokenId uint256 ID of the token to be transferred
   * @param _data bytes data to send along with a safe transfer check
   */
  /*function safeTransferFrom(
    address from,
    address to,
    uint256 tokenId,
    bytes _data
  )
    public
  {
    transferFrom(from, to, tokenId);
    // solium-disable-next-line arg-overflow
    require(_checkOnERC721Received(from, to, tokenId, _data));
  }*/

  /**
   * @dev Returns whether the specified token exists
   * @param tokenId uint256 ID of the token to query the existence of
   * @return whether the token exists
   */
  function _exists(uint256 tokenId) internal view returns (bool) {
    address owner = _tokenOwner[tokenId];
    return owner != address(0);
  }

  /**
   * @dev Returns whether the given spender can transfer a given token ID
   * @param spender address of the spender to query
   * @param tokenId uint256 ID of the token to be transferred
   * @return bool whether the msg.sender is approved for the given token ID,
   *  is an operator of the owner, or is the owner of the token
   */
  function _isApprovedOrOwner(
    address spender,
    uint256 tokenId
  )
    internal
    view
    returns (bool)
  {
    address owner = ownerOf(tokenId);
    // Disable solium check because of
    // https://github.com/duaraghav8/Solium/issues/175
    // solium-disable-next-line operator-whitespace
    return (
      spender == owner ||
      getApproved(tokenId) == spender ||
      isApprovedForAll(owner, spender)
    );
  }

  /**
   * @dev Internal function to mint a new token
   * Reverts if the given token ID already exists
   * @param to The address that will own the minted token
   * @param tokenId uint256 ID of the token to be minted by the msg.sender
   */
  function _mint(address to, uint256 tokenId) internal {
    require(to != address(0));
    _addTokenTo(to, tokenId);
    emit Transfer(address(0), to, tokenId);
  }

  /**
   * @dev Internal function to burn a specific token
   * Reverts if the token does not exist
   * @param tokenId uint256 ID of the token being burned by the msg.sender
   */
  function _burn(address owner, uint256 tokenId) internal {
    _clearApproval(owner, tokenId);
    _removeTokenFrom(owner, tokenId);
    emit Transfer(owner, address(0), tokenId);
  }

  /**
   * @dev Internal function to add a token ID to the list of a given address
   * Note that this function is left internal to make ERC721Enumerable possible, but is not
   * intended to be called by custom derived contracts: in particular, it emits no Transfer event.
   * @param to address representing the new owner of the given token ID
   * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
   */
  function _addTokenTo(address to, uint256 tokenId) internal {
    require(_tokenOwner[tokenId] == address(0));
    _tokenOwner[tokenId] = to;
    _ownedTokensCount[to] = _ownedTokensCount[to].add(1);
  }

  /**
   * @dev Internal function to remove a token ID from the list of a given address
   * Note that this function is left internal to make ERC721Enumerable possible, but is not
   * intended to be called by custom derived contracts: in particular, it emits no Transfer event,
   * and doesn't clear approvals.
   * @param from address representing the previous owner of the given token ID
   * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
   */
  function _removeTokenFrom(address from, uint256 tokenId) internal {
    require(ownerOf(tokenId) == from);
    _ownedTokensCount[from] = _ownedTokensCount[from].sub(1);
    _tokenOwner[tokenId] = address(0);
  }
  
  

  /**
   * @dev Internal function to invoke `onERC721Received` on a target address
   * The call is not executed if the target address is not a contract
   * @param from address representing the previous owner of the given token ID
   * @param to target address that will receive the tokens
   * @param tokenId uint256 ID of the token to be transferred
   * @param _data bytes optional data to send along with the call
   * @return whether the call correctly returned the expected magic value
   */
  function _checkOnERC721Received(
    address from,
    address to,
    uint256 tokenId,
    bytes _data
  )
    internal
    returns (bool)
  {
    if (!to.isContract()) {
      return true;
    }
    bytes4 retval = IERC721Receiver(to).onERC721Received(
      msg.sender, from, tokenId, _data);
    return (retval == _ERC721_RECEIVED);
  }

  /**
   * @dev Private function to clear current approval of a given token ID
   * Reverts if the given address is not indeed the owner of the token
   * @param owner owner of the token
   * @param tokenId uint256 ID of the token to be transferred
   */
  function _clearApproval(address owner, uint256 tokenId) private {
    require(ownerOf(tokenId) == owner);
    if (_tokenApprovals[tokenId] != address(0)) {
      _tokenApprovals[tokenId] = address(0);
    }
  }
}




/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract IERC721Enumerable is IERC721 {
  function totalSupply() public view returns (uint256);
  function tokenOfOwnerByIndex(
    address owner,
    uint256 index
  )
    public
    view
    returns (uint256 tokenId);

  function tokenByIndex(uint256 index) public view returns (uint256);
}



/**
 * @title ERC-721 Non-Fungible Token with optional enumeration extension logic
 * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract ERC721Enumerable_custom is ERC165, ERC721_custom, IERC721Enumerable {
  // Mapping from owner to list of owned token IDs
  mapping(address => uint256[]) private _ownedTokens;

  // Mapping from token ID to index of the owner tokens list
  mapping(uint256 => uint256) private _ownedTokensIndex;

  // Array with all token ids, used for enumeration
  uint256[] private _allTokens;

  // Mapping from token id to position in the allTokens array
  mapping(uint256 => uint256) private _allTokensIndex;

  bytes4 private constant _InterfaceId_ERC721Enumerable = 0x780e9d63;
  /**
   * 0x780e9d63 ===
   *   bytes4(keccak256('totalSupply()')) ^
   *   bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^
   *   bytes4(keccak256('tokenByIndex(uint256)'))
   */

  /**
   * @dev Constructor function
   */
  constructor() public {
    // register the supported interface to conform to ERC721 via ERC165
    _registerInterface(_InterfaceId_ERC721Enumerable);
  }

  /**
   * @dev Gets the token ID at a given index of the tokens list of the requested owner
   * @param owner address owning the tokens list to be accessed
   * @param index uint256 representing the index to be accessed of the requested tokens list
   * @return uint256 token ID at the given index of the tokens list owned by the requested address
   */
  function tokenOfOwnerByIndex(
    address owner,
    uint256 index
  )
    public
    view
    returns (uint256)
  {
    require(index < balanceOf(owner));
    return _ownedTokens[owner][index];
  }

  /**
   * @dev Gets the total amount of tokens stored by the contract
   * @return uint256 representing the total amount of tokens
   */
  function totalSupply() public view returns (uint256) {
    return _allTokens.length;
  }

  /**
   * @dev Gets the token ID at a given index of all the tokens in this contract
   * Reverts if the index is greater or equal to the total number of tokens
   * @param index uint256 representing the index to be accessed of the tokens list
   * @return uint256 token ID at the given index of the tokens list
   */
  function tokenByIndex(uint256 index) public view returns (uint256) {
    require(index < totalSupply());
    return _allTokens[index];
  }

  /**
   * @dev Internal function to add a token ID to the list of a given address
   * This function is internal due to language limitations, see the note in ERC721.sol.
   * It is not intended to be called by custom derived contracts: in particular, it emits no Transfer event.
   * @param to address representing the new owner of the given token ID
   * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
   */
  function _addTokenTo(address to, uint256 tokenId) internal {
    super._addTokenTo(to, tokenId);
    uint256 length = _ownedTokens[to].length;
    _ownedTokens[to].push(tokenId);
    _ownedTokensIndex[tokenId] = length;
  }

  /**
   * @dev Internal function to remove a token ID from the list of a given address
   * This function is internal due to language limitations, see the note in ERC721.sol.
   * It is not intended to be called by custom derived contracts: in particular, it emits no Transfer event,
   * and doesn't clear approvals.
   * @param from address representing the previous owner of the given token ID
   * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
   */
  function _removeTokenFrom(address from, uint256 tokenId) internal {
    super._removeTokenFrom(from, tokenId);

    // To prevent a gap in the array, we store the last token in the index of the token to delete, and
    // then delete the last slot.
    uint256 tokenIndex = _ownedTokensIndex[tokenId];
    uint256 lastTokenIndex = _ownedTokens[from].length.sub(1);
    uint256 lastToken = _ownedTokens[from][lastTokenIndex];

    _ownedTokens[from][tokenIndex] = lastToken;
    // This also deletes the contents at the last position of the array
    _ownedTokens[from].length--;

    // Note that this will handle single-element arrays. In that case, both tokenIndex and lastTokenIndex are going to
    // be zero. Then we can make sure that we will remove tokenId from the ownedTokens list since we are first swapping
    // the lastToken to the first position, and then dropping the element placed in the last position of the list

    _ownedTokensIndex[tokenId] = 0;
    _ownedTokensIndex[lastToken] = tokenIndex;
  }

  /**
   * @dev Internal function to mint a new token
   * Reverts if the given token ID already exists
   * @param to address the beneficiary that will own the minted token
   * @param tokenId uint256 ID of the token to be minted by the msg.sender
   */
  function _mint(address to, uint256 tokenId) internal {
    super._mint(to, tokenId);

    _allTokensIndex[tokenId] = _allTokens.length;
    _allTokens.push(tokenId);
  }

  /**
   * @dev Internal function to burn a specific token
   * Reverts if the token does not exist
   * @param owner owner of the token to burn
   * @param tokenId uint256 ID of the token being burned by the msg.sender
   */
  function _burn(address owner, uint256 tokenId) internal {
    super._burn(owner, tokenId);

    // Reorg all tokens array
    uint256 tokenIndex = _allTokensIndex[tokenId];
    uint256 lastTokenIndex = _allTokens.length.sub(1);
    uint256 lastToken = _allTokens[lastTokenIndex];

    _allTokens[tokenIndex] = lastToken;
    _allTokens[lastTokenIndex] = 0;

    _allTokens.length--;
    _allTokensIndex[tokenId] = 0;
    _allTokensIndex[lastToken] = tokenIndex;
  }
}






contract IERC721Metadata is IERC721 {
  function name() external view returns (string);
  function symbol() external view returns (string);
  function tokenURI(uint256 tokenId) external view returns (string);
}


contract ERC721Metadata_custom is ERC165, ERC721_custom, IERC721Metadata {
  // Token name
  string private _name;

  // Token symbol
  string private _symbol;

  // Optional mapping for token URIs
  mapping(uint256 => string) private _tokenURIs;

  bytes4 private constant InterfaceId_ERC721Metadata = 0x5b5e139f;
  /**
   * 0x5b5e139f ===
   *   bytes4(keccak256('name()')) ^
   *   bytes4(keccak256('symbol()')) ^
   *   bytes4(keccak256('tokenURI(uint256)'))
   */

  /**
   * @dev Constructor function
   */
  constructor(string name, string symbol) public {
    _name = name;
    _symbol = symbol;

    // register the supported interfaces to conform to ERC721 via ERC165
    _registerInterface(InterfaceId_ERC721Metadata);
  }

  function name() external view returns (string) {
    return _name;
  }

  
  function symbol() external view returns (string) {
    return _symbol;
  }

  /*
  function tokenURI(uint256 tokenId) external view returns (string) {
    require(_exists(tokenId));
    return _tokenURIs[tokenId];
  }

  
  function _setTokenURI(uint256 tokenId, string uri) internal {
    require(_exists(tokenId));
    _tokenURIs[tokenId] = uri;
  }
*/
  
  function _burn(address owner, uint256 tokenId) internal {
    super._burn(owner, tokenId);

    // Clear metadata (if any)
    if (bytes(_tokenURIs[tokenId]).length != 0) {
      delete _tokenURIs[tokenId];
    }
  }
}


contract ERC721Full_custom is ERC721_custom, ERC721Enumerable_custom, ERC721Metadata_custom {
  constructor(string name, string symbol) ERC721Metadata_custom(name, symbol)
    public
  {
  }
}


interface PlanetCryptoCoin_I {
    function balanceOf(address owner) external returns(uint256);
    function transfer(address to, uint256 value) external returns (bool);
    function transferFrom(address from, address to, uint256 value) external returns(bool);
}

interface PlanetCryptoUtils_I {
    function validateLand(address _sender, int256[] plots_lat, int256[] plots_lng) external returns(bool);
    function validatePurchase(address _sender, uint256 _value, int256[] plots_lat, int256[] plots_lng) external returns(bool);
    function validateTokenPurchase(address _sender, int256[] plots_lat, int256[] plots_lng) external returns(bool);
    function validateResale(address _sender, uint256 _value, uint256 _token_id) external returns(bool);
    function validateLandTakeover(address _sender, uint256 _value, uint256 _token_id) external returns(bool);
    //UTILS
    function strConcat(string _a, string _b, string _c, string _d, string _e, string _f) external view returns (string);
    function strConcat(string _a, string _b, string _c, string _d, string _e) external view returns (string);
    function strConcat(string _a, string _b, string _c, string _d) external view returns (string);
    function strConcat(string _a, string _b, string _c) external view returns (string);
    function strConcat(string _a, string _b) external view returns (string);
    function int2str(int i) external view returns (string);
    function uint2str(uint i) external view returns (string);
    function substring(string str, uint startIndex, uint endIndex) external view returns (string);
    function utfStringLength(string str) external view returns (uint length);
    function ceil1(int256 a, int256 m) external view returns (int256 );
    function parseInt(string _a, uint _b) external view returns (uint);
    
    function roundLatLngFull(uint8 _zoomLvl, int256 __in) external pure returns(int256);
}

interface PlanetCryptoToken_I {
    
    function all_playerObjects(uint256) external returns(
        address playerAddress,
        uint256 lastAccess,
        uint256 totalEmpireScore,
        uint256 totalLand);
        
    function balanceOf(address) external returns(uint256);
    
    function getAllPlayerObjectLen() external returns(uint256);
    
    function getToken(uint256 _token_id, bool isBasic) external returns(
        address token_owner,
        bytes32  name,
        uint256 orig_value,
        uint256 current_value,
        uint256 empire_score,
        int256[] plots_lat,
        int256[] plots_lng
        );
        
    
    function tax_distributed() external returns(uint256);
    function tax_fund() external returns(uint256);
    
    function taxEarningsAvailable() external returns(uint256);
    
    function tokens_rewards_allocated() external returns(uint256);
    function tokens_rewards_available() external returns(uint256);
    
    function total_empire_score() external returns(uint256);
    function total_land_sold() external returns(uint256);
    function total_trades() external returns(uint256);
    function totalSupply() external returns(uint256);
    function current_plot_price() external returns(uint256);
    
    
}


library Percent {

  struct percent {
    uint num;
    uint den;
  }
  function mul(percent storage p, uint a) internal view returns (uint) {
    if (a == 0) {
      return 0;
    }
    return a*p.num/p.den;
  }
/*
  function div(percent storage p, uint a) internal view returns (uint) {
    return a/p.num*p.den;
  }

  function sub(percent storage p, uint a) internal view returns (uint) {
    uint b = mul(p, a);
    if (b >= a) return 0;
    return a - b;
  }

  function add(percent storage p, uint a) internal view returns (uint) {
    return a + mul(p, a);
  }
*/
}



contract PlanetCryptoToken is ERC721Full_custom{
    
    using Percent for Percent.percent;
    
    
    // EVENTS
        
    event referralPaid(address indexed search_to,
                    address to, uint256 amnt, uint256 timestamp);
    
    event issueCoinTokens(address indexed searched_to, 
                    address to, uint256 amnt, uint256 timestamp);
    
    event landPurchased(uint256 indexed search_token_id, address indexed search_buyer, 
            uint256 token_id, address buyer, bytes32 name, int256 center_lat, int256 center_lng, uint256 size, uint256 bought_at, uint256 empire_score, uint256 timestamp);
    
    event taxDistributed(uint256 amnt, uint256 total_players, uint256 timestamp);
    
    event cardBought(
                    uint256 indexed search_token_id, address indexed search_from, address indexed search_to,
                    uint256 token_id, address from, address to, 
                    bytes32 name,
                    uint256 orig_value, 
                    uint256 new_value,
                    uint256 empireScore, uint256 newEmpireScore, uint256 timestamp);

    event cardChange(
            uint256 indexed search_token_id,
            address indexed search_owner, 
            uint256 token_id,
            address owner, uint256 changeType, bytes32 data, uint256 timestamp);
            

    // CONTRACT MANAGERS
    address owner;
    address devBankAddress; // where marketing funds are sent
    address tokenBankAddress; 

    // MODIFIERS
    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }
    
    modifier validateLand(int256[] plots_lat, int256[] plots_lng) {
        
        require(planetCryptoUtils_interface.validateLand(msg.sender, plots_lat, plots_lng) == true, "Some of this land already owned!");

        
        _;
    }
    
    modifier validatePurchase(int256[] plots_lat, int256[] plots_lng) {

        require(planetCryptoUtils_interface.validatePurchase(msg.sender, msg.value, plots_lat, plots_lng) == true, "Not enough ETH!");
        _;
    }
    
    
    modifier validateTokenPurchase(int256[] plots_lat, int256[] plots_lng) {

        require(planetCryptoUtils_interface.validateTokenPurchase(msg.sender, plots_lat, plots_lng) == true, "Not enough COINS to buy these plots!");
        

        

        require(planetCryptoCoin_interface.transferFrom(msg.sender, tokenBankAddress, plots_lat.length) == true, "Token transfer failed");
        
        
        _;
    }
    
    
    modifier validateResale(uint256 _token_id) {
        require(planetCryptoUtils_interface.validateResale(msg.sender, msg.value, _token_id) == true, "Not enough ETH to buy this card!");
        _;
    }
    
    
    modifier updateUsersLastAccess() {
        
        uint256 allPlyersIdx = playerAddressToPlayerObjectID[msg.sender];
        if(allPlyersIdx == 0){

            all_playerObjects.push(player(msg.sender,now,0,0));
            playerAddressToPlayerObjectID[msg.sender] = all_playerObjects.length-1;
        } else {
            all_playerObjects[allPlyersIdx].lastAccess = now;
        }
        
        _;
    }
    
    // STRUCTS
    struct plotDetail {
        bytes32 name;
        uint256 orig_value;
        uint256 current_value;
        uint256 empire_score;
        int256[] plots_lat;
        int256[] plots_lng;
        bytes32 img;
    }
    
    struct plotBasic {
        int256 lat;
        int256 lng;
    }
    
    struct player {
        address playerAddress;
        uint256 lastAccess;
        uint256 totalEmpireScore;
        uint256 totalLand;
        
        
    }
    

    // INTERFACES
    address planetCryptoCoinAddress = 0xA1c8031EF18272d8BfeD22E1b61319D6d9d2881B; // mainnet
    //address planetCryptoCoinAddress = 0xe1418a2546fe0c35653c89b354978bd1772bb431; // ropsten
    PlanetCryptoCoin_I internal planetCryptoCoin_interface;
    

    address planetCryptoUtilsAddress = 0x40089b9f4d5eb36d62548133f32e52b14fa54c52; // mainnet
    //address planetCryptoUtilsAddress = 0x7e3d67c3b1469f152f38367c06463917412c9c19; // ropsten
    PlanetCryptoUtils_I internal planetCryptoUtils_interface;
    
    
    
    // settings
    Percent.percent private m_newPlot_devPercent = Percent.percent(75,100); //75/100*100% = 75%
    Percent.percent private m_newPlot_taxPercent = Percent.percent(25,100); //25%
    
    Percent.percent private m_resalePlot_devPercent = Percent.percent(10,100); // 10%
    Percent.percent private m_resalePlot_taxPercent = Percent.percent(10,100); // 10%
    Percent.percent private m_resalePlot_ownerPercent = Percent.percent(80,100); // 80%
    
    //Percent.percent private m_takeoverPlot_devPercent = Percent.percent(10,100); // 10%
    //Percent.percent private m_takeoverPlot_taxPercent = Percent.percent(10,100); // 10%
    //Percent.percent private m_takeoverPlot_ownerPercent = Percent.percent(80,100); // 80%
    
    Percent.percent private m_refPercent = Percent.percent(5,100); // 5% referral 
    
    Percent.percent private m_empireScoreMultiplier = Percent.percent(150,100); // 150%
    Percent.percent private m_resaleMultipler = Percent.percent(200,100); // 200%;

    

    
    
    uint256 public devHoldings = 0; // holds dev funds in cases where the instant transfer fails


    mapping(address => uint256) internal playersFundsOwed;




    // add in limit of land plots before tokens stop being distributed
    uint256 public tokens_rewards_available;
    uint256 public tokens_rewards_allocated;
    
    // add in spend amount required to earn tokens
    uint256 public min_plots_purchase_for_token_reward = 10;
    uint256 public plots_token_reward_divisor = 10;
    
    
    // GAME SETTINGS
    uint256 public current_plot_price = 20000000000000000;
    uint256 public price_update_amount = 2000000000000;
    uint256 public cardChangeNameCost = 50000000000000000;
    uint256 public cardImageCost = 100000000000000000;

    uint256 public current_plot_empire_score = 100;

    string public baseURI = 'https://planetcrypto.app/api/token/';
    
    
    uint256 public tax_fund = 0;
    uint256 public tax_distributed = 0;


    // GAME STATS
    uint256 public tokenIDCount = 0;
    bool public game_started = false;
    uint256 public total_land_sold = 0;
    uint256 public total_trades = 0;
    uint256 internal tax_carried_forward = 0;
    
    uint256 public total_empire_score; 
    player[] public all_playerObjects;
    mapping(address => uint256) internal playerAddressToPlayerObjectID;
    
    
    
    
    plotDetail[] plotDetails;
    mapping(uint256 => uint256) internal tokenIDplotdetailsIndexId; // e.g. tokenIDplotdetailsIndexId shows us the index of the detail obj for each token



    
    mapping(int256 => mapping(int256 => uint256)) internal latlngTokenID_grids;
    //mapping(uint256 => plotBasic[]) internal tokenIDlatlngLookup; // To allow burn lookups
    //mapping(uint256 => int256[]) internal tokenIDlatlngLookup_lat; // To allow burn lookups
    //mapping(uint256 => int256[]) internal tokenIDlatlngLookup_lng; // To allow burn lookups
    
    
    
    mapping(uint8 => mapping(int256 => mapping(int256 => uint256))) internal latlngTokenID_zoomAll;

    mapping(uint8 => mapping(uint256 => plotBasic[])) internal tokenIDlatlngLookup_zoomAll;


    PlanetCryptoToken internal planetCryptoToken_I = PlanetCryptoToken(0x1806B3527C18Fb532C46405f6f014C1F381b499A);
    //PlanetCryptoToken internal planetCryptoToken_I = PlanetCryptoToken(0xd13faafc8e8b3f1acc6b84c8df845992e56dcd5b);
    
    constructor() ERC721Full_custom("PlanetCrypto", "PLANET") public {
        owner = msg.sender;
        tokenBankAddress = owner;
        devBankAddress = owner;
        planetCryptoCoin_interface = PlanetCryptoCoin_I(planetCryptoCoinAddress);
        planetCryptoUtils_interface = PlanetCryptoUtils_I(planetCryptoUtilsAddress);
        all_playerObjects.push(player(address(0x0),0,0,0));
        playerAddressToPlayerObjectID[address(0x0)] = 0;
        
        
    
        total_trades = planetCryptoToken_I.total_trades();
        total_land_sold = planetCryptoToken_I.total_land_sold();
        total_empire_score = planetCryptoToken_I.total_empire_score();
        tokens_rewards_available = planetCryptoToken_I.tokens_rewards_available();
        tokens_rewards_allocated = planetCryptoToken_I.tokens_rewards_allocated();
        tax_distributed = planetCryptoToken_I.tax_distributed();
        tax_fund = 0;
        current_plot_price = planetCryptoToken_I.current_plot_price();
        

        
    }
    
    function initPlayers(uint32 _start, uint32 _end) public onlyOwner {
        require(game_started == false);
        
        for(uint32 c=_start; c< _end+1; c++){
            transferPlayer(uint256(c));
        }
    }
    
    function transferPlayer(uint256 _player_id) internal {
        (address _playerAddress, uint256 _uint1, uint256 _uint2, uint256 _uint3) 
            =  planetCryptoToken_I.all_playerObjects(_player_id);
        

        all_playerObjects.push(
                player(
                    _playerAddress,
                    _uint1,
                    _uint2,
                    _uint3
                    )
                );
        playerAddressToPlayerObjectID[_playerAddress] = all_playerObjects.length-1;
    }
    
    
    function transferTokens(uint256 _start, uint256 _end) public onlyOwner {
        require(game_started == false);
        
        for(uint256 c=_start; c< _end+1; c++) {
            
            (
                address _playerAddress,
                bytes32 name,
                uint256 orig_value,
                uint256 current_value,
                uint256 empire_score,
                int256[] memory plots_lat,
                int256[] memory plots_lng
            ) = 
                planetCryptoToken_I.getToken(c, false);
    

            transferCards(c, _playerAddress, name, orig_value, current_value, empire_score, plots_lat, plots_lng);
        }
        
    }
    
    

    
    function transferCards(
                            uint256 _cardID,
                            address token_owner,
                            bytes32 name,
                            uint256 orig_value,
                            uint256 current_value,
                            uint256 empire_score,
                            int256[] memory plots_lat,
                            int256[] memory plots_lng
                            ) internal {

        

       
        _mint(token_owner, _cardID);
        tokenIDCount = tokenIDCount + 1;
            
        plotDetails.push(plotDetail(
            name,
            orig_value,
            current_value,
            empire_score,
            plots_lat, plots_lng, ''
        ));
        
        tokenIDplotdetailsIndexId[_cardID] = plotDetails.length-1;
        
        
        setupPlotOwnership(_cardID, plots_lat, plots_lng);
        
        

    }
    

    function tokenURI(uint256 tokenId) external view returns (string) {
        require(_exists(tokenId));
        return planetCryptoUtils_interface.strConcat(baseURI, 
                    planetCryptoUtils_interface.uint2str(tokenId));
    }


    function getToken(uint256 _tokenId, bool isBasic) public view returns(
        address token_owner,
        bytes32 name,
        uint256 orig_value,
        uint256 current_value,
        uint256 empire_score,
        int256[] plots_lat,
        int256[] plots_lng
        ) {
        token_owner = ownerOf(_tokenId);
        plotDetail memory _plotDetail = plotDetails[tokenIDplotdetailsIndexId[_tokenId]];
        name = _plotDetail.name;
        empire_score = _plotDetail.empire_score;
        orig_value = _plotDetail.orig_value;
        current_value = _plotDetail.current_value;
        if(!isBasic){
            plots_lat = _plotDetail.plots_lat;
            plots_lng = _plotDetail.plots_lng;
        }
    }
    function getTokenEnhanced(uint256 _tokenId, bool isBasic) public view returns(
        address token_owner,
        bytes32 name,
        bytes32 img,
        uint256 orig_value,
        uint256 current_value,
        uint256 empire_score,
        int256[] plots_lat,
        int256[] plots_lng
        ) {
        token_owner = ownerOf(_tokenId);
        plotDetail memory _plotDetail = plotDetails[tokenIDplotdetailsIndexId[_tokenId]];
        name = _plotDetail.name;
        img = _plotDetail.img;
        empire_score = _plotDetail.empire_score;
        orig_value = _plotDetail.orig_value;
        current_value = _plotDetail.current_value;
        if(!isBasic){
            plots_lat = _plotDetail.plots_lat;
            plots_lng = _plotDetail.plots_lng;
        }
    }
    

    function taxEarningsAvailable() public view returns(uint256) {
        return playersFundsOwed[msg.sender];
    }

    function withdrawTaxEarning() public {
        uint256 taxEarnings = playersFundsOwed[msg.sender];
        playersFundsOwed[msg.sender] = 0;
        tax_fund = tax_fund.sub(taxEarnings);
        
        if(!msg.sender.send(taxEarnings)) {
            playersFundsOwed[msg.sender] = playersFundsOwed[msg.sender] + taxEarnings;
            tax_fund = tax_fund.add(taxEarnings);
        }
    }

    function buyLandWithTokens(bytes32 _name, int256[] _plots_lat, int256[] _plots_lng)
     validateTokenPurchase(_plots_lat, _plots_lng) validateLand(_plots_lat, _plots_lng) updateUsersLastAccess() public {
        require(_name.length > 4);
        

        processPurchase(_name, _plots_lat, _plots_lng); 
        game_started = true;
    }
    

    
    function buyLand(bytes32 _name, 
            int256[] _plots_lat, int256[] _plots_lng,
            address _referrer
            )
                validatePurchase(_plots_lat, _plots_lng) 
                validateLand(_plots_lat, _plots_lng) 
                updateUsersLastAccess()
                public payable {
        require(_name.length > 4);
       
        // split payment
        uint256 _runningTotal = msg.value;
        
        _runningTotal = _runningTotal.sub(processReferer(_referrer));
        

        tax_fund = tax_fund.add(m_newPlot_taxPercent.mul(_runningTotal));
        
        
        processDevPayment(_runningTotal, m_newPlot_devPercent);
        

        processPurchase(_name, _plots_lat, _plots_lng);
        
        calcPlayerDivs(m_newPlot_taxPercent.mul(_runningTotal));
        
        game_started = true;
        
        if(_plots_lat.length >= min_plots_purchase_for_token_reward
            && tokens_rewards_available > 0) {
                
            uint256 _token_rewards = _plots_lat.length / plots_token_reward_divisor;
            if(_token_rewards > tokens_rewards_available)
                _token_rewards = tokens_rewards_available;
                
                
            planetCryptoCoin_interface.transfer(msg.sender, _token_rewards);
                
            emit issueCoinTokens(msg.sender, msg.sender, _token_rewards, now);
            tokens_rewards_allocated = tokens_rewards_allocated + _token_rewards;
            tokens_rewards_available = tokens_rewards_available - _token_rewards;
        }
    
    }
    
    function processReferer(address _referrer) internal returns(uint256) {
        uint256 _referrerAmnt = 0;
        if(_referrer != msg.sender && _referrer != address(0)) {
            _referrerAmnt = m_refPercent.mul(msg.value);
            if(_referrer.send(_referrerAmnt)) {
                emit referralPaid(_referrer, _referrer, _referrerAmnt, now);
                //_runningTotal = _runningTotal.sub(_referrerAmnt);
            }
        }
        return _referrerAmnt;
    }
    
    
    function processDevPayment(uint256 _runningTotal, Percent.percent storage _percent) internal {
        if(!devBankAddress.send(_percent.mul(_runningTotal))){
            devHoldings = devHoldings.add(_percent.mul(_runningTotal));
        }
    }
    
    // TO BE TESTED
    function buyCard(uint256 _token_id, address _referrer) updateUsersLastAccess() public payable {
        
        
        //validateResale(_token_id)
        
        if(planetCryptoUtils_interface.validateResale(msg.sender, msg.value, _token_id) == false) {
            if(planetCryptoUtils_interface.validateLandTakeover(msg.sender, msg.value, _token_id) == false) {
                revert("Cannot Buy this Card Yet!");
            }
        }
        
        processBuyCard(_token_id, _referrer);

    }
    
    
    
    function processBuyCard(uint256 _token_id, address _referrer) internal {
        // split payment
        uint256 _runningTotal = msg.value;
        _runningTotal = _runningTotal.sub(processReferer(_referrer));
        
        tax_fund = tax_fund.add(m_resalePlot_taxPercent.mul(_runningTotal));
        
        processDevPayment(_runningTotal, m_resalePlot_devPercent);

        address from = ownerOf(_token_id);
        
        if(!from.send(m_resalePlot_ownerPercent.mul(_runningTotal))) {
            playersFundsOwed[from] = playersFundsOwed[from].add(m_resalePlot_ownerPercent.mul(_runningTotal));
        }
        
        
        process_swap(from,msg.sender,_token_id);
        internal_transferFrom(from, msg.sender, _token_id);
        

        //plotDetail memory _plotDetail = plotDetails[tokenIDplotdetailsIndexId[_token_id]];
        uint256 _empireScore = plotDetails[tokenIDplotdetailsIndexId[_token_id]].empire_score; // apply bonus when card is bought through site
        uint256 _newEmpireScore = m_empireScoreMultiplier.mul(_empireScore);
        uint256 _origValue = plotDetails[tokenIDplotdetailsIndexId[_token_id]].current_value;
        

        all_playerObjects[playerAddressToPlayerObjectID[msg.sender]].totalEmpireScore
            = all_playerObjects[playerAddressToPlayerObjectID[msg.sender]].totalEmpireScore + (_newEmpireScore - _empireScore);
        
        plotDetails[tokenIDplotdetailsIndexId[_token_id]].empire_score = _newEmpireScore;

        total_empire_score = total_empire_score + (_newEmpireScore - _empireScore);
        
        plotDetails[tokenIDplotdetailsIndexId[_token_id]].current_value = 
            m_resaleMultipler.mul(plotDetails[tokenIDplotdetailsIndexId[_token_id]].current_value);
        
        total_trades = total_trades + 1;
        
        
        calcPlayerDivs(m_resalePlot_taxPercent.mul(_runningTotal));
        
        
        plotDetail memory _plot =plotDetails[tokenIDplotdetailsIndexId[_token_id]];
       
        emit cardBought(_token_id, from, ownerOf(_token_id),
                    _token_id, from, ownerOf(_token_id), 
                    _plot.name,
                    _origValue, 
                    _plot.current_value,
                    _empireScore, 
                    _plot.empire_score, 
                    now);
    }
    
    
    
    function processPurchase(bytes32 _name, 
            int256[] _plots_lat, int256[] _plots_lng) internal {
    
        tokenIDCount = tokenIDCount + 1;
        
        //uint256 _token_id = tokenIDCount; //totalSupply().add(1);
        _mint(msg.sender, tokenIDCount);
        

           
            
        plotDetails.push(plotDetail(
            _name,
            current_plot_price * _plots_lat.length,
            current_plot_price * _plots_lat.length,
            current_plot_empire_score * _plots_lng.length,
            _plots_lat, _plots_lng, ''
        ));

        
        tokenIDplotdetailsIndexId[tokenIDCount] = plotDetails.length-1;
        
        
        
        setupPlotOwnership(tokenIDCount, _plots_lat, _plots_lng);
        
        
        
        uint256 _playerObject_idx = playerAddressToPlayerObjectID[msg.sender];
        all_playerObjects[_playerObject_idx].totalEmpireScore
            = all_playerObjects[_playerObject_idx].totalEmpireScore + (current_plot_empire_score * _plots_lng.length);
            
        total_empire_score = total_empire_score + (current_plot_empire_score * _plots_lng.length);
            
        all_playerObjects[_playerObject_idx].totalLand
            = all_playerObjects[_playerObject_idx].totalLand + _plots_lat.length;
            
        
        emit landPurchased(
                tokenIDCount, msg.sender,
                tokenIDCount, msg.sender, _name, _plots_lat[0], _plots_lng[0], _plots_lat.length, current_plot_price, (current_plot_empire_score * _plots_lng.length), now);


        current_plot_price = current_plot_price + (price_update_amount * _plots_lat.length);
        total_land_sold = total_land_sold + _plots_lat.length;

    }

    function updateCardDetail(uint256 _token_id, uint256 _updateType, bytes32 _data) public payable {
        require(msg.sender == ownerOf(_token_id));
        if(_updateType == 1) {
            // CardImage
            require(msg.value == cardImageCost);
            
            plotDetails[
                    tokenIDplotdetailsIndexId[_token_id]
                        ].img = _data;

        }
        if(_updateType == 2) {
            // Name change
            require(_data.length > 4);
            require(msg.value == cardChangeNameCost);
            plotDetails[
                    tokenIDplotdetailsIndexId[_token_id]
                        ].name = _data;
        }
        
        
        processDevPayment(msg.value,m_newPlot_devPercent);
        /*
        if(!devBankAddress.send(msg.value)){
            devHoldings = devHoldings.add(msg.value);
        }
        */
        
        emit cardChange(
            _token_id,
            msg.sender, 
            _token_id, msg.sender, _updateType, _data, now);
            
    }
    
    
    


    
    
    function calcPlayerDivs(uint256 _value) internal {
        // total up amount split so we can emit it
        //if(totalSupply() > 1) {
        if(game_started) {
            uint256 _totalDivs = 0;
            uint256 _totalPlayers = 0;
            
            uint256 _taxToDivide = _value + tax_carried_forward;
            
            // ignore player 0
            for(uint256 c=1; c< all_playerObjects.length; c++) {
                
                // allow for 0.0001 % =  * 10000
                
                uint256 _playersPercent 
                    = (all_playerObjects[c].totalEmpireScore*10000000 / total_empire_score * 10000000) / 10000000;
                    
                uint256 _playerShare = _taxToDivide / 10000000 * _playersPercent;
                

                
                if(_playerShare > 0) {
                    
                    
                    playersFundsOwed[all_playerObjects[c].playerAddress] = playersFundsOwed[all_playerObjects[c].playerAddress].add(_playerShare);
                    tax_distributed = tax_distributed.add(_playerShare);
                    
                    _totalDivs = _totalDivs + _playerShare;
                    _totalPlayers = _totalPlayers + 1;
                
                }
            }

            tax_carried_forward = 0;
            emit taxDistributed(_totalDivs, _totalPlayers, now);

        } else {
            // first land purchase - no divs this time, carried forward
            tax_carried_forward = tax_carried_forward + _value;
        }
    }
    

    
    
    function setupPlotOwnership(uint256 _token_id, int256[] _plots_lat, int256[] _plots_lng) internal {

       for(uint256 c=0;c< _plots_lat.length;c++) {
         
            latlngTokenID_grids[_plots_lat[c]]
                [_plots_lng[c]] = _token_id;
                

            
        }
       


        for(uint8 zoomC = 1; c < 5; c++) {
            setupZoomLvl(zoomC,_plots_lat[0], _plots_lng[0], _token_id); // correct rounding / 10 on way out    
        }

      
    }




    function setupZoomLvl(uint8 zoom, int256 lat, int256 lng, uint256 _token_id) internal  {
        
        lat = planetCryptoUtils_interface.roundLatLngFull(zoom, lat);
        lng = planetCryptoUtils_interface.roundLatLngFull(zoom, lng);
        
        
      
        
        latlngTokenID_zoomAll[zoom][lat][lng] = _token_id;
        tokenIDlatlngLookup_zoomAll[zoom][_token_id].push(
            plotBasic(lat,lng)
            );
 
        
        
    }




    


    function getAllPlayerObjectLen() public view returns(uint256){
        return all_playerObjects.length;
    }
    

    function queryMap(uint8 zoom, int256[] lat_rows, int256[] lng_columns) public view returns(string _outStr) {
        
        
        for(uint256 y=0; y< lat_rows.length; y++) {

            for(uint256 x=0; x< lng_columns.length; x++) {
                
                
                
                if(zoom == 0){
                    if(latlngTokenID_grids[lat_rows[y]][lng_columns[x]] > 0){
                        
                        
                      _outStr = planetCryptoUtils_interface.strConcat(
                            _outStr, '[', planetCryptoUtils_interface.int2str(lat_rows[y]) , ':', planetCryptoUtils_interface.int2str(lng_columns[x]) );
                      _outStr = planetCryptoUtils_interface.strConcat(_outStr, ':', 
                                    planetCryptoUtils_interface.uint2str(latlngTokenID_grids[lat_rows[y]][lng_columns[x]]), ']');
                    }
                    
                } else {
                    //_out[c] = latlngTokenID_zoomAll[zoom][lat_rows[y]][lng_columns[x]];
                    if(latlngTokenID_zoomAll[zoom][lat_rows[y]][lng_columns[x]] > 0){
                      _outStr = planetCryptoUtils_interface.strConcat(_outStr, '[', planetCryptoUtils_interface.int2str(lat_rows[y]) , ':', planetCryptoUtils_interface.int2str(lng_columns[x]) );
                      _outStr = planetCryptoUtils_interface.strConcat(_outStr, ':', 
                                    planetCryptoUtils_interface.uint2str(latlngTokenID_zoomAll[zoom][lat_rows[y]][lng_columns[x]]), ']');
                    }
                    
                }
                //c = c+1;
                
            }
        }
        
        //return _out;
    }
    // used in utils
    function queryPlotExists(uint8 zoom, int256[] lat_rows, int256[] lng_columns) public view returns(bool) {
        
        
        for(uint256 y=0; y< lat_rows.length; y++) {

            for(uint256 x=0; x< lng_columns.length; x++) {
                
                if(zoom == 0){
                    if(latlngTokenID_grids[lat_rows[y]][lng_columns[x]] > 0){
                        return true;
                    } 
                } else {
                    if(latlngTokenID_zoomAll[zoom][lat_rows[y]][lng_columns[x]] > 0){

                        return true;
                        
                    }                     
                }
           
                
            }
        }
        
        return false;
    }

    

    

   




    // ERC721 overrides
    
    function safeTransferFrom(address from, address to, uint256 tokenId) public {
        safeTransferFrom(from, to, tokenId, "");
    }
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) public {
        transferFrom(from, to, tokenId);
        // solium-disable-next-line arg-overflow
        require(_checkOnERC721Received(from, to, tokenId, _data));
    }
    


    function transferFrom(address from, address to, uint256 tokenId) public {
        // check permission on the from address first
        require(_isApprovedOrOwner(msg.sender, tokenId));
        require(to != address(0));
        
        process_swap(from,to,tokenId);
        
        super.transferFrom(from, to, tokenId);

    }
    
    function process_swap(address from, address to, uint256 tokenId) internal {

        
        // remove the empire score & total land owned...
        uint256 _empireScore;
        uint256 _size;
        
        //plotDetail memory _plotDetail = plotDetails[tokenIDplotdetailsIndexId[tokenId]];
        _empireScore = plotDetails[tokenIDplotdetailsIndexId[tokenId]].empire_score;
        _size = plotDetails[tokenIDplotdetailsIndexId[tokenId]].plots_lat.length;
        
        uint256 _playerObject_idx = playerAddressToPlayerObjectID[from];
        
        all_playerObjects[_playerObject_idx].totalEmpireScore
            = all_playerObjects[_playerObject_idx].totalEmpireScore - _empireScore;
            
        all_playerObjects[_playerObject_idx].totalLand
            = all_playerObjects[_playerObject_idx].totalLand - _size;
            
        // and increment on the other side...
        _playerObject_idx = playerAddressToPlayerObjectID[to];
        
        // ensure the player is setup first...
        if(_playerObject_idx == 0){
            all_playerObjects.push(player(to,now,0,0));
            playerAddressToPlayerObjectID[to] = all_playerObjects.length-1;
            _playerObject_idx = all_playerObjects.length-1;
        }
        
        all_playerObjects[_playerObject_idx].totalEmpireScore
            = all_playerObjects[_playerObject_idx].totalEmpireScore + _empireScore;
            
        all_playerObjects[_playerObject_idx].totalLand
            = all_playerObjects[_playerObject_idx].totalLand + _size;
    }


   


    // PRIVATE METHODS
    function p_update_action(uint256 _type, address _address, uint256 _val, string _strVal) public onlyOwner {
        if(_type == 0){
            owner = _address;    
        }
        if(_type == 1){
            tokenBankAddress = _address;    
        }
        if(_type == 2) {
            devBankAddress = _address;
        }
        if(_type == 3) {
            cardChangeNameCost = _val;    
        }
        if(_type == 4) {
            cardImageCost = _val;    
        }
        if(_type == 5) {
            baseURI = _strVal;
        }
        if(_type == 6) {
            price_update_amount = _val;
        }
        if(_type == 7) {
            current_plot_empire_score = _val;    
        }
        if(_type == 8) {
            planetCryptoCoinAddress = _address;
            if(address(planetCryptoCoinAddress) != address(0)){ 
                planetCryptoCoin_interface = PlanetCryptoCoin_I(planetCryptoCoinAddress);
            }
        }
        if(_type ==9) {
            planetCryptoUtilsAddress = _address;
            if(address(planetCryptoUtilsAddress) != address(0)){ 
                planetCryptoUtils_interface = PlanetCryptoUtils_I(planetCryptoUtilsAddress);
            }            
        }
        if(_type == 10) {
            m_newPlot_devPercent = Percent.percent(_val,100);    
        }
        if(_type == 11) {
            m_newPlot_taxPercent = Percent.percent(_val,100);    
        }
        if(_type == 12) {
            m_resalePlot_devPercent = Percent.percent(_val,100);    
        }
        if(_type == 13) {
            m_resalePlot_taxPercent = Percent.percent(_val,100);    
        }
        if(_type == 14) {
            m_resalePlot_ownerPercent = Percent.percent(_val,100);    
        }
        if(_type == 15) {
            m_refPercent = Percent.percent(_val,100);    
        }
        if(_type == 16) {
            m_empireScoreMultiplier = Percent.percent(_val, 100);    
        }
        if(_type == 17) {
            m_resaleMultipler = Percent.percent(_val, 100);    
        }
        if(_type == 18) {
            tokens_rewards_available = _val;    
        }
        if(_type == 19) {
            tokens_rewards_allocated = _val;    
        }
        if(_type == 20) {
            // clear card image 
            plotDetails[
                    tokenIDplotdetailsIndexId[_val]
                        ].img = '';
                        
            emit cardChange(
                _val,
                msg.sender, 
                _val, msg.sender, 1, '', now);
        }

        
        if(_type == 99) {
            // burnToken 
        
            address _token_owner = ownerOf(_val);
            //internal_transferFrom(_token_owner, 0x0000000000000000000000000000000000000000, _val);
            processBurn(_token_owner, _val);
        
        }
    }
    
    function burn(uint256 _token_id) public {
        require(msg.sender == ownerOf(_token_id));
        
        uint256 _cardSize = plotDetails[tokenIDplotdetailsIndexId[_token_id]].plots_lat.length;
        
        //super.transferFrom(msg.sender, 0x0000000000000000000000000000000000000000, _token_id);
        processBurn(msg.sender, _token_id);
        
        // allocate PlanetCOIN tokens to user...
        planetCryptoCoin_interface.transfer(msg.sender, _cardSize);
        
        
        
    }
    
    function processBurn(address _token_owner, uint256 _val) internal {
        _burn(_token_owner, _val);

        


        // remove the empire score & total land owned...
        uint256 _empireScore;
        uint256 _size;
        

        _empireScore = plotDetails[tokenIDplotdetailsIndexId[_val]].empire_score;
        _size = plotDetails[tokenIDplotdetailsIndexId[_val]].plots_lat.length;
        
        total_land_sold = total_land_sold - _size;
        total_empire_score = total_empire_score - _empireScore;
        
        uint256 _playerObject_idx = playerAddressToPlayerObjectID[_token_owner];
        
        all_playerObjects[_playerObject_idx].totalEmpireScore
            = all_playerObjects[_playerObject_idx].totalEmpireScore - _empireScore;
            
        all_playerObjects[_playerObject_idx].totalLand
            = all_playerObjects[_playerObject_idx].totalLand - _size;
            
            
        for(uint256 c=0;c < plotDetails[tokenIDplotdetailsIndexId[_val]].plots_lat.length; c++) {
            latlngTokenID_grids[
                    //tokenIDlatlngLookup_lat[_val][c]
                    plotDetails[tokenIDplotdetailsIndexId[_val]].plots_lat[c]
                ]
                [
                    //tokenIDlatlngLookup_lng[_val][c]
                    plotDetails[tokenIDplotdetailsIndexId[_val]].plots_lng[c]
                ] = 0;
        }

        
  
        for(uint8 zoom=1; zoom < 5; zoom++) {
            plotBasic[] storage _plotBasicList = tokenIDlatlngLookup_zoomAll[zoom][_val];
            for(c=0; c< _plotBasicList.length; c++) {
                delete latlngTokenID_zoomAll[zoom][
                    _plotBasicList[c].lat
                    ][
                        _plotBasicList[c].lng
                        ];
                        
                delete _plotBasicList[c];
            }
        }
        
        
        delete plotDetails[tokenIDplotdetailsIndexId[_val]];
        tokenIDplotdetailsIndexId[_val] = 0;
        //delete tokenIDplotdetailsIndexId[_val];
        
        


    }

    function p_withdrawDevHoldings() public {
        require(msg.sender == devBankAddress);
        uint256 _t = devHoldings;
        devHoldings = 0;
        if(!devBankAddress.send(devHoldings)){
            devHoldings = _t;
        }
    }




    function m() public {
        
    }
    
}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[],"name":"min_plots_purchase_for_token_reward","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tokens_rewards_available","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"zoom","type":"uint8"},{"name":"lat_rows","type":"int256[]"},{"name":"lng_columns","type":"int256[]"}],"name":"queryPlotExists","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getAllPlayerObjectLen","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"bytes32"},{"name":"_plots_lat","type":"int256[]"},{"name":"_plots_lng","type":"int256[]"}],"name":"buyLandWithTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"cardChangeNameCost","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"price_update_amount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"all_playerObjects","outputs":[{"name":"playerAddress","type":"address"},{"name":"lastAccess","type":"uint256"},{"name":"totalEmpireScore","type":"uint256"},{"name":"totalLand","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token_id","type":"uint256"},{"name":"_updateType","type":"uint256"},{"name":"_data","type":"bytes32"}],"name":"updateCardDetail","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_type","type":"uint256"},{"name":"_address","type":"address"},{"name":"_val","type":"uint256"},{"name":"_strVal","type":"string"}],"name":"p_update_action","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"tokenIDCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"current_plot_price","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_token_id","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_start","type":"uint256"},{"name":"_end","type":"uint256"}],"name":"transferTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"tokens_rewards_allocated","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token_id","type":"uint256"},{"name":"_referrer","type":"address"}],"name":"buyCard","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"taxEarningsAvailable","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"m","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"baseURI","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"isBasic","type":"bool"}],"name":"getTokenEnhanced","outputs":[{"name":"token_owner","type":"address"},{"name":"name","type":"bytes32"},{"name":"img","type":"bytes32"},{"name":"orig_value","type":"uint256"},{"name":"current_value","type":"uint256"},{"name":"empire_score","type":"uint256"},{"name":"plots_lat","type":"int256[]"},{"name":"plots_lng","type":"int256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"withdrawTaxEarning","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"zoom","type":"uint8"},{"name":"lat_rows","type":"int256[]"},{"name":"lng_columns","type":"int256[]"}],"name":"queryMap","outputs":[{"name":"_outStr","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_start","type":"uint32"},{"name":"_end","type":"uint32"}],"name":"initPlayers","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"cardImageCost","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"total_empire_score","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"total_land_sold","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"tokenId","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"game_started","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"total_trades","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"current_plot_empire_score","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"isBasic","type":"bool"}],"name":"getToken","outputs":[{"name":"token_owner","type":"address"},{"name":"name","type":"bytes32"},{"name":"orig_value","type":"uint256"},{"name":"current_value","type":"uint256"},{"name":"empire_score","type":"uint256"},{"name":"plots_lat","type":"int256[]"},{"name":"plots_lng","type":"int256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"p_withdrawDevHoldings","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"bytes32"},{"name":"_plots_lat","type":"int256[]"},{"name":"_plots_lng","type":"int256[]"},{"name":"_referrer","type":"address"}],"name":"buyLand","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"tax_distributed","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"devHoldings","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tax_fund","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"plots_token_reward_divisor","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"search_to","type":"address"},{"indexed":false,"name":"to","type":"address"},{"indexed":false,"name":"amnt","type":"uint256"},{"indexed":false,"name":"timestamp","type":"uint256"}],"name":"referralPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"searched_to","type":"address"},{"indexed":false,"name":"to","type":"address"},{"indexed":false,"name":"amnt","type":"uint256"},{"indexed":false,"name":"timestamp","type":"uint256"}],"name":"issueCoinTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"search_token_id","type":"uint256"},{"indexed":true,"name":"search_buyer","type":"address"},{"indexed":false,"name":"token_id","type":"uint256"},{"indexed":false,"name":"buyer","type":"address"},{"indexed":false,"name":"name","type":"bytes32"},{"indexed":false,"name":"center_lat","type":"int256"},{"indexed":false,"name":"center_lng","type":"int256"},{"indexed":false,"name":"size","type":"uint256"},{"indexed":false,"name":"bought_at","type":"uint256"},{"indexed":false,"name":"empire_score","type":"uint256"},{"indexed":false,"name":"timestamp","type":"uint256"}],"name":"landPurchased","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amnt","type":"uint256"},{"indexed":false,"name":"total_players","type":"uint256"},{"indexed":false,"name":"timestamp","type":"uint256"}],"name":"taxDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"search_token_id","type":"uint256"},{"indexed":true,"name":"search_from","type":"address"},{"indexed":true,"name":"search_to","type":"address"},{"indexed":false,"name":"token_id","type":"uint256"},{"indexed":false,"name":"from","type":"address"},{"indexed":false,"name":"to","type":"address"},{"indexed":false,"name":"name","type":"bytes32"},{"indexed":false,"name":"orig_value","type":"uint256"},{"indexed":false,"name":"new_value","type":"uint256"},{"indexed":false,"name":"empireScore","type":"uint256"},{"indexed":false,"name":"newEmpireScore","type":"uint256"},{"indexed":false,"name":"timestamp","type":"uint256"}],"name":"cardBought","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"search_token_id","type":"uint256"},{"indexed":true,"name":"search_owner","type":"address"},{"indexed":false,"name":"token_id","type":"uint256"},{"indexed":false,"name":"owner","type":"address"},{"indexed":false,"name":"changeType","type":"uint256"},{"indexed":false,"name":"data","type":"bytes32"},{"indexed":false,"name":"timestamp","type":"uint256"}],"name":"cardChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":true,"name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"approved","type":"address"},{"indexed":true,"name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"operator","type":"address"},{"indexed":false,"name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"}]

600f8054600160a060020a031990811673a1c8031ef18272d8bfed22e1b61319d6d9d2881b17909155601180549091167340089b9f4d5eb36d62548133f32e52b14fa54c52179055604b6080819052606460a08190526013919091556014819055601960c081905260e082905260158190556016829055600a6101008190526101208390526017819055601883905561014081905261016083905290819055601a82905560506101808190526101a0839052601b55601c82905560056101c08190526101e0839052601d55601e8290556096610200819052610220839052601f55602082905560c8610240819052610260839052602155602282905560006023908155602782905560289190915566470de4df8200006029556501d1a94a2000602a5566b1a2bc2ec50000602b5567016345785d8a0000602c55602d919091556102e06040526102808190527f68747470733a2f2f706c616e657463727970746f2e6170702f6170692f746f6b6102a09081527f656e2f00000000000000000000000000000000000000000000000000000000006102c052620001a691602e91906200093c565b506000602f819055603081905560318190556032805460ff1916905560338190556034819055603555603e8054600160a060020a031916731806b3527c18fb532c46405f6f014c1f381b499a1790553480156200020257600080fd5b50604080518082018252600c81527f506c616e657443727970746f00000000000000000000000000000000000000006020808301919091528251808401909352600683527f504c414e4554000000000000000000000000000000000000000000000000000090830152908181620002a27f01ffc9a700000000000000000000000000000000000000000000000000000000640100000000620008cf810204565b620002d67f80ac58cd00000000000000000000000000000000000000000000000000000000640100000000620008cf810204565b6200030a7f780e9d6300000000000000000000000000000000000000000000000000000000640100000000620008cf810204565b81516200031f9060099060208501906200093c565b5080516200033590600a9060208401906200093c565b506200036a7f5b5e139f00000000000000000000000000000000000000000000000000000000640100000000620008cf810204565b5050600c8054600160a060020a0319908116331791829055600e80548216600160a060020a03938416908117909155600d805483169091179055600f5460108054831691841691909117905560115460128054831691841691909117905560408051608081018252600080825260208083018281528385018381526060850184815260378054600181018255908652955160049687027f42a7b7dd785cd69714a189dffb3fd7d7174edc9ece837694ce50f7078f7c31ae81018054928c1692909a169190911790985591517f42a7b7dd785cd69714a189dffb3fd7d7174edc9ece837694ce50f7078f7c31af880155517f42a7b7dd785cd69714a189dffb3fd7d7174edc9ece837694ce50f7078f7c31b0870155517f42a7b7dd785cd69714a189dffb3fd7d7174edc9ece837694ce50f7078f7c31b190950194909455808052603884527fe14cf4d84b2ff434db2c3d715ad03acb36d95ed6f766d46660154cee72012d71819055603e5483517fbe3f347100000000000000000000000000000000000000000000000000000000815293519516965063be3f34719550828201949283900390910190829087803b1580156200052557600080fd5b505af11580156200053a573d6000803e3d6000fd5b505050506040513d60208110156200055157600080fd5b5051603455603e54604080517faeaf5a370000000000000000000000000000000000000000000000000000000081529051600160a060020a039092169163aeaf5a37916004808201926020929091908290030181600087803b158015620005b757600080fd5b505af1158015620005cc573d6000803e3d6000fd5b505050506040513d6020811015620005e357600080fd5b5051603355603e54604080517f9ee837f50000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921691639ee837f5916004808201926020929091908290030181600087803b1580156200064957600080fd5b505af11580156200065e573d6000803e3d6000fd5b505050506040513d60208110156200067557600080fd5b5051603655603e54604080517f01ef74f10000000000000000000000000000000000000000000000000000000081529051600160a060020a03909216916301ef74f1916004808201926020929091908290030181600087803b158015620006db57600080fd5b505af1158015620006f0573d6000803e3d6000fd5b505050506040513d60208110156200070757600080fd5b5051602555603e54604080517f4a22c7fb0000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921691634a22c7fb916004808201926020929091908290030181600087803b1580156200076d57600080fd5b505af115801562000782573d6000803e3d6000fd5b505050506040513d60208110156200079957600080fd5b5051602655603e54604080517fe1036f860000000000000000000000000000000000000000000000000000000081529051600160a060020a039092169163e1036f86916004808201926020929091908290030181600087803b158015620007ff57600080fd5b505af115801562000814573d6000803e3d6000fd5b505050506040513d60208110156200082b57600080fd5b50516030556000602f819055603e54604080517f3fadc3880000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921692633fadc388926004808401936020939083900390910190829087803b1580156200089857600080fd5b505af1158015620008ad573d6000803e3d6000fd5b505050506040513d6020811015620008c457600080fd5b5051602955620009e1565b7fffffffff000000000000000000000000000000000000000000000000000000008082161415620008ff57600080fd5b7fffffffff00000000000000000000000000000000000000000000000000000000166000908152602081905260409020805460ff19166001179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200097f57805160ff1916838001178555620009af565b82800160010185558215620009af579182015b82811115620009af57825182559160200191906001019062000992565b50620009bd929150620009c1565b5090565b620009de91905b80821115620009bd5760008155600101620009c8565b90565b615fbc80620009f16000396000f3006080604052600436106102585763ffffffff60e060020a60003504166301de168a811461025d57806301ef74f11461028457806301ffc9a71461029957806303a7b41f146102e457806306fdde031461037a578063081812fc14610404578063095ea7b3146104385780630cb9ee4b1461045e5780630d4ea316146104735780630e61c1061461050657806318160ddd1461051b578063222d7c8a14610530578063232720651461054557806323b872dd1461058d5780632f745c59146105b757806332b98616146105db5780633cc6c20b146105ec5780633e0c8f201461065b5780633fadc3881461067057806342842e0e1461068557806342966c68146106af57806345de2567146106c75780634a22c7fb146106e25780634f6ccce7146106f757806350357beb1461070f578063567c31f7146107265780635a2ee0191461073b5780636352211e146107505780636c0360eb1461076857806370a082311461077d578063741922091461079e5780637517b57e1461089057806387dfc909146108a55780638913b8091461093b57806395d89b411461095f578063973112e9146109745780639ee837f514610989578063a22cb4651461099e578063aeaf5a37146109c4578063b88d4fde146109d9578063bdb42bac14610a48578063be3f347114610a5d578063c87b56dd14610a72578063d3f78cb414610a8a578063db737c7814610a9f578063dbc933bc14610b92578063dc00adef14610ba7578063e1036f8614610c38578063e4fd6f8114610c4d578063e717dc3d14610c62578063e985e9c514610c77578063f719db8e14610c9e575b600080fd5b34801561026957600080fd5b50610272610cb3565b60408051918252519081900360200190f35b34801561029057600080fd5b50610272610cb9565b3480156102a557600080fd5b506102d07bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1960043516610cbf565b604080519115158252519081900360200190f35b3480156102f057600080fd5b506040805160206004602480358281013584810280870186019097528086526102d096843560ff1696369660449591949091019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610cf39650505050505050565b34801561038657600080fd5b5061038f610e14565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103c95781810151838201526020016103b1565b50505050905090810190601f1680156103f65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041057600080fd5b5061041c600435610eab565b60408051600160a060020a039092168252519081900360200190f35b34801561044457600080fd5b5061045c600160a060020a0360043516602435610edd565b005b34801561046a57600080fd5b50610272610f86565b34801561047f57600080fd5b5060408051602060046024803582810135848102808701860190975280865261045c96843596369660449591949091019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610f8c9650505050505050565b34801561051257600080fd5b506102726114c7565b34801561052757600080fd5b506102726114cd565b34801561053c57600080fd5b506102726114d3565b34801561055157600080fd5b5061055d6004356114d9565b60408051600160a060020a0390951685526020850193909352838301919091526060830152519081900360800190f35b34801561059957600080fd5b5061045c600160a060020a036004358116906024351660443561151b565b3480156105c357600080fd5b50610272600160a060020a0360043516602435611560565b61045c6004356024356044356115ae565b3480156105f857600080fd5b50604080516020601f60643560048181013592830184900484028501840190955281845261045c94803594600160a060020a0360248035919091169560443595369560849493019181908401838280828437509497506116bd9650505050505050565b34801561066757600080fd5b50610272611a57565b34801561067c57600080fd5b50610272611a5d565b34801561069157600080fd5b5061045c600160a060020a0360043581169060243516604435611a63565b3480156106bb57600080fd5b5061045c600435611a7f565b3480156106d357600080fd5b5061045c600435602435611b7a565b3480156106ee57600080fd5b50610272611d5f565b34801561070357600080fd5b50610272600435611d65565b61045c600435600160a060020a0360243516611d9a565b34801561073257600080fd5b5061027261203b565b34801561074757600080fd5b5061045c61204e565b34801561075c57600080fd5b5061041c600435612050565b34801561077457600080fd5b5061038f612074565b34801561078957600080fd5b50610272600160a060020a0360043516612102565b3480156107aa57600080fd5b506107bb6004356024351515612135565b60408051600160a060020a038a16815260208082018a9052918101889052606081018790526080810186905260a0810185905261010060c0820181815285519183019190915284519192909160e0840191610120850191878201910280838360005b8381101561083557818101518382015260200161081d565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561087457818101518382015260200161085c565b505050509050019a505050505050505050505060405180910390f35b34801561089c57600080fd5b5061045c6122b0565b3480156108b157600080fd5b5060408051602060046024803582810135848102808701860190975280865261038f96843560ff1696369660449591949091019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375094975061232b9650505050505050565b34801561094757600080fd5b5061045c63ffffffff600435811690602435166132e5565b34801561096b57600080fd5b5061038f613340565b34801561098057600080fd5b506102726133a1565b34801561099557600080fd5b506102726133a7565b3480156109aa57600080fd5b5061045c600160a060020a036004351660243515156133ad565b3480156109d057600080fd5b50610272613431565b3480156109e557600080fd5b50604080516020601f60643560048181013592830184900484028501840190955281845261045c94600160a060020a0381358116956024803590921695604435953695608494019181908401838280828437509497506134379650505050505050565b348015610a5457600080fd5b506102d0613459565b348015610a6957600080fd5b50610272613462565b348015610a7e57600080fd5b5061038f600435613468565b348015610a9657600080fd5b5061027261371b565b348015610aab57600080fd5b50610abc6004356024351515613721565b6040518088600160a060020a0316600160a060020a0316815260200187600019166000191681526020018681526020018581526020018481526020018060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015610b38578181015183820152602001610b20565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015610b77578181015183820152602001610b5f565b50505050905001995050505050505050505060405180910390f35b348015610b9e57600080fd5b5061045c613892565b60408051602060046024803582810135848102808701860190975280865261045c96843596369660449591949091019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375094975050509235600160a060020a031693506138e892505050565b348015610c4457600080fd5b50610272613ea3565b348015610c5957600080fd5b50610272613ea9565b348015610c6e57600080fd5b50610272613eaf565b348015610c8357600080fd5b506102d0600160a060020a0360043581169060243516613eb5565b348015610caa57600080fd5b50610272613ee3565b60275481565b60255481565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191660009081526020819052604090205460ff1690565b600080805b8451821015610e06575060005b8351811015610dfb5760ff86161515610d81576000603b60008785815181101515610d2c57fe5b90602001906020020151815260200190815260200160002060008684815181101515610d5457fe5b906020019060200201518152602001908152602001600020541115610d7c5760019250610e0b565b610df3565b60ff86166000908152603c6020526040812086518290889086908110610da357fe5b90602001906020020151815260200190815260200160002060008684815181101515610dcb57fe5b906020019060200201518152602001908152602001600020541115610df35760019250610e0b565b600101610d05565b600190910190610cf8565b600092505b50509392505050565b60098054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ea05780601f10610e7557610100808354040283529160200191610ea0565b820191906000526020600020905b815481529060010190602001808311610e8357829003601f168201915b505050505090505b90565b6000610eb682613ee9565b1515610ec157600080fd5b50600090815260026020526040902054600160a060020a031690565b6000610ee882612050565b9050600160a060020a038381169082161415610f0357600080fd5b33600160a060020a0382161480610f1f5750610f1f8133613eb5565b1515610f2a57600080fd5b6000828152600260205260408082208054600160a060020a031916600160a060020a0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60375490565b6012546040517f05117e0d000000000000000000000000000000000000000000000000000000008152336004820181815260606024840190815286516064850152865187958795600160a060020a03909116946305117e0d9490938893889360448101916084909101906020808801910280838360005b8381101561101b578181015183820152602001611003565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561105a578181015183820152602001611042565b5050505090500195505050505050602060405180830381600087803b15801561108257600080fd5b505af1158015611096573d6000803e3d6000fd5b505050506040513d60208110156110ac57600080fd5b5051151560011461112c576040805160e560020a62461bcd028152602060048201526024808201527f4e6f7420656e6f75676820434f494e5320746f2062757920746865736520706c60448201527f6f74732100000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b601054600e548351604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a03938416602482015260448101929092525191909216916323b872dd9160648083019260209291908290030181600087803b1580156111a657600080fd5b505af11580156111ba573d6000803e3d6000fd5b505050506040513d60208110156111d057600080fd5b5051151560011461122b576040805160e560020a62461bcd02815260206004820152601560248201527f546f6b656e207472616e73666572206661696c65640000000000000000000000604482015290519081900360640190fd5b6012546040517f62026229000000000000000000000000000000000000000000000000000000008152336004820181815260606024840190815288516064850152885189958995600160a060020a039091169463620262299490938893889360448101916084909101906020808801910280838360005b838110156112ba5781810151838201526020016112a2565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156112f95781810151838201526020016112e1565b5050505090500195505050505050602060405180830381600087803b15801561132157600080fd5b505af1158015611335573d6000803e3d6000fd5b505050506040513d602081101561134b57600080fd5b505115156001146113a6576040805160e560020a62461bcd02815260206004820181905260248201527f536f6d65206f662074686973206c616e6420616c7265616479206f776e656421604482015290519081900360640190fd5b3360009081526038602052604090205480151561147f576040805160808101825233808252426020808401918252600084860181815260608601828152603780546001810182558185529751600080516020615f7183398151915260049099029889018054600160a060020a031916600160a060020a039092169190911790559451600080516020615f518339815191528801559051600080516020615f3183398151915287015551600080516020615f11833981519152909501949094559054918352603890529190206000199190910190556114a5565b4260378281548110151561148f57fe5b9060005260206000209060040201600101819055505b6114b0888888613f06565b50506032805460ff19166001179055505050505050565b602b5481565b60075490565b602a5481565b60378054829081106114e757fe5b60009182526020909120600490910201805460018201546002830154600390930154600160a060020a039092169350919084565b611525338261423f565b151561153057600080fd5b600160a060020a038216151561154557600080fd5b61155083838361429e565b61155b83838361453e565b505050565b600061156b83612102565b821061157657600080fd5b600160a060020a038316600090815260056020526040902080548390811061159a57fe5b906000526020600020015490505b92915050565b6115b783612050565b600160a060020a031633146115cb57600080fd5b816001141561161557602c5434146115e257600080fd5b6000838152603a602052604090205460398054839290811061160057fe5b60009182526020909120600660079092020101555b816002141561165c57602b54341461162c57600080fd5b6000838152603a602052604090205460398054839290811061164a57fe5b60009182526020909120600790910201555b6116673460136145b7565b60408051848152336020820181905281830185905260608201849052426080830152915185917f7d13a800c84963404b55189e82b783b86ad2172516aa8efe4cf51d54a4f72ade919081900360a00190a3505050565b600c54600090600160a060020a031633146116d757600080fd5b8415156116fa57600c8054600160a060020a031916600160a060020a0386161790555b846001141561171f57600e8054600160a060020a031916600160a060020a0386161790555b846002141561174457600d8054600160a060020a031916600160a060020a0386161790555b846003141561175357602b8390555b846004141561176257602c8390555b846005141561178057815161177e90602e906020850190615d81565b505b846006141561178f57602a8390555b846007141561179e57602d8390555b84600814156117f157600f8054600160a060020a031916600160a060020a03868116919091179182905516156117f157600f5460108054600160a060020a031916600160a060020a039092169190911790555b84600914156118445760118054600160a060020a031916600160a060020a03868116919091179182905516156118445760115460128054600160a060020a031916600160a060020a039092169190911790555b84600a141561186d57604080518082019091528381526064602090910181905260138490556014555b84600b141561189657604080518082019091528381526064602090910181905260158490556016555b84600c14156118bf57604080518082019091528381526064602090910181905260178490556018555b84600d14156118e85760408051808201909152838152606460209091018190526019849055601a555b84600e1415611911576040805180820190915283815260646020909101819052601b849055601c555b84600f141561193a576040805180820190915283815260646020909101819052601d849055601e555b8460101415611962576040805180820190915283815260646020918201819052601f85905590555b846011141561198b57604080518082019091528381526064602090910181905260218490556022555b846012141561199a5760258390555b84601314156119a95760268390555b8460141415611a32576000838152603a60205260408120546039805490919081106119d057fe5b6000918252602091829020600660079092020101919091556040805185815233928101839052600181830152426080820152905185917f7d13a800c84963404b55189e82b783b86ad2172516aa8efe4cf51d54a4f72ade919081900360a00190a35b8460631415611a5057611a4483612050565b9050611a50818461461d565b5050505050565b60315481565b60295481565b61155b8383836020604051908101604052806000815250613437565b6000611a8a82612050565b600160a060020a03163314611a9e57600080fd5b6000828152603a6020526040902054603980549091908110611abc57fe5b9060005260206000209060070201600401805490509050611add338361461d565b601054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018490529051600160a060020a039092169163a9059cbb916044808201926020929091908290030181600087803b158015611b4a57600080fd5b505af1158015611b5e573d6000803e3d6000fd5b505050506040513d6020811015611b7457600080fd5b50505050565b600c54600090819081908190819081906060908190600160a060020a03163314611ba357600080fd5b60325460ff1615611bb357600080fd5b8997505b88600101881015611d5357603e54604080517fdb737c78000000000000000000000000000000000000000000000000000000008152600481018b90526000602482018190529151600160a060020a039093169263db737c789260448084019391929182900301818387803b158015611c2e57600080fd5b505af1158015611c42573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260e0811015611c6b57600080fd5b8151602083015160408401516060850151608086015160a08701805195979496939592949193820192640100000000811115611ca657600080fd5b82016020810184811115611cb957600080fd5b8151856020820283011164010000000082111715611cd657600080fd5b50509291906020018051640100000000811115611cf257600080fd5b82016020810184811115611d0557600080fd5b8151856020820283011164010000000082111715611d2257600080fd5b50509291905050509650965096509650965096509650611d4888888888888888886149d2565b600190970196611bb7565b50505050505050505050565b60265481565b6000611d6f6114cd565b8210611d7a57600080fd5b6007805483908110611d8857fe5b90600052602060002001549050919050565b33600090815260386020526040902054801515611e73576040805160808101825233808252426020808401918252600084860181815260608601828152603780546001810182558185529751600080516020615f7183398151915260049099029889018054600160a060020a031916600160a060020a039092169190911790559451600080516020615f518339815191528801559051600080516020615f3183398151915287015551600080516020615f1183398151915290950194909455905491835260389052919020600019919091019055611e99565b42603782815481101515611e8357fe5b9060005260206000209060040201600101819055505b601254604080517e54438d000000000000000000000000000000000000000000000000000000008152336004820152346024820152604481018690529051600160a060020a03909216916254438d916064808201926020929091908290030181600087803b158015611f0a57600080fd5b505af1158015611f1e573d6000803e3d6000fd5b505050506040513d6020811015611f3457600080fd5b5051151561203157601254604080517f4d79874e000000000000000000000000000000000000000000000000000000008152336004820152346024820152604481018690529051600160a060020a0390921691634d79874e916064808201926020929091908290030181600087803b158015611faf57600080fd5b505af1158015611fc3573d6000803e3d6000fd5b505050506040513d6020811015611fd957600080fd5b50511515612031576040805160e560020a62461bcd02815260206004820152601960248201527f43616e6e6f742042757920746869732043617264205965742100000000000000604482015290519081900360640190fd5b61155b8383614b5d565b3360009081526024602052604090205490565b565b600081815260016020526040812054600160a060020a03168015156115a857600080fd5b602e805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156120fa5780601f106120cf576101008083540402835291602001916120fa565b820191906000526020600020905b8154815290600101906020018083116120dd57829003601f168201915b505050505081565b6000600160a060020a038216151561211957600080fd5b50600160a060020a031660009081526003602052604090205490565b600080600080600080606080612149615dff565b6121528b612050565b60008c8152603a602052604090205460398054929b5091811061217157fe5b60009182526020918290206040805160e08101825260079093029091018054835260018101548385015260028101548383015260038101546060840152600481018054835181870281018701909452808452939491936080860193928301828280156121fc57602002820191906000526020600020905b8154815260200190600101908083116121e8575b505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561225457602002820191906000526020600020905b815481526020019060010190808311612240575b505050918352505060069190910154602091820152815160c08301516060840151928401516040850151929c50909a5098509650945090508915156122a257806080015192508060a0015191505b509295985092959890939650565b3360009081526024602052604081208054919055602f546122d7908263ffffffff61500d16565b602f55604051339082156108fc029083906000818181858888f19350505050151561232857336000908152602460205260409020805482019055602f54612324908263ffffffff61502416565b602f555b50565b60606000805b8451821015610e0b575060005b83518110156132da5760ff86161515612b05576000603b6000878581518110151561236557fe5b9060200190602002015181526020019081526020016000206000868481518110151561238d57fe5b906020019060200201518152602001908152602001600020541115612b00576012548551600160a060020a03909116906395978868908590839063997bc6c9908a90889081106123d957fe5b906020019060200201516040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b15801561241c57600080fd5b505af1158015612430573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561245957600080fd5b81019080805164010000000081111561247157600080fd5b8201602081018481111561248457600080fd5b815164010000000081118282018710171561249e57600080fd5b50506012548b51919450600160a060020a0316925063997bc6c991508a90889081106124c657fe5b906020019060200201516040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b15801561250957600080fd5b505af115801561251d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561254657600080fd5b81019080805164010000000081111561255e57600080fd5b8201602081018481111561257157600080fd5b815164010000000081118282018710171561258b57600080fd5b50509291905050506040518463ffffffff1660e060020a028152600401808060200180602001806020018060200180602001868103865289818151815260200191508051906020019080838360005b838110156125f25781810151838201526020016125da565b50505050905090810190601f16801561261f5780820380516001836020036101000a031916815260200191505b50868103855260018152602001807f5b00000000000000000000000000000000000000000000000000000000000000815250602001868103845288818151815260200191508051906020019080838360005b83811015612689578181015183820152602001612671565b50505050905090810190601f1680156126b65780820380516001836020036101000a031916815260200191505b508681038352600181526020018060f960020a601d02815250602001868103825287818151815260200191508051906020019080838360005b838110156127075781810151838201526020016126ef565b50505050905090810190601f1680156127345780820380516001836020036101000a031916815260200191505b5098505050505050505050600060405180830381600087803b15801561275957600080fd5b505af115801561276d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561279657600080fd5b8101908080516401000000008111156127ae57600080fd5b820160208101848111156127c157600080fd5b81516401000000008111828201871017156127db57600080fd5b50506012548951919750600160a060020a031693506345e965cd9250869150839063f76f950e90603b906000908c908a90811061281457fe5b90602001906020020151815260200190815260200160002060008a8881518110151561283c57fe5b906020019060200201518152602001908152602001600020546040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b15801561288e57600080fd5b505af11580156128a2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156128cb57600080fd5b8101908080516401000000008111156128e357600080fd5b820160208101848111156128f657600080fd5b815164010000000081118282018710171561291057600080fd5b50509291905050506040518363ffffffff1660e060020a0281526004018080602001806020018060200180602001858103855287818151815260200191508051906020019080838360005b8381101561297357818101518382015260200161295b565b50505050905090810190601f1680156129a05780820380516001836020036101000a031916815260200191505b508581038452600181526020018060f960020a601d02815250602001858103835286818151815260200191508051906020019080838360005b838110156129f15781810151838201526020016129d9565b50505050905090810190601f168015612a1e5780820380516001836020036101000a031916815260200191505b50858103825260018152602001807f5d000000000000000000000000000000000000000000000000000000000000008152506020019650505050505050600060405180830381600087803b158015612a7557600080fd5b505af1158015612a89573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015612ab257600080fd5b810190808051640100000000811115612aca57600080fd5b82016020810184811115612add57600080fd5b8151640100000000811182820187101715612af757600080fd5b50909650505050505b6132d2565b60ff86166000908152603c6020526040812086518290889086908110612b2757fe5b90602001906020020151815260200190815260200160002060008684815181101515612b4f57fe5b9060200190602002015181526020019081526020016000205411156132d2576012548551600160a060020a03909116906395978868908590839063997bc6c9908a9088908110612b9b57fe5b906020019060200201516040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b158015612bde57600080fd5b505af1158015612bf2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015612c1b57600080fd5b810190808051640100000000811115612c3357600080fd5b82016020810184811115612c4657600080fd5b8151640100000000811182820187101715612c6057600080fd5b50506012548b51919450600160a060020a0316925063997bc6c991508a9088908110612c8857fe5b906020019060200201516040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b158015612ccb57600080fd5b505af1158015612cdf573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015612d0857600080fd5b810190808051640100000000811115612d2057600080fd5b82016020810184811115612d3357600080fd5b8151640100000000811182820187101715612d4d57600080fd5b50509291905050506040518463ffffffff1660e060020a028152600401808060200180602001806020018060200180602001868103865289818151815260200191508051906020019080838360005b83811015612db4578181015183820152602001612d9c565b50505050905090810190601f168015612de15780820380516001836020036101000a031916815260200191505b50868103855260018152602001807f5b00000000000000000000000000000000000000000000000000000000000000815250602001868103845288818151815260200191508051906020019080838360005b83811015612e4b578181015183820152602001612e33565b50505050905090810190601f168015612e785780820380516001836020036101000a031916815260200191505b508681038352600181526020018060f960020a601d02815250602001868103825287818151815260200191508051906020019080838360005b83811015612ec9578181015183820152602001612eb1565b50505050905090810190601f168015612ef65780820380516001836020036101000a031916815260200191505b5098505050505050505050600060405180830381600087803b158015612f1b57600080fd5b505af1158015612f2f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015612f5857600080fd5b810190808051640100000000811115612f7057600080fd5b82016020810184811115612f8357600080fd5b8151640100000000811182820187101715612f9d57600080fd5b505060125460ff8b166000908152603c602052604081208b51939950600160a060020a0390921695506345e965cd9450889350859263f76f950e9291908c908a908110612fe657fe5b90602001906020020151815260200190815260200160002060008a8881518110151561300e57fe5b906020019060200201518152602001908152602001600020546040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b15801561306057600080fd5b505af1158015613074573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561309d57600080fd5b8101908080516401000000008111156130b557600080fd5b820160208101848111156130c857600080fd5b81516401000000008111828201871017156130e257600080fd5b50509291905050506040518363ffffffff1660e060020a0281526004018080602001806020018060200180602001858103855287818151815260200191508051906020019080838360005b8381101561314557818101518382015260200161312d565b50505050905090810190601f1680156131725780820380516001836020036101000a031916815260200191505b508581038452600181526020018060f960020a601d02815250602001858103835286818151815260200191508051906020019080838360005b838110156131c35781810151838201526020016131ab565b50505050905090810190601f1680156131f05780820380516001836020036101000a031916815260200191505b50858103825260018152602001807f5d000000000000000000000000000000000000000000000000000000000000008152506020019650505050505050600060405180830381600087803b15801561324757600080fd5b505af115801561325b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561328457600080fd5b81019080805164010000000081111561329c57600080fd5b820160208101848111156132af57600080fd5b81516401000000008111828201871017156132c957600080fd5b50909650505050505b60010161233e565b600190910190612331565b600c54600090600160a060020a031633146132ff57600080fd5b60325460ff161561330f57600080fd5b50815b8160010163ffffffff168163ffffffff16101561155b576133388163ffffffff1661503d565b600101613312565b600a8054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ea05780601f10610e7557610100808354040283529160200191610ea0565b602c5481565b60365481565b600160a060020a0382163314156133c357600080fd5b336000818152600460209081526040808320600160a060020a03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b60335481565b61344284848461151b565b61344e848484846151a7565b1515611b7457600080fd5b60325460ff1681565b60345481565b606061347382613ee9565b151561347e57600080fd5b601254604080517ff76f950e000000000000000000000000000000000000000000000000000000008152600481018590529051600160a060020a039092169163ff74927b91602e91849163f76f950e91602480830192600092919082900301818387803b1580156134ee57600080fd5b505af1158015613502573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561352b57600080fd5b81019080805164010000000081111561354357600080fd5b8201602081018481111561355657600080fd5b815164010000000081118282018710171561357057600080fd5b50506040805160e060020a63ffffffff8916028152600481019182528654600260001961010060018416150201909116046044820181905292955090935083925060248101916064909101908690801561360b5780601f106135e05761010080835404028352916020019161360b565b820191906000526020600020905b8154815290600101906020018083116135ee57829003601f168201915b5050838103825284518152845160209182019186019080838360005b8381101561363f578181015183820152602001613627565b50505050905090810190601f16801561366c5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561368d57600080fd5b505af11580156136a1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156136ca57600080fd5b8101908080516401000000008111156136e257600080fd5b820160208101848111156136f557600080fd5b815164010000000081118282018710171561370f57600080fd5b50909695505050505050565b602d5481565b6000806000806000606080613734615dff565b61373d8a612050565b60008b8152603a602052604090205460398054929a5091811061375c57fe5b60009182526020918290206040805160e08101825260079093029091018054835260018101548385015260028101548383015260038101546060840152600481018054835181870281018701909452808452939491936080860193928301828280156137e757602002820191906000526020600020905b8154815260200190600101908083116137d3575b505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561383f57602002820191906000526020600020905b81548152602001906001019080831161382b575b50505091835250506006919091015460209182015281516060830151918301516040840151919a50985096509450905088151561388557806080015192508060a0015191505b5092959891949750929550565b600d54600090600160a060020a031633146138ac57600080fd5b5060238054600091829055600d546040519192600160a060020a03909116916108fc919081818181818888f19350505050151561232857602355565b6000808484601260009054906101000a9004600160a060020a0316600160a060020a031663862c5e16333485856040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a031681526020018481526020018060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015613989578181015183820152602001613971565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156139c85781810151838201526020016139b0565b505050509050019650505050505050602060405180830381600087803b1580156139f157600080fd5b505af1158015613a05573d6000803e3d6000fd5b505050506040513d6020811015613a1b57600080fd5b50511515600114613a76576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420656e6f75676820455448210000000000000000000000000000000000604482015290519081900360640190fd5b6012546040517f6202622900000000000000000000000000000000000000000000000000000000815233600482018181526060602484019081528b5160648501528b518c958c95600160a060020a039091169463620262299490938893889360448101916084909101906020808801910280838360005b83811015613b05578181015183820152602001613aed565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015613b44578181015183820152602001613b2c565b5050505090500195505050505050602060405180830381600087803b158015613b6c57600080fd5b505af1158015613b80573d6000803e3d6000fd5b505050506040513d6020811015613b9657600080fd5b50511515600114613bf1576040805160e560020a62461bcd02815260206004820181905260248201527f536f6d65206f662074686973206c616e6420616c7265616479206f776e656421604482015290519081900360640190fd5b33600090815260386020526040902054801515613cca576040805160808101825233808252426020808401918252600084860181815260608601828152603780546001810182558185529751600080516020615f7183398151915260049099029889018054600160a060020a031916600160a060020a039092169190911790559451600080516020615f518339815191528801559051600080516020615f3183398151915287015551600080516020615f1183398151915290950194909455905491835260389052919020600019919091019055613cf0565b42603782815481101515613cda57fe5b9060005260206000209060040201600101819055505b349650613d0c613cff89615329565b889063ffffffff61500d16565b9650613d31613d2260158963ffffffff6153df16565b602f549063ffffffff61502416565b602f55613d3f8760136145b7565b613d4a8b8b8b613f06565b613d63613d5e60158963ffffffff6153df16565b61540a565b6032805460ff191660011790556027548a5110801590613d8557506000602554115b15613e96576028548a51811515613d9857fe5b049550602554861115613dab5760255495505b601054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018990529051600160a060020a039092169163a9059cbb916044808201926020929091908290030181600087803b158015613e1857600080fd5b505af1158015613e2c573d6000803e3d6000fd5b505050506040513d6020811015613e4257600080fd5b5050604080513380825260208201899052428284015291517f4b4baca05c77f3008ba9b998920e58005aeb17a94101186b0a80f564075c043e9181900360600190a260268054870190556025805487900390555b5050505050505050505050565b60305481565b60235481565b602f5481565b600160a060020a03918216600090815260046020908152604080832093909416825291909152205460ff1690565b60285481565b600090815260016020526040902054600160a060020a0316151590565b6000603154600101603181905550613f20336031546155ab565b6040805160e0810182528581528451602954908102602080840191825287519092029383019384528551602d5402606084019081526080840188815260a08501889052600060c08601819052603980546001810180835591909252865160079092027fdc16fef70f8d5ddbc01ee3d903d1e69c18a3c7be080eb86a81e0578814ee58d3810192835594517fdc16fef70f8d5ddbc01ee3d903d1e69c18a3c7be080eb86a81e0578814ee58d486015596517fdc16fef70f8d5ddbc01ee3d903d1e69c18a3c7be080eb86a81e0578814ee58d585015591517fdc16fef70f8d5ddbc01ee3d903d1e69c18a3c7be080eb86a81e0578814ee58d6840155518051919361404e937fdc16fef70f8d5ddbc01ee3d903d1e69c18a3c7be080eb86a81e0578814ee58d70192910190615e3a565b5060a0820151805161406a916005840191602090910190615e3a565b5060c0919091015160069091015550603954603180546000908152603a60205260409020600019909201909155546140a39084846155fa565b50336000908152603860205260409020548151602d5460378054919092029190839081106140cd57fe5b906000526020600020906004020160020154016037828154811015156140ef57fe5b9060005260206000209060040201600201819055508151602d540260365401603681905550825160378281548110151561412557fe5b9060005260206000209060040201600301540160378281548110151561414757fe5b90600052602060002090600402016003018190555033600160a060020a03166031547f807689f8da61b73f683c57d12d78610d2e69edfaa2feac878373d92ba25e2730603154338888600081518110151561419e57fe5b906020019060200201518860008151811015156141b757fe5b60209081029091018101518b516029548c51602d54604080519a8b52600160a060020a03909916958a0195909552888801969096526060880194909452608087019190915260a086015260c08501919091520260e08301524261010083015251908190036101200190a3505051602a5460298054918302909101905560338054909101905550565b60008061424b83612050565b905080600160a060020a031684600160a060020a03161480614286575083600160a060020a031661427b84610eab565b600160a060020a0316145b8061429657506142968185613eb5565b949350505050565b6000818152603a602052604081205460398054839283929181106142be57fe5b90600052602060002090600702016003015492506039603a6000868152602001908152602001600020548154811015156142f457fe5b90600052602060002090600702016004018054905091506038600087600160a060020a0316600160a060020a031681526020019081526020016000205490508260378281548110151561434357fe5b9060005260206000209060040201600201540360378281548110151561436557fe5b9060005260206000209060040201600201819055508160378281548110151561438a57fe5b906000526020600020906004020160030154036037828154811015156143ac57fe5b6000918252602080832060036004909302019190910192909255600160a060020a03871681526038909152604090205490508015156144a8575060408051608081018252600160a060020a03868116808352426020808501918252600085870181815260608701828152603780546001810182558185529851600080516020615f718339815191526004909a02998a018054600160a060020a03191691909916179097559351600080516020615f5183398151915288015551600080516020615f318339815191528701559151600080516020615f11833981519152909501949094558254918152603890935292909120600019928301905554015b826037828154811015156144b857fe5b906000526020600020906004020160020154016037828154811015156144da57fe5b906000526020600020906004020160020181905550816037828154811015156144ff57fe5b9060005260206000209060040201600301540160378281548110151561452157fe5b906000526020600020906004020160030181905550505050505050565b614548338261423f565b151561455357600080fd5b61455d83826156bb565b614567838261571d565b6145718282615824565b8082600160a060020a031684600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b600d54600160a060020a03166108fc6145d6838563ffffffff6153df16565b6040518115909202916000818181858888f19350505050151561461957614615614606828463ffffffff6153df16565b6023549063ffffffff61502416565b6023555b5050565b600080600080600080614630888861586d565b6000878152603a602052604090205460398054909190811061464e57fe5b90600052602060002090600702016003015495506039603a60008981526020019081526020016000205481548110151561468457fe5b6000918252602080832060046007909302019190910154603380548290039055603680548a90039055600160a060020a038b1683526038909152604090912054603780549297509095508791869081106146da57fe5b906000526020600020906004020160020154036037858154811015156146fc57fe5b9060005260206000209060040201600201819055508460378581548110151561472157fe5b9060005260206000209060040201600301540360378581548110151561474357fe5b906000526020600020906004020160030181905550600092505b6000878152603a602052604090205460398054909190811061477b57fe5b90600052602060002090600702016004018054905083101561485b576000878152603a602052604081205460398054603b9284929181106147b857fe5b9060005260206000209060070201600401868154811015156147d657fe5b9060005260206000200154815260200190815260200160002060006039603a60008c81526020019081526020016000205481548110151561481357fe5b90600052602060002090600702016005018681548110151561483157fe5b9060005260206000200154815260200190815260200160002081905550828060010193505061475d565b600191505b60058260ff16101561494c575060ff81166000908152603d6020908152604080832089845290915281209092505b80548310156149415760ff82166000908152603c6020526040812082549091908390869081106148ba57fe5b9060005260206000209060020201600001548152602001908152602001600020600082858154811015156148ea57fe5b906000526020600020906002020160010154815260200190815260200160002060009055808381548110151561491c57fe5b600091825260208220600290910201818155600190810191909155929092019161488e565b600190910190614860565b6000878152603a602052604090205460398054909190811061496a57fe5b6000918252602082206007909102018181556001810182905560028101829055600381018290559061499f6004830182615e74565b6149ad600583016000615e74565b5060006006919091018190559687525050603a60205250506040832092909255505050565b6149dc87896155ab565b6031805460019081019091556040805160e0810182528881526020808201898152928201888152606083018881526080840188815260a08501889052600060c08601819052603980549889018082559152855160079098027fdc16fef70f8d5ddbc01ee3d903d1e69c18a3c7be080eb86a81e0578814ee58d3810198895596517fdc16fef70f8d5ddbc01ee3d903d1e69c18a3c7be080eb86a81e0578814ee58d488015592517fdc16fef70f8d5ddbc01ee3d903d1e69c18a3c7be080eb86a81e0578814ee58d587015590517fdc16fef70f8d5ddbc01ee3d903d1e69c18a3c7be080eb86a81e0578814ee58d686015551805191959394614b04937fdc16fef70f8d5ddbc01ee3d903d1e69c18a3c7be080eb86a81e0578814ee58d790910192910190615e3a565b5060a08201518051614b20916005840191602090910190615e3a565b5060c09190910151600690910155506039546000898152603a602052604090206000199091019055614b538883836155fa565b5050505050505050565b6000806000806000614b6d615dff565b349550614b89614b7c88615329565b879063ffffffff61500d16565b9550614b9f613d2260198863ffffffff6153df16565b602f55614bad8660176145b7565b614bb688612050565b9450600160a060020a0385166108fc614bd6601b8963ffffffff6153df16565b6040518115909202916000818181858888f193505050501515614c4657614c2c614c07601b8863ffffffff6153df16565b600160a060020a0387166000908152602460205260409020549063ffffffff61502416565b600160a060020a0386166000908152602460205260409020555b614c5185338a61429e565b614c5c85338a6158b5565b6000888152603a6020526040902054603980549091908110614c7a57fe5b9060005260206000209060070201600301549350614ca284601f6153df90919063ffffffff16565b6000898152603a602052604090205460398054929550918110614cc157fe5b906000526020600020906007020160020154915083830360376038600033600160a060020a0316600160a060020a0316815260200190815260200160002054815481101515614d0c57fe5b9060005260206000209060040201600201540160376038600033600160a060020a0316600160a060020a0316815260200190815260200160002054815481101515614d5357fe5b906000526020600020906004020160020181905550826039603a60008b815260200190815260200160002054815481101515614d8b57fe5b90600052602060002090600702016003018190555083830360365401603681905550614df46039603a60008b815260200190815260200160002054815481101515614dd257fe5b90600052602060002090600702016002015460216153df90919063ffffffff16565b6000898152603a6020526040902054603980549091908110614e1257fe5b6000918252602090912060026007909202010155603480546001019055614e43613d5e60198863ffffffff6153df16565b6000888152603a6020526040902054603980549091908110614e6157fe5b60009182526020918290206040805160e0810182526007909302909101805483526001810154838501526002810154838301526003810154606084015260048101805483518187028101870190945280845293949193608086019392830182828015614eec57602002820191906000526020600020905b815481526020019060010190808311614ed8575b5050505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015614f4457602002820191906000526020600020905b815481526020019060010190808311614f30575b5050509183525050600691909101546020909101529050614f6488612050565b600160a060020a031685600160a060020a0316897fca6cef801d696b99880261abca3984a0cf932a69993676ef85130e9ce94e94da8b89614fa48e612050565b87516040808a01516060808c01518351978852600160a060020a039687166020890152949095168683015293850191909152608084018a905260a084019290925260c083018b905260e08301524261010083015251908190036101200190a45050505050505050565b6000808383111561501d57600080fd5b5050900390565b60008282018381101561503657600080fd5b9392505050565b603e54604080517f23272065000000000000000000000000000000000000000000000000000000008152600481018490529051600092839283928392600160a060020a031691632327206591602480830192608092919082900301818787803b1580156150a957600080fd5b505af11580156150bd573d6000803e3d6000fd5b505050506040513d60808110156150d357600080fd5b5080516020808301516040808501516060958601518251608081018452600160a060020a039687168082528187019586528185019384529781019182526037805460018101825560008281529251600080516020615f7183398151915260049092029182018054600160a060020a03191691909a16179098559451600080516020615f518339815191528801559151600080516020615f3183398151915287015551600080516020615f11833981519152909501949094559054938352603890915290206000199190910190555050505050565b6000806151bc85600160a060020a0316615957565b15156151cb5760019150615320565b6040517f150b7a020000000000000000000000000000000000000000000000000000000081523360048201818152600160a060020a03898116602485015260448401889052608060648501908152875160848601528751918a169463150b7a0294938c938b938b93909160a490910190602085019080838360005b8381101561525e578181015183820152602001615246565b50505050905090810190601f16801561528b5780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b1580156152ad57600080fd5b505af11580156152c1573d6000803e3d6000fd5b505050506040513d60208110156152d757600080fd5b50517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1981167f150b7a020000000000000000000000000000000000000000000000000000000014925090505b50949350505050565b600080600160a060020a038316331480159061534d5750600160a060020a03831615155b156115a857615363601d3463ffffffff6153df16565b604051909150600160a060020a0384169082156108fc029083906000818181858888f19350505050156115a85760408051600160a060020a03851680825260208201849052428284015291517f500a1821a82e1e9951feb0c4eb0043d6f9d97be1a522ffa083f6a91b7b5c013d9181900360600190a292915050565b60008115156153f0575060006115a8565b60018301548354830281151561540257fe5b049392505050565b6032546000908190819081908190819060ff161561559957600095506000945060355487019350600192505b603754831015615550576298968060365460378581548110151561545657fe5b906000526020600020906004020160020154629896800281151561547657fe5b04629896800281151561548557fe5b0491505062989680830481026000811115615545576154e781602460006037878154811015156154b157fe5b60009182526020808320600490920290910154600160a060020a031683528201929092526040019020549063ffffffff61502416565b602460006037868154811015156154fa57fe5b60009182526020808320600490920290910154600160a060020a03168352820192909252604001902055603054615537908263ffffffff61502416565b603055948501946001909401935b600190920191615436565b60006035556040805187815260208101879052428183015290517f5fe10e72bed621bd9aa98489cd68e8ee3f0446c3472cea71de9c6c105c089f8f9181900360600190a16155a2565b60358054880190555b50505050505050565b6155b5828261595f565b600780546000838152600860205260408120829055600182018355919091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688015550565b6000805b83518210156156675784603b6000868581518110151561561a57fe5b9060200190602002015181526020019081526020016000206000858581518110151561564257fe5b60209081029091018101518252810191909152604001600020556001909101906155fe565b5060015b6005821015611a50576156b08185600081518110151561568757fe5b906020019060200201518560008151811015156156a057fe5b90602001906020020151886159ba565b60019091019061566b565b81600160a060020a03166156ce82612050565b600160a060020a0316146156e157600080fd5b600081815260026020526040902054600160a060020a0316156146195760009081526002602052604090208054600160a060020a031916905550565b600080600061572c8585615b69565b600084815260066020908152604080832054600160a060020a038916845260059092529091205490935061576790600163ffffffff61500d16565b600160a060020a03861660009081526005602052604090208054919350908390811061578f57fe5b90600052602060002001549050806005600087600160a060020a0316600160a060020a03168152602001908152602001600020848154811015156157cf57fe5b6000918252602080832090910192909255600160a060020a0387168152600590915260409020805490615806906000198301615e92565b50600093845260066020526040808520859055908452909220555050565b60006158308383615bf2565b50600160a060020a039091166000908152600560209081526040808320805460018101825590845282842081018590559383526006909152902055565b6158778282615c75565b6000818152600b60205260409020546002600019610100600184161502019091160415614619576000818152600b6020526040812061461991615eb6565b600081815260026020526040902054600160a060020a0316156158ef5760008181526002602052604090208054600160a060020a03191690555b600160a060020a0383166000908152600360205260409020546001101561593157600160a060020a038316600090815260036020526040902080546000190190555b60008181526001602052604090208054600160a060020a03191690556145718282615824565b6000903b1190565b600160a060020a038216151561597457600080fd5b61597e8282615824565b6040518190600160a060020a038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b601254604080517f99a2e1ec00000000000000000000000000000000000000000000000000000000815260ff87166004820152602481018690529051600160a060020a03909216916399a2e1ec916044808201926020929091908290030181600087803b158015615a2a57600080fd5b505af1158015615a3e573d6000803e3d6000fd5b505050506040513d6020811015615a5457600080fd5b5051601254604080517f99a2e1ec00000000000000000000000000000000000000000000000000000000815260ff88166004820152602481018690529051929550600160a060020a03909116916399a2e1ec916044808201926020929091908290030181600087803b158015615ac957600080fd5b505af1158015615add573d6000803e3d6000fd5b505050506040513d6020811015615af357600080fd5b505160ff9094166000818152603c6020908152604080832087845282528083208884528252808320859055928252603d8152828220938252928352818120825180840190935294825281830195865284546001818101875595825292902090516002909202019081559251929091019190915550565b81600160a060020a0316615b7c82612050565b600160a060020a031614615b8f57600080fd5b600160a060020a038216600090815260036020526040902054615bb990600163ffffffff61500d16565b600160a060020a039092166000908152600360209081526040808320949094559181526001909152208054600160a060020a0319169055565b600081815260016020526040902054600160a060020a031615615c1457600080fd5b60008181526001602081815260408084208054600160a060020a031916600160a060020a0388169081179091558452600390915290912054615c5591615024565b600160a060020a0390921660009081526003602052604090209190915550565b6000806000615c848585615d31565b600084815260086020526040902054600754909350615caa90600163ffffffff61500d16565b9150600782815481101515615cbb57fe5b9060005260206000200154905080600784815481101515615cd857fe5b60009182526020822001919091556007805484908110615cf457fe5b6000918252602090912001556007805490615d13906000198301615e92565b50600093845260086020526040808520859055908452909220555050565b615d3b82826156bb565b615d45828261571d565b6040518190600090600160a060020a038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10615dc257805160ff1916838001178555615def565b82800160010185558215615def579182015b82811115615def578251825591602001919060010190615dd4565b50615dfb929150615ef6565b5090565b6040805160e08101825260008082526020820181905291810182905260608082018390526080820181905260a082015260c081019190915290565b828054828255906000526020600020908101928215615def5791602002820182811115615def578251825591602001919060010190615dd4565b50805460008255906000526020600020908101906123289190615ef6565b81548183558181111561155b5760008381526020902061155b918101908301615ef6565b50805460018160011615610100020316600290046000825580601f10615edc5750612328565b601f01602090049060005260206000209081019061232891905b610ea891905b80821115615dfb5760008155600101615efc560042a7b7dd785cd69714a189dffb3fd7d7174edc9ece837694ce50f7078f7c31b142a7b7dd785cd69714a189dffb3fd7d7174edc9ece837694ce50f7078f7c31b042a7b7dd785cd69714a189dffb3fd7d7174edc9ece837694ce50f7078f7c31af42a7b7dd785cd69714a189dffb3fd7d7174edc9ece837694ce50f7078f7c31aea165627a7a7230582006b5222f52e0c963ad5572759afefb3425cf2e11a74f99db4cd5332bde4343bb0029

Swarm Source

bzzr://06b5222f52e0c963ad5572759afefb3425cf2e11a74f99db4cd5332bde4343bb
Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.

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