Sponsored:   Kirik Meta Protocol - New Generation of Blockchain - Join Pre-Sale Aug 15-17
Contract Overview
Balance: 0 Ether
Ether Value: $0
Transactions: 573 txns
Token Tracker: LandGrab (KING)
 Latest 25 txns from a total Of 573 transactions

TxHash Age From To Value [TxFee]
0xd88f28e69422694932114b9c099e890152cb1c6711e380c1d2a834299fc3435e165 days 1 hr ago0x2f9eb05f0c01f62e8b5ff5e72ab4f821b0f956ae  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.0046 Ether0.000045836
0x3040c4084aabfa1bf6c688ee98fce0ce5876331e798453dfc6a2a0ff589fefd4171 days 1 hr ago0x2b73df3510ee4d868a4c4bc8034f377ce7c64c32  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090 Ether0.000451432
0xa15a8eeb6efd5f8bb5d0d1087cd10282cf65c4fc1ba6280db32c372cf659a841173 days 18 hrs ago0x581921b12e42bf6d5a74ccce8b2329fff5d38f8b  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090 Ether0.00122451
0xbc63fb14bb3afac302323d488aeba0ff68b5a51052d27281864708a6591f950f173 days 22 hrs ago0x2f9eb05f0c01f62e8b5ff5e72ab4f821b0f956ae  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.0046 Ether0.000022918
0x497202eb6bd7b7ca9a774725c3c818731088aac74f741c0c089d88471bb3a8b7174 days 10 hrs ago0xe55bf01b61b5c28c191d4bbf40111f0a287cc41c  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.0205 Ether0.0002818
0x2341d8a96659fc8d5d8779e17a559da605f69787afe4b502c6124b29019f6ef1174 days 10 hrs ago0x71f35825a3b1528859dfa1a64b24242bc0d12990  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.0097 Ether0.00077724
0x74c967709e1b2bf0c138cd24e6548f081d2f7c651e8d828491b11f105456df97174 days 10 hrs ago0xe55bf01b61b5c28c191d4bbf40111f0a287cc41c  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.0437 Ether0.00011272
0x0033cad5a347c0a3b7098077c26fdd69a3d881f82f25774450da1e938b79a7d2174 days 10 hrs ago0xe55bf01b61b5c28c191d4bbf40111f0a287cc41c  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.0437 Ether0.00011272
0x1cd5b91bb3290dfd5aebc3a5d75d00b14d88c6e59a776701a58d4f77756bf7bf174 days 10 hrs ago0x05f2c11996d73288abe8a31d8b593a693ff2e5d8  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.0205 Ether0.00034544
0x2069a4b6bb918ac735255ab203f0a52ae9d5d8e3df878f1c6b8a0f5ecbfd3a41174 days 11 hrs ago0xe55bf01b61b5c28c191d4bbf40111f0a287cc41c  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.0046 Ether0.00014272
0x5cebf0c0b2fd694e0b162311de8ef6eddbd6b53fa4c24769b6d7682350522265174 days 11 hrs ago0xe55bf01b61b5c28c191d4bbf40111f0a287cc41c  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.0097 Ether0.00017272
0xcaeccd48a0035e2ad97c6a6116805f7835fc6d4a0f45ba52669ab98b0556e933174 days 11 hrs ago0xd3dead0690e4df17e4de54be642ca967ccf082b8  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.001 Ether0.000022918
0x25ca196ea0537b48e35eca809fc32f43e568840f64f575c5c2fd710a1e819585174 days 11 hrs ago0x049bed1598655b64f09e4835084fbc502ab1ad86  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.0022 Ether0.00011272
0x7d52ff5a3e759016f920b992f6780f470753e0ad7f397441c151bf7abf0bb0d0174 days 11 hrs ago0x049bed1598655b64f09e4835084fbc502ab1ad86  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.0046 Ether0.00014272
0x2261aa98e34f0b13ecf054817c348d46e46935e4540997a5e0f1b614f48cd0f3174 days 13 hrs ago0xd3dead0690e4df17e4de54be642ca967ccf082b8  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.0022 Ether0.00007136
0x28ae550eed3f0b04104ba75d514032329c543358150b736a2a965fe8aaef6383174 days 14 hrs ago0x0e59b865c661e40621879437f6473b57c3db31fa  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.001 Ether0.000042099
0x7d032e90547e3f7609fba6c4ecb3b35bc4620e6a7fb3901e4d8f017e42ad1df4174 days 15 hrs ago0x0e59b865c661e40621879437f6473b57c3db31fa  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.001 Ether0.000144198
0x59b565c77358dd7d06029e21e6e5c15b22ce5f74d5d767723f714c0decbb1575174 days 16 hrs ago0x581921b12e42bf6d5a74ccce8b2329fff5d38f8b  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090 Ether0.000799768
0x683be4589c1b93d63ef7098d3e98a87e70566c5f2439edae9839e44e0c728d66174 days 16 hrs ago0x581921b12e42bf6d5a74ccce8b2329fff5d38f8b  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090 Ether0.00114715
0x88349258bf6acef0980eb8c0519c896089f1f4dadcdf995c482e7361508f6567174 days 20 hrs ago0xe632a7bd3018246b2c2667e33000652d4bba43a2  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.0205 Ether0.0007136
0xe359bae9471abe2e5d7ac88c2f9a5712347987b73d8bdaf9291720de9b90019a174 days 20 hrs ago0x959b9d1fb6954e66c64a64a824d681e1282f56ee  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.0097 Ether0.00021408
0x0e37c090a5a89f4dbead6f2a239e40221056cde18cecf8604bdc25097c4fb216174 days 20 hrs ago0xe632a7bd3018246b2c2667e33000652d4bba43a2  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.0046 Ether0.0007136
0x86ee86ec3aa4cf21b90b697d3da9c5fbb505dad4f41e590fc9e8056de88d1a1f174 days 20 hrs ago0x959b9d1fb6954e66c64a64a824d681e1282f56ee  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.0022 Ether0.00021408
0x623af68514c108c06624d8061fb1c152b1a794dc82bb137a0d047ec59a7fd962174 days 20 hrs ago0xe632a7bd3018246b2c2667e33000652d4bba43a2  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090.001 Ether0.00057099
0xe9891d2e263040454d9de1aa4a239697d3c9937294f1de152a462b04f0db5ba9174 days 20 hrs ago0x581921b12e42bf6d5a74ccce8b2329fff5d38f8b  IN   0x52629dd14923d9f60deafdd373ff6e1145866f090 Ether0.00114715
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
 Latest 25 Internal Txns, Click here to View More View All
ParentTxHash Block Age From To Value
0x3040c4084aabfa1bf6c688ee98fce0ce5876331e798453dfc6a2a0ff589fefd45161939171 days 1 hr ago0x52629dd14923d9f60deafdd373ff6e1145866f090x034f377ce7c64c320000000000000000000000002.408020254366515641 Ether
0x497202eb6bd7b7ca9a774725c3c818731088aac74f741c0c089d88471bb3a8b75142151174 days 10 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090xe55bf01b61b5c28c191d4bbf40111f0a287cc41c0.000006857108077358 Ether
0x497202eb6bd7b7ca9a774725c3c818731088aac74f741c0c089d88471bb3a8b75142151174 days 10 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090x71f35825a3b1528859dfa1a64b24242bc0d129900.019263554318407283 Ether
0x2341d8a96659fc8d5d8779e17a559da605f69787afe4b502c6124b29019f6ef15142134174 days 10 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090x71f35825a3b1528859dfa1a64b24242bc0d129900.000068222840796358 Ether
0x2341d8a96659fc8d5d8779e17a559da605f69787afe4b502c6124b29019f6ef15142134174 days 10 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090xe55bf01b61b5c28c191d4bbf40111f0a287cc41c0.009053870529651423 Ether
0x74c967709e1b2bf0c138cd24e6548f081d2f7c651e8d828491b11f105456df975142103174 days 10 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090xe55bf01b61b5c28c191d4bbf40111f0a287cc41c0.000097568315058209 Ether
0x74c967709e1b2bf0c138cd24e6548f081d2f7c651e8d828491b11f105456df975142103174 days 10 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090xe632a7bd3018246b2c2667e33000652d4bba43a20.040986285783845283 Ether
0x0033cad5a347c0a3b7098077c26fdd69a3d881f82f25774450da1e938b79a7d25142099174 days 10 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090xe55bf01b61b5c28c191d4bbf40111f0a287cc41c0.000097568315058209 Ether
0x0033cad5a347c0a3b7098077c26fdd69a3d881f82f25774450da1e938b79a7d25142099174 days 10 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090x05f2c11996d73288abe8a31d8b593a693ff2e5d80.040986285783845283 Ether
0x1cd5b91bb3290dfd5aebc3a5d75d00b14d88c6e59a776701a58d4f77756bf7bf5142048174 days 10 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090x05f2c11996d73288abe8a31d8b593a693ff2e5d80.000006857108077358 Ether
0x1cd5b91bb3290dfd5aebc3a5d75d00b14d88c6e59a776701a58d4f77756bf7bf5142048174 days 10 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090xe55bf01b61b5c28c191d4bbf40111f0a287cc41c0.019263554318407283 Ether
0x2069a4b6bb918ac735255ab203f0a52ae9d5d8e3df878f1c6b8a0f5ecbfd3a415141979174 days 11 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090xe55bf01b61b5c28c191d4bbf40111f0a287cc41c0.000073064735174288 Ether
0x2069a4b6bb918ac735255ab203f0a52ae9d5d8e3df878f1c6b8a0f5ecbfd3a415141979174 days 11 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090x049bed1598655b64f09e4835084fbc502ab1ad860.004255319148936169 Ether
0x5cebf0c0b2fd694e0b162311de8ef6eddbd6b53fa4c24769b6d76823505222655141969174 days 11 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090xe55bf01b61b5c28c191d4bbf40111f0a287cc41c0.000068222840796358 Ether
0x5cebf0c0b2fd694e0b162311de8ef6eddbd6b53fa4c24769b6d76823505222655141969174 days 11 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090x049bed1598655b64f09e4835084fbc502ab1ad860.009053870529651423 Ether
0x25ca196ea0537b48e35eca809fc32f43e568840f64f575c5c2fd710a1e8195855141830174 days 11 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090x049bed1598655b64f09e4835084fbc502ab1ad860.000072340425531915 Ether
0x25ca196ea0537b48e35eca809fc32f43e568840f64f575c5c2fd710a1e8195855141830174 days 11 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090x0e59b865c661e40621879437f6473b57c3db31fa0.001999999999999999 Ether
0x7d52ff5a3e759016f920b992f6780f470753e0ad7f397441c151bf7abf0bb0d05141829174 days 11 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090x049bed1598655b64f09e4835084fbc502ab1ad860.000073064735174288 Ether
0x7d52ff5a3e759016f920b992f6780f470753e0ad7f397441c151bf7abf0bb0d05141829174 days 11 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090xd3dead0690e4df17e4de54be642ca967ccf082b80.004255319148936169 Ether
0x2261aa98e34f0b13ecf054817c348d46e46935e4540997a5e0f1b614f48cd0f35141455174 days 13 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090xd3dead0690e4df17e4de54be642ca967ccf082b80.000072340425531915 Ether
0x2261aa98e34f0b13ecf054817c348d46e46935e4540997a5e0f1b614f48cd0f35141455174 days 13 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090x0e59b865c661e40621879437f6473b57c3db31fa0.001999999999999999 Ether
0x88349258bf6acef0980eb8c0519c896089f1f4dadcdf995c482e7361508f65675139740174 days 20 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090xe632a7bd3018246b2c2667e33000652d4bba43a20.000006857108077358 Ether
0x88349258bf6acef0980eb8c0519c896089f1f4dadcdf995c482e7361508f65675139740174 days 20 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090x959b9d1fb6954e66c64a64a824d681e1282f56ee0.019263554318407283 Ether
0xe359bae9471abe2e5d7ac88c2f9a5712347987b73d8bdaf9291720de9b90019a5139736174 days 20 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090x959b9d1fb6954e66c64a64a824d681e1282f56ee0.000068222840796358 Ether
0xe359bae9471abe2e5d7ac88c2f9a5712347987b73d8bdaf9291720de9b90019a5139736174 days 20 hrs ago0x52629dd14923d9f60deafdd373ff6e1145866f090xe632a7bd3018246b2c2667e33000652d4bba43a20.009053870529651423 Ether
[ Download CSV Export  ] 
Warning: The compiled contract might be susceptible to EventStructWrongData (very low-severity), NestedArrayFunctionCallDecoder (medium-severity) Solidity compiler bugs.

Contract Source Code Verified (Exact match)
Contract Name: LandGrabToken
Compiler Version: v0.4.19+commit.c4cbbb05
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.19; // solhint-disable-line

/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author Dieter Shirley <[email protected]> (https://github.com/dete)
contract ERC721 {
  // Required methods
  function approve(address _to, uint256 _tokenId) public;
  function balanceOf(address _owner) public view returns (uint256 balance);
  function implementsERC721() public pure returns (bool);
  function ownerOf(uint256 _tokenId) public view returns (address addr);
  function takeOwnership(uint256 _tokenId) public;
  function totalSupply() public view returns (uint256 total);
  function transferFrom(address _from, address _to, uint256 _tokenId) public;
  function transfer(address _to, uint256 _tokenId) public;

  event Transfer(address indexed from, address indexed to, uint256 tokenId);
  event Approval(address indexed owner, address indexed approved, uint256 tokenId);
}

contract LandGrabToken is ERC721 {

  /*** EVENTS ***/

  /// @dev The Birth event is fired whenever a new city comes into existence.
  event Birth(uint256 tokenId, string name, address owner);

  /// @dev The TokenSold event is fired whenever a token is sold.
  event TokenSold(uint256 tokenId, uint256 oldPrice, uint256 newPrice, address prevOwner, address winner, string name);

  /// @dev Transfer event as defined in current draft of ERC721. 
  ///  ownership is assigned, including births.
  event Transfer(address from, address to, uint256 tokenId);

  /*** CONSTANTS ***/

  /// @notice Name and symbol of the non fungible token, as defined in ERC721.
  string public constant NAME = "LandGrab"; // solhint-disable-line
  string public constant SYMBOL = "KING"; // solhint-disable-line

  uint256 private startingPrice = 0.001 ether;
  uint256 private constant PROMO_CREATION_LIMIT = 5000;
  uint256 private firstStepLimit =  0.053613 ether;
  uint256 private secondStepLimit = 0.564957 ether;

  /*** STORAGE ***/

  /// @dev A mapping from city IDs to the address that owns them. All citys have
  ///  some valid owner address.
  mapping (uint256 => address) public cityIndexToOwner;

  // @dev A mapping from owner address to count of tokens that address owns.
  //  Used internally inside balanceOf() to resolve ownership count.
  mapping (address => uint256) private ownershipTokenCount;

  /// @dev A mapping from cityIDs to an address that has been approved to call
  ///  transferFrom(). Each city can only have one approved address for transfer
  ///  at any time. A zero value means no approval is outstanding.
  mapping (uint256 => address) public cityIndexToApproved;

  // @dev A mapping from cityIDs to the price of the token.
  mapping (uint256 => uint256) private cityIndexToPrice;

  // The addresses of the accounts (or contracts) that can execute actions within each roles.
  address public ceoAddress;
  address public cooAddress;

  uint256 public promoCreatedCount;

  /*** DATATYPES ***/
  struct City {
    string name;
  }

  City[] private citys;

  /*** ACCESS MODIFIERS ***/
  /// @dev Access modifier for CEO-only functionality
  modifier onlyCEO() {
    require(msg.sender == ceoAddress);
    _;
  }

  /// @dev Access modifier for COO-only functionality
  modifier onlyCOO() {
    require(msg.sender == cooAddress);
    _;
  }

  /// Access modifier for contract owner only functionality
  modifier onlyCLevel() {
    require(
      msg.sender == ceoAddress ||
      msg.sender == cooAddress
    );
    _;
  }

  /*** CONSTRUCTOR ***/
  function LandGrabToken() public {
    ceoAddress = msg.sender;
    cooAddress = msg.sender;
  }

  /*** PUBLIC FUNCTIONS ***/
  /// @notice Grant another address the right to transfer token via takeOwnership() and transferFrom().
  /// @param _to The address to be granted transfer approval. Pass address(0) to
  ///  clear all approvals.
  /// @param _tokenId The ID of the Token that can be transferred if this call succeeds.
  /// @dev Required for ERC-721 compliance.
  function approve(
    address _to,
    uint256 _tokenId
  ) public {
    // Caller must own token.
    require(_owns(msg.sender, _tokenId));

    cityIndexToApproved[_tokenId] = _to;

    Approval(msg.sender, _to, _tokenId);
  }

  /// For querying balance of a particular account
  /// @param _owner The address for balance query
  /// @dev Required for ERC-721 compliance.
  function balanceOf(address _owner) public view returns (uint256 balance) {
    return ownershipTokenCount[_owner];
  }

  /// @dev Creates a new promo city with the given name, with given _price and assignes it to an address.
  function createPromoCity(address _owner, string _name, uint256 _price) public onlyCOO {
    require(promoCreatedCount < PROMO_CREATION_LIMIT);

    address cityOwner = _owner;
    if (cityOwner == address(0)) {
      cityOwner = cooAddress;
    }

    if (_price <= 0) {
      _price = startingPrice;
    }

    promoCreatedCount++;
    _createCity(_name, cityOwner, _price);
  }

  /// @dev Creates a new city with the given name.
  function createContractCity(string _name) public onlyCOO {
    _createCity(_name, address(this), startingPrice);
  }

  /// @notice Returns all the relevant information about a specific city.
  /// @param _tokenId The tokenId of the city of interest.
  function getCity(uint256 _tokenId) public view returns (
    string cityName,
    uint256 sellingPrice,
    address owner
  ) {
    City storage city = citys[_tokenId];
    cityName = city.name;
    sellingPrice = cityIndexToPrice[_tokenId];
    owner = cityIndexToOwner[_tokenId];
  }

  function implementsERC721() public pure returns (bool) {
    return true;
  }

  /// @dev For ERC-721 compliance.
  function name() public pure returns (string) {
    return NAME;
  }

  /// For querying owner of token
  /// @param _tokenId The tokenID for owner inquiry
  /// @dev Required for ERC-721 compliance.
  function ownerOf(uint256 _tokenId)
    public
    view
    returns (address owner)
  {
    owner = cityIndexToOwner[_tokenId];
    require(owner != address(0));
  }

  function payout(address _to) public onlyCLevel {
    _payout(_to);
  }

  // Allows someone to send ether and obtain the token
  function purchase(uint256 _tokenId) public payable {
    address oldOwner = cityIndexToOwner[_tokenId];
    address newOwner = msg.sender;

    uint256 sellingPrice = cityIndexToPrice[_tokenId];

    // Making sure token owner is not sending to self
    require(oldOwner != newOwner);

    // Safety check to prevent against an unexpected 0x0 default.
    require(_addressNotNull(newOwner));

    // Making sure sent amount is greater than or equal to the sellingPrice
    require(msg.value >= sellingPrice);

    uint256 payment = uint256(SafeMath.div(SafeMath.mul(sellingPrice, 94), 100));
    uint256 purchaseExcess = SafeMath.sub(msg.value, sellingPrice);

    // Update prices
    if (sellingPrice < firstStepLimit) {
      // first stage
      cityIndexToPrice[_tokenId] = SafeMath.div(SafeMath.mul(sellingPrice, 200), 94);
    } else if (sellingPrice < secondStepLimit) {
      // second stage
      cityIndexToPrice[_tokenId] = SafeMath.div(SafeMath.mul(sellingPrice, 120), 94);
    } else {
      // third stage
      cityIndexToPrice[_tokenId] = SafeMath.div(SafeMath.mul(sellingPrice, 115), 94);
    }

    _transfer(oldOwner, newOwner, _tokenId);

    // Pay previous tokenOwner if owner is not contract
    if (oldOwner != address(this)) {
      oldOwner.transfer(payment);
    }

    TokenSold(_tokenId, sellingPrice, cityIndexToPrice[_tokenId], oldOwner, newOwner, citys[_tokenId].name);

    msg.sender.transfer(purchaseExcess);
  }

  function priceOf(uint256 _tokenId) public view returns (uint256 price) {
    return cityIndexToPrice[_tokenId];
  }

  /// @dev Assigns a new address to act as the CEO. Only available to the current CEO.
  /// @param _newCEO The address of the new CEO
  function setCEO(address _newCEO) public onlyCEO {
    require(_newCEO != address(0));

    ceoAddress = _newCEO;
  }

  /// @dev Assigns a new address to act as the COO. Only available to the current COO.
  /// @param _newCOO The address of the new COO
  function setCOO(address _newCOO) public onlyCEO {
    require(_newCOO != address(0));

    cooAddress = _newCOO;
  }

  /// @dev For ERC-721 compliance.
  function symbol() public pure returns (string) {
    return SYMBOL;
  }

  /// @notice Allow pre-approved user to take ownership of a token
  /// @param _tokenId The ID of the Token that can be transferred if this call succeeds.
  /// @dev Required for ERC-721 compliance.
  function takeOwnership(uint256 _tokenId) public {
    address newOwner = msg.sender;
    address oldOwner = cityIndexToOwner[_tokenId];

    // Safety check to prevent against an unexpected 0x0 default.
    require(_addressNotNull(newOwner));

    // Making sure transfer is approved
    require(_approved(newOwner, _tokenId));

    _transfer(oldOwner, newOwner, _tokenId);
  }

  /// @param _owner The owner whose KING tokens we are interested in.
  /// @dev This method MUST NEVER be called by smart contract code. Expensive; walks the entire citys array looking for citys belonging to owner). Also returns a dynamic array, only supported for web3 calls, not contract-to-contract calls.
  function tokensOfOwner(address _owner) public view returns(uint256[] ownerTokens) {
    uint256 tokenCount = balanceOf(_owner);
    if (tokenCount == 0) {
        // Return an empty array
      return new uint256[](0);
    } else {
      uint256[] memory result = new uint256[](tokenCount);
      uint256 totalcitys = totalSupply();
      uint256 resultIndex = 0;

      uint256 cityId;
      for (cityId = 0; cityId <= totalcitys; cityId++) {
        if (cityIndexToOwner[cityId] == _owner) {
          result[resultIndex] = cityId;
          resultIndex++;
        }
      }
      return result;
    }
  }

  /// For querying totalSupply of token
  /// @dev Required for ERC-721 compliance.
  function totalSupply() public view returns (uint256 total) {
    return citys.length;
  }

  /// Owner initates the transfer of the token to another account
  /// @param _to The address for the token to be transferred to.
  /// @param _tokenId The ID of the Token that can be transferred if this call succeeds.
  /// @dev Required for ERC-721 compliance.
  function transfer(
    address _to,
    uint256 _tokenId
  ) public {
    require(_owns(msg.sender, _tokenId));
    require(_addressNotNull(_to));

    _transfer(msg.sender, _to, _tokenId);
  }

  /// Third-party initiates transfer of token from address _from to address _to
  /// @param _from The address for the token to be transferred from.
  /// @param _to The address for the token to be transferred to.
  /// @param _tokenId The ID of the Token that can be transferred if this call succeeds.
  /// @dev Required for ERC-721 compliance.
  function transferFrom(
    address _from,
    address _to,
    uint256 _tokenId
  ) public {
    require(_owns(_from, _tokenId));
    require(_approved(_to, _tokenId));
    require(_addressNotNull(_to));

    _transfer(_from, _to, _tokenId);
  }

  /*** PRIVATE FUNCTIONS ***/
  /// Safety check on _to address to prevent against an unexpected 0x0 default.
  function _addressNotNull(address _to) private pure returns (bool) {
    return _to != address(0);
  }

  /// For checking approval of transfer for address _to
  function _approved(address _to, uint256 _tokenId) private view returns (bool) {
    return cityIndexToApproved[_tokenId] == _to;
  }

  /// For creating city
  function _createCity(string _name, address _owner, uint256 _price) private {
    City memory _city = City({
      name: _name
    });
    uint256 newCityId = citys.push(_city) - 1;

    // It's probably never going to happen, 4 billion tokens are A LOT, but
    // let's just be 100% sure we never let this happen.
    require(newCityId == uint256(uint32(newCityId)));

    Birth(newCityId, _name, _owner);

    cityIndexToPrice[newCityId] = _price;

    // This will assign ownership, and also emit the Transfer event as
    // per ERC721 draft
    _transfer(address(0), _owner, newCityId);
  }

  /// Check for token ownership
  function _owns(address claimant, uint256 _tokenId) private view returns (bool) {
    return claimant == cityIndexToOwner[_tokenId];
  }

  /// For paying out balance on contract
  function _payout(address _to) private {
    if (_to == address(0)) {
      ceoAddress.transfer(this.balance);
    } else {
      _to.transfer(this.balance);
    }
  }

  /// @dev Assigns ownership of a specific city to an address.
  function _transfer(address _from, address _to, uint256 _tokenId) private {
    // Since the number of citys is capped to 2^32 we can't overflow this
    ownershipTokenCount[_to]++;
    //transfer ownership
    cityIndexToOwner[_tokenId] = _to;

    // When creating new citys _from is 0x0, but we can't account that address.
    if (_from != address(0)) {
      ownershipTokenCount[_from]--;
      // clear any previously approved ownership exchange
      delete cityIndexToApproved[_tokenId];
    }

    // Emit the transfer event.
    Transfer(_from, _to, _tokenId);
  }
}
library SafeMath {

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

  /**
  * @dev Integer division of two numbers, truncating the quotient.
  */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a / b;
    return c;
  }

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

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

    Contract ABI  
[{"constant":true,"inputs":[],"name":"promoCreatedCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"pure","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":"ceoAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"}],"name":"payout","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"implementsERC721","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"total","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cityIndexToOwner","outputs":[{"name":"","type":"address"}],"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":false,"inputs":[{"name":"_newCEO","type":"address"}],"name":"setCEO","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newCOO","type":"address"}],"name":"setCOO","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"name":"owner","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"}],"name":"createContractCity","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"},{"name":"_name","type":"string"},{"name":"_price","type":"uint256"}],"name":"createPromoCity","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"name":"ownerTokens","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"NAME","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"cooAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"takeOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"priceOf","outputs":[{"name":"price","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCity","outputs":[{"name":"cityName","type":"string"},{"name":"sellingPrice","type":"uint256"},{"name":"owner","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"cityIndexToApproved","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"purchase","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"SYMBOL","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"name","type":"string"},{"indexed":false,"name":"owner","type":"address"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"oldPrice","type":"uint256"},{"indexed":false,"name":"newPrice","type":"uint256"},{"indexed":false,"name":"prevOwner","type":"address"},{"indexed":false,"name":"winner","type":"address"},{"indexed":false,"name":"name","type":"string"}],"name":"TokenSold","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"from","type":"address"},{"indexed":false,"name":"to","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"approved","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"}]

  Contract Creation Code Switch To Opcodes View
606060405266038d7ea4c6800060005566be78bd4c57d0006001556707d72165f25ed000600255341561003157600080fd5b60078054600160a060020a033316600160a060020a031991821681179092556008805490911690911790556113c78061006b6000396000f3006060604052600436106101535763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305e45546811461015857806306fdde031461017d578063095ea7b3146102075780630a0f81681461022b5780630b7e9c441461025a5780631051db341461027957806318160ddd146102a057806321ac5aba146102b357806323b872dd146102c957806327d7874c146102f15780632ba73c15146103105780636352211e1461032f5780636714173214610345578063707d43491461039657806370a08231146103f75780638462151c1461041657806395d89b4114610488578063a3f4df7e1461049b578063a9059cbb146104ae578063b047fb50146104d0578063b2e6ceeb146104e3578063b9186d7d146104f9578063d71306511461050f578063e561f28a146105b4578063efef39a1146105ca578063f76f8d78146105d5575b600080fd5b341561016357600080fd5b61016b6105e8565b60405190815260200160405180910390f35b341561018857600080fd5b6101906105ee565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101cc5780820151838201526020016101b4565b50505050905090810190601f1680156101f95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561021257600080fd5b610229600160a060020a0360043516602435610630565b005b341561023657600080fd5b61023e6106bc565b604051600160a060020a03909116815260200160405180910390f35b341561026557600080fd5b610229600160a060020a03600435166106cb565b341561028457600080fd5b61028c61070d565b604051901515815260200160405180910390f35b34156102ab57600080fd5b61016b610712565b34156102be57600080fd5b61023e600435610718565b34156102d457600080fd5b610229600160a060020a0360043581169060243516604435610733565b34156102fc57600080fd5b610229600160a060020a0360043516610781565b341561031b57600080fd5b610229600160a060020a03600435166107e0565b341561033a57600080fd5b61023e60043561083f565b341561035057600080fd5b61022960046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061086895505050505050565b34156103a157600080fd5b61022960048035600160a060020a03169060446024803590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650509335935061089092505050565b341561040257600080fd5b61016b600160a060020a0360043516610907565b341561042157600080fd5b610435600160a060020a0360043516610922565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561047457808201518382015260200161045c565b505050509050019250505060405180910390f35b341561049357600080fd5b610190610a03565b34156104a657600080fd5b610190610a44565b34156104b957600080fd5b610229600160a060020a0360043516602435610a7b565b34156104db57600080fd5b61023e610ab3565b34156104ee57600080fd5b610229600435610ac2565b341561050457600080fd5b61016b600435610b10565b341561051a57600080fd5b610525600435610b22565b60405160208101839052600160a060020a038216604082015260608082528190810185818151815260200191508051906020019080838360005b8381101561057757808201518382015260200161055f565b50505050905090810190601f1680156105a45780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b34156105bf57600080fd5b61023e600435610c18565b610229600435610c33565b34156105e057600080fd5b610190610eb2565b60095481565b6105f661124d565b60408051908101604052600881527f4c616e6447726162000000000000000000000000000000000000000000000000602082015290505b90565b61063a3382610ee9565b151561064557600080fd5b60008181526005602052604090819020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038581169182179092559133909116907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259084905190815260200160405180910390a35050565b600754600160a060020a031681565b60075433600160a060020a03908116911614806106f6575060085433600160a060020a039081169116145b151561070157600080fd5b61070a81610f09565b50565b600190565b600a5490565b600360205260009081526040902054600160a060020a031681565b61073d8382610ee9565b151561074857600080fd5b6107528282610f94565b151561075d57600080fd5b61076682610fb4565b151561077157600080fd5b61077c838383610fc2565b505050565b60075433600160a060020a0390811691161461079c57600080fd5b600160a060020a03811615156107b157600080fd5b6007805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60075433600160a060020a039081169116146107fb57600080fd5b600160a060020a038116151561081057600080fd5b6008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600081815260036020526040902054600160a060020a031680151561086357600080fd5b919050565b60085433600160a060020a0390811691161461088357600080fd5b61070a81306000546110b2565b60085460009033600160a060020a039081169116146108ae57600080fd5b60095461138890106108bf57600080fd5b5082600160a060020a03811615156108df5750600854600160a060020a03165b600082116108ed5760005491505b6009805460010190556109018382846110b2565b50505050565b600160a060020a031660009081526004602052604090205490565b61092a61124d565b600061093461124d565b600080600061094287610907565b945084151561097257600060405180591061095a5750595b908082528060200260200182016040525095506109f9565b846040518059106109805750595b9080825280602002602001820160405250935061099b610712565b925060009150600090505b8281116109f557600081815260036020526040902054600160a060020a03888116911614156109ed57808483815181106109dc57fe5b602090810290910101526001909101905b6001016109a6565b8395505b5050505050919050565b610a0b61124d565b60408051908101604052600481527f4b494e47000000000000000000000000000000000000000000000000000000006020820152905090565b60408051908101604052600881527f4c616e6447726162000000000000000000000000000000000000000000000000602082015281565b610a853382610ee9565b1515610a9057600080fd5b610a9982610fb4565b1515610aa457600080fd5b610aaf338383610fc2565b5050565b600854600160a060020a031681565b6000818152600360205260409020543390600160a060020a0316610ae582610fb4565b1515610af057600080fd5b610afa8284610f94565b1515610b0557600080fd5b61077c818385610fc2565b60009081526006602052604090205490565b610b2a61124d565b6000806000600a85815481101515610b3e57fe5b90600052602060002090019050806000018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610be35780601f10610bb857610100808354040283529160200191610be3565b820191906000526020600020905b815481529060010190602001808311610bc657829003601f168201915b50505060009788525050600660209081526040808820546003909252909620549096600160a060020a03909116945092505050565b600560205260009081526040902054600160a060020a031681565b6000818152600360209081526040808320546006909252822054600160a060020a0391821692339281908416851415610c6b57600080fd5b610c7484610fb4565b1515610c7f57600080fd5b3483901015610c8d57600080fd5b610ca2610c9b84605e6111ee565b6064611224565b9150610cae348461123b565b9050600154831015610ce357610ccf610cc88460c86111ee565b605e611224565b600087815260066020526040902055610d19565b600254831015610cfb57610ccf610cc88460786111ee565b610d09610cc88460736111ee565b6000878152600660205260409020555b610d24858588610fc2565b30600160a060020a031685600160a060020a0316141515610d7057600160a060020a03851682156108fc0283604051600060405180830381858888f193505050501515610d7057600080fd5b7e8201e7bcbf010c2c07de59d6e97cb7e3cf67a46125c49cbc89b9d2cde1f48f8684600660008a8152602001908152602001600020548888600a8c815481101515610db757fe5b60009182526020909120016040518681526020810186905260408101859052600160a060020a0380851660608301528316608082015260c060a082018181528354600260001961010060018416150201909116049183018290529060e083019084908015610e665780601f10610e3b57610100808354040283529160200191610e66565b820191906000526020600020905b815481529060010190602001808311610e4957829003601f168201915b505097505050505050505060405180910390a1600160a060020a03331681156108fc0282604051600060405180830381858888f193505050501515610eaa57600080fd5b505050505050565b60408051908101604052600481527f4b494e4700000000000000000000000000000000000000000000000000000000602082015281565b600090815260036020526040902054600160a060020a0390811691161490565b600160a060020a0381161515610f5757600754600160a060020a039081169030163180156108fc0290604051600060405180830381858888f193505050501515610f5257600080fd5b61070a565b80600160a060020a03166108fc30600160a060020a0316319081150290604051600060405180830381858888f19350505050151561070a57600080fd5b600090815260056020526040902054600160a060020a0391821691161490565b600160a060020a0316151590565b600160a060020a0380831660008181526004602090815260408083208054600101905585835260039091529020805473ffffffffffffffffffffffffffffffffffffffff1916909117905583161561105d57600160a060020a0383166000908152600460209081526040808320805460001901905583835260059091529020805473ffffffffffffffffffffffffffffffffffffffff191690555b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef838383604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a1505050565b6110ba61125f565b60006020604051908101604052858152600a80549193506001918083016110e18382611278565b6000928352602090922085910181518190805161110292916020019061129c565b50505003905063ffffffff8116811461111a57600080fd5b7fb3b0cf861f168bcdb275c69da97b2543631552ba562628aa3c7317d4a6089ef2818686604051838152600160a060020a038216604082015260606020820181815290820184818151815260200191508051906020019080838360005b8381101561118f578082015183820152602001611177565b50505050905090810190601f1680156111bc5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a160008181526006602052604081208490556111e7908583610fc2565b5050505050565b600080831515611201576000915061121d565b5082820282848281151561121157fe5b041461121957fe5b8091505b5092915050565b600080828481151561123257fe5b04949350505050565b60008282111561124757fe5b50900390565b60206040519081016040526000815290565b60206040519081016040528061127361124d565b905290565b81548183558181151161077c5760008381526020902061077c91810190830161131a565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106112dd57805160ff191683800117855561130a565b8280016001018555821561130a579182015b8281111561130a5782518255916020019190600101906112ef565b5061131692915061133d565b5090565b61062d91905b808211156113165760006113348282611357565b50600101611320565b61062d91905b808211156113165760008155600101611343565b50805460018160011615610100020316600290046000825580601f1061137d575061070a565b601f01602090049060005260206000209081019061070a919061133d5600a165627a7a723058207d0bc21f3acfb4151c1035d1cb3e63dfcbb621d7c68a4a73f65deff601b3200b0029

   Swarm Source:
bzzr://7d0bc21f3acfb4151c1035d1cb3e63dfcbb621d7c68a4a73f65deff601b3200b

 

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