Contract 0xECd6b4A2f82b0c9FB283A4a8a1ef5ADf555f794b

 
Txn Hash
Method
Block
From
To
Value
0xc228837d8e22da1e961fab7c5cfc77a33247f08d1412265bc88eabf75b1a8d44Transfer From153500602022-08-16 3:46:3716 hrs 23 mins ago0x1203df9a2aaf21401def5bb1092ea4982976766d IN  Cryptant Crab: CC Token0 Ether0.‍00130844 14.‍17875127
0x3e373964aac0d16d33869c4ed73704a207715f8794775ea02de3e33947fe97c2Transfer From153500602022-08-16 3:46:3716 hrs 23 mins ago0x1203df9a2aaf21401def5bb1092ea4982976766d IN  Cryptant Crab: CC Token0 Ether0.‍00134831 14.‍17875127
0x2526c7fb3eb9f659a0cccc43c9a945fc1177a2b2766a1177ffc5d341991fc811Transfer From153500582022-08-16 3:46:1916 hrs 23 mins ago0x1203df9a2aaf21401def5bb1092ea4982976766d IN  Cryptant Crab: CC Token0 Ether0.‍00188835 15.‍16826267
0x4aecab67ec0dbf740286fb9792f686d83ecb45728eb2ce65b1f1c6fbfd44ae74Set Approval For...153140162022-08-10 11:15:176 days 8 hrs ago0x599de6971d683ed7baeb584176aa34ebaf2efcd1 IN  Cryptant Crab: CC Token0 Ether0.‍00087386 18.‍72841876
0x2238e73ffb3105e8e94ae06d006f82a0140fbeefa93b344c51f815c22a4687c5Set Approval For...153139122022-08-10 10:51:256 days 9 hrs ago0x8e773676d57858e6795b2a6c39df8bd0dbe111fc IN  Cryptant Crab: CC Token0 Ether0.‍00031167 6.‍67971386
0x678226c6f9ec9eb41a831ee1ba9ea17f6c787eb39562b4b42bffb07a01fa13f4Set Approval For...153122762022-08-10 4:30:176 days 15 hrs agoENS Name shinjiz.eth IN  Cryptant Crab: CC Token0 Ether0.‍00058536 12.‍52270543
0xdc387292ca59adf9b0277d1058152ec61f34b191f8007af77e44209efe6052e6Set Approval For...153044182022-08-08 23:00:217 days 21 hrs ago0xa08a529a530586ba52307b1e95c0f6da4b46ce57 IN  Cryptant Crab: CC Token0 Ether0.‍00073056 15.‍62904602
0xd8f68e4ae5bd16df65da5131ffdef33af513756119bf123929537bcddf37f5eeSet Approval For...153010822022-08-08 10:42:118 days 9 hrs ago0xa08a529a530586ba52307b1e95c0f6da4b46ce57 IN  Cryptant Crab: CC Token0 Ether0.‍00039483 8.‍46189284
0x602b378839d4e3e8740687535f8d69e51b30c76464b75508b01fd2baf1843776Transfer From153010162022-08-08 10:27:018 days 9 hrs ago0x1203df9a2aaf21401def5bb1092ea4982976766d IN  Cryptant Crab: CC Token0 Ether0.‍00081727 7.‍12567638
0x35969659f13bbcceb4715dfe16bfbfda4d3776bf35beb4c9d52f63a96b3b6d15Set Approval For...152722132022-08-03 22:42:3112 days 21 hrs agoENS Name brainscan.eth IN  Cryptant Crab: CC Token0 Ether0.‍00037271 15.‍00928966
0x71e4d896ba7467b4982c69293ddb873e62e6329b323915ef509b5f5f9537e279Set Approval For...152722132022-08-03 22:42:3112 days 21 hrs agoENS Name brainscan.eth IN  Cryptant Crab: CC Token0 Ether0.‍00037271 15.‍00928966
0x9d063e7eacae1704c8ac4d69ededb48f2bbf1c29fd5342d1cc2b71c7842a86d9Transfer From152675812022-08-03 5:23:1013 days 14 hrs ago0x47cdb84a7d15aee94afa3759932b3a5411d6c03c IN  Cryptant Crab: CC Token0 Ether0.‍00096404 9.‍00182838
0xa7082312049dcabeb06c54e4b3d453a63ecb6522fe36b55b0bc22231c9551f85Set Approval For...151534202022-07-16 11:19:0631 days 8 hrs ago0xb7df53687f9bbe3fa26b7d419f31fecb7230f5a9 IN  Cryptant Crab: CC Token0 Ether0.‍00056431 12.‍09414219
0x6dcbfb9069e1f5ba8448270a203fb13cc3cf1a6ab7fe6034d95e7ed2c5aa54f2Gift Token151533332022-07-16 10:57:5731 days 9 hrs ago0x2cc938dd38513371096e568b66fba3612da524c0 IN  Cryptant Crab: CC Token0 Ether0.‍00091687 9.‍20696394
0x39ddb155b0710427c8d609385c77384e09813f1f29a40a15fd99f8e7c32bea42Gift Token151532512022-07-16 10:37:3031 days 9 hrs ago0x2cc938dd38513371096e568b66fba3612da524c0 IN  Cryptant Crab: CC Token0 Ether0.‍00092356 8.‍08835455
0x9b28af8ea17eb76295b39e2dcd1c002d068a7733ccbb414fa8075cb2d8a9627aGift Token151531962022-07-16 10:26:1331 days 9 hrs ago0x2cc938dd38513371096e568b66fba3612da524c0 IN  Cryptant Crab: CC Token0 Ether0.‍00113028 9.‍89874963
0x56291fafc9ca3d24a1c01e1ad961ee5dbf1a2c9abd704808740cce401f9b818fGift Token151531952022-07-16 10:25:4631 days 9 hrs ago0x2cc938dd38513371096e568b66fba3612da524c0 IN  Cryptant Crab: CC Token0 Ether0.‍0009248 9.‍07696825
0xdef19b383decc2ddc182569f0962b615b1d4dd979627ccb320d25bb24c84db23Gift Token151531722022-07-16 10:21:0131 days 9 hrs ago0x2cc938dd38513371096e568b66fba3612da524c0 IN  Cryptant Crab: CC Token0 Ether0.‍0008255 8.‍96460891
0xf023669199ff4f2a2e149b99192e7a0a42eece9c3900d1f44b056cc7788ec7abGift Token151531662022-07-16 10:19:4031 days 9 hrs ago0x2cc938dd38513371096e568b66fba3612da524c0 IN  Cryptant Crab: CC Token0 Ether0.‍00095463 9.‍36977375
0x852bba6713aa876acb63cae8c9d4027f8640f5c16105c92a0a98af7e1fb876c9Gift Token151531042022-07-16 10:06:1631 days 10 hrs ago0x2cc938dd38513371096e568b66fba3612da524c0 IN  Cryptant Crab: CC Token0 Ether0.‍00132242 10.‍07294294
0x5ea56016ba68f23a7c0ac73fd6da92af29b8f0a54bc5ad24ea13571fafa0bab9Set Approval For...151390362022-07-14 6:20:5733 days 13 hrs ago0xab33e80b07ee4d34cc11815f2929d29153fc92b8 IN  Cryptant Crab: CC Token0 Ether0.‍00070903 15.‍19579969
0x083d8bfeaf9e3111796338f23030d52058089bc2b9356a9bcca4f46704bbf313Set Approval For...150684662022-07-03 8:24:5844 days 11 hrs ago0xd66d4b029eb9b14aa6d0f6d739ac00e634f336fc IN  Cryptant Crab: CC Token0 Ether0.‍0004954 10.‍61724338
0xbb7b9ea4043c78ee275001fb3de8a4ee51db35c6f501ebaf1b110e0f64fb3736Set Approval For...150670232022-07-03 2:58:5644 days 17 hrs ago0x901fd46cc87ef0c8c003ef8b4102ee21ed887243 IN  Cryptant Crab: CC Token0 Ether0.‍00051194 10.‍97190062
0xfd46330e58ee38b144eb96ba89e3fa518cd06e81c68c5803aed1c2cba7960d9eSet Approval For...150633762022-07-02 13:30:2845 days 6 hrs ago0x4ec72723682db45ab20511261bead59911876df2 IN  Cryptant Crab: CC Token0 Ether0.‍0008057 17.‍26748749
0x8a260fdec737ee6b8cc4b613814dcec469e4c3b1b76df6e2485c5cba37fbe96aSet Approval For...150429262022-06-29 3:04:1948 days 17 hrs agoENS Name deuseth.eth IN  Cryptant Crab: CC Token0 Ether0.‍00211899 45.‍33190822
[ Download CSV Export 

OVERVIEW

CryptantCrab features vibrant virtual Crabs that you collect, mutate and battle for supremacy.

View more zero value Internal Transactions in Advanced View mode
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CryptantCrabNFT

Compiler Version
v0.4.24+commit.e67f0147

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2018-10-25
*/

pragma solidity 0.4.24;

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

  /**
  * @dev Multiplies two numbers, throws on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
    // Gas optimization: this is cheaper than asserting '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;
    }

    c = a * b;
    assert(c / a == b);
    return c;
  }

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

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

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

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

  /**
   * 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 addr address to check
   * @return whether the target address is a contract
   */
  function isContract(address addr) 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(addr) }
    return size > 0;
  }

}

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

  /**
   * @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 SupportsInterfaceWithLookup
 * @author Matt Condon (@shrugs)
 * @dev Implements ERC165 using a lookup table.
 */
contract SupportsInterfaceWithLookup is ERC165 {
  bytes4 public 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) internal supportedInterfaces;

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

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

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

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
contract ERC721Receiver {
  /**
   * @dev Magic value to be returned upon successful reception of an NFT
   *  Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`,
   *  which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`
   */
  bytes4 internal constant ERC721_RECEIVED = 0x150b7a02;

  /**
   * @notice Handle the receipt of an NFT
   * @dev The ERC721 smart contract calls this function on the recipient
   * after a `safetransfer`. This function MAY throw to revert and reject the
   * transfer. Return of other than the magic value MUST result in the 
   * transaction being reverted.
   * Note: the 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 transfered
   * @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 ERC721 Non-Fungible Token Standard basic interface
 * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract ERC721Basic is ERC165 {
  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 exists(uint256 _tokenId) public view returns (bool _exists);

  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 Non-Fungible Token Standard basic implementation
 * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract ERC721BasicToken is SupportsInterfaceWithLookup, ERC721Basic {

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

  bytes4 private constant InterfaceId_ERC721Exists = 0x4f558e79;
  /*
   * 0x4f558e79 ===
   *   bytes4(keccak256('exists(uint256)'))
   */

  using SafeMath for uint256;
  using AddressUtils for address;

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

  // Mapping from token ID to owner
  mapping (uint256 => address) internal tokenOwner;

  // Mapping from token ID to approved address
  mapping (uint256 => address) internal tokenApprovals;

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

  // Mapping from owner to operator approvals
  mapping (address => mapping (address => bool)) internal operatorApprovals;

  /**
   * @dev Guarantees msg.sender is owner of the given token
   * @param _tokenId uint256 ID of the token to validate its ownership belongs to msg.sender
   */
  modifier onlyOwnerOf(uint256 _tokenId) {
    require(ownerOf(_tokenId) == msg.sender);
    _;
  }

  /**
   * @dev Checks msg.sender can transfer a token, by being owner, approved, or operator
   * @param _tokenId uint256 ID of the token to validate
   */
  modifier canTransfer(uint256 _tokenId) {
    require(isApprovedOrOwner(msg.sender, _tokenId));
    _;
  }

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

  /**
   * @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 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) public view returns (bool) {
    address owner = tokenOwner[_tokenId];
    return owner != address(0);
  }

  /**
   * @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
   * @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) {
    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
    canTransfer(_tokenId)
  {
    require(_from != address(0));
    require(_to != address(0));

    clearApproval(_from, _tokenId);
    removeTokenFrom(_from, _tokenId);
    addTokenTo(_to, _tokenId);

    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
    canTransfer(_tokenId)
  {
    // 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
    canTransfer(_tokenId)
  {
    transferFrom(_from, _to, _tokenId);
    // solium-disable-next-line arg-overflow
    require(checkAndCallSafeTransfer(_from, _to, _tokenId, _data));
  }

  /**
   * @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 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) internal {
    require(ownerOf(_tokenId) == _owner);
    if (tokenApprovals[_tokenId] != address(0)) {
      tokenApprovals[_tokenId] = address(0);
    }
  }

  /**
   * @dev Internal function to add a token ID to the list of a given address
   * @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
   * @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 checkAndCallSafeTransfer(
    address _from,
    address _to,
    uint256 _tokenId,
    bytes _data
  )
    internal
    returns (bool)
  {
    if (!_to.isContract()) {
      return true;
    }
    bytes4 retval = ERC721Receiver(_to).onERC721Received(
      msg.sender, _from, _tokenId, _data);
    return (retval == ERC721_RECEIVED);
  }
}



/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract ERC721Enumerable is ERC721Basic {
  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 Standard, optional metadata extension
 * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract ERC721Metadata is ERC721Basic {
  function name() external view returns (string _name);
  function symbol() external view returns (string _symbol);
  function tokenURI(uint256 _tokenId) public view returns (string);
}


/**
 * @title ERC-721 Non-Fungible Token Standard, full implementation interface
 * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata {
}

/**
 * @title Full ERC721 Token
 * This implementation includes all the required and some optional functionality of the ERC721 standard
 * Moreover, it includes approve all functionality using operator terminology
 * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract ERC721Token is SupportsInterfaceWithLookup, ERC721BasicToken, ERC721 {

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

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

  // Token name
  string internal name_;

  // Token symbol
  string internal symbol_;

  // Mapping from owner to list of owned token IDs
  mapping(address => uint256[]) internal ownedTokens;

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

  // Array with all token ids, used for enumeration
  uint256[] internal allTokens;

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

  // Optional mapping for token URIs
  mapping(uint256 => string) internal tokenURIs;

  /**
   * @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_ERC721Enumerable);
    _registerInterface(InterfaceId_ERC721Metadata);
  }

  /**
   * @dev Gets the token name
   * @return string representing the token name
   */
  function name() external view returns (string) {
    return name_;
  }

  /**
   * @dev Gets the token symbol
   * @return string representing the token symbol
   */
  function symbol() external view returns (string) {
    return symbol_;
  }

  /**
   * @dev Returns an URI for a given token ID
   * Throws if the token ID does not exist. May return an empty string.
   * @param _tokenId uint256 ID of the token to query
   */
  function tokenURI(uint256 _tokenId) public view returns (string) {
    require(exists(_tokenId));
    return tokenURIs[_tokenId];
  }

  /**
   * @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 set the token URI for a given token
   * Reverts if the token ID does not exist
   * @param _tokenId uint256 ID of the token to set its URI
   * @param _uri string URI to assign
   */
  function _setTokenURI(uint256 _tokenId, string _uri) internal {
    require(exists(_tokenId));
    tokenURIs[_tokenId] = _uri;
  }

  /**
   * @dev Internal function to add a token ID to the list of a given address
   * @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
   * @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);

    uint256 tokenIndex = ownedTokensIndex[_tokenId];
    uint256 lastTokenIndex = ownedTokens[_from].length.sub(1);
    uint256 lastToken = ownedTokens[_from][lastTokenIndex];

    ownedTokens[_from][tokenIndex] = lastToken;
    ownedTokens[_from][lastTokenIndex] = 0;
    // 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

    ownedTokens[_from].length--;
    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);

    // Clear metadata (if any)
    if (bytes(tokenURIs[_tokenId]).length != 0) {
      delete tokenURIs[_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;
  }

}

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


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


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

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

  /**
   * @dev Allows the current owner to relinquish control of the contract.
   * @notice Renouncing to ownership will leave the contract without an owner.
   * It will not be possible to call the functions with the `onlyOwner`
   * modifier anymore.
   */
  function renounceOwnership() public onlyOwner {
    emit OwnershipRenounced(owner);
    owner = address(0);
  }

  /**
   * @dev Allows the current owner to transfer control of the contract to a newOwner.
   * @param _newOwner The address to transfer ownership to.
   */
  function transferOwnership(address _newOwner) public onlyOwner {
    _transferOwnership(_newOwner);
  }

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

/**
 * @title Roles
 * @author Francisco Giordano (@frangio)
 * @dev Library for managing addresses assigned to a Role.
 * See RBAC.sol for example usage.
 */
library Roles {
  struct Role {
    mapping (address => bool) bearer;
  }

  /**
   * @dev give an address access to this role
   */
  function add(Role storage role, address addr)
    internal
  {
    role.bearer[addr] = true;
  }

  /**
   * @dev remove an address' access to this role
   */
  function remove(Role storage role, address addr)
    internal
  {
    role.bearer[addr] = false;
  }

  /**
   * @dev check if an address has this role
   * // reverts
   */
  function check(Role storage role, address addr)
    view
    internal
  {
    require(has(role, addr));
  }

  /**
   * @dev check if an address has this role
   * @return bool
   */
  function has(Role storage role, address addr)
    view
    internal
    returns (bool)
  {
    return role.bearer[addr];
  }
}


/**
 * @title RBAC (Role-Based Access Control)
 * @author Matt Condon (@Shrugs)
 * @dev Stores and provides setters and getters for roles and addresses.
 * Supports unlimited numbers of roles and addresses.
 * See //contracts/mocks/RBACMock.sol for an example of usage.
 * This RBAC method uses strings to key roles. It may be beneficial
 * for you to write your own implementation of this interface using Enums or similar.
 * It's also recommended that you define constants in the contract, like ROLE_ADMIN below,
 * to avoid typos.
 */
contract RBAC {
  using Roles for Roles.Role;

  mapping (string => Roles.Role) private roles;

  event RoleAdded(address indexed operator, string role);
  event RoleRemoved(address indexed operator, string role);

  /**
   * @dev reverts if addr does not have role
   * @param _operator address
   * @param _role the name of the role
   * // reverts
   */
  function checkRole(address _operator, string _role)
    view
    public
  {
    roles[_role].check(_operator);
  }

  /**
   * @dev determine if addr has role
   * @param _operator address
   * @param _role the name of the role
   * @return bool
   */
  function hasRole(address _operator, string _role)
    view
    public
    returns (bool)
  {
    return roles[_role].has(_operator);
  }

  /**
   * @dev add a role to an address
   * @param _operator address
   * @param _role the name of the role
   */
  function addRole(address _operator, string _role)
    internal
  {
    roles[_role].add(_operator);
    emit RoleAdded(_operator, _role);
  }

  /**
   * @dev remove a role from an address
   * @param _operator address
   * @param _role the name of the role
   */
  function removeRole(address _operator, string _role)
    internal
  {
    roles[_role].remove(_operator);
    emit RoleRemoved(_operator, _role);
  }

  /**
   * @dev modifier to scope access to a single role (uses msg.sender as addr)
   * @param _role the name of the role
   * // reverts
   */
  modifier onlyRole(string _role)
  {
    checkRole(msg.sender, _role);
    _;
  }

  /**
   * @dev modifier to scope access to a set of roles (uses msg.sender as addr)
   * @param _roles the names of the roles to scope access to
   * // reverts
   *
   * @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this
   *  see: https://github.com/ethereum/solidity/issues/2467
   */
  // modifier onlyRoles(string[] _roles) {
  //     bool hasAnyRole = false;
  //     for (uint8 i = 0; i < _roles.length; i++) {
  //         if (hasRole(msg.sender, _roles[i])) {
  //             hasAnyRole = true;
  //             break;
  //         }
  //     }

  //     require(hasAnyRole);

  //     _;
  // }
}

/**
 * @title Whitelist
 * @dev The Whitelist contract has a whitelist of addresses, and provides basic authorization control functions.
 * This simplifies the implementation of "user permissions".
 */
contract Whitelist is Ownable, RBAC {
  string public constant ROLE_WHITELISTED = "whitelist";

  /**
   * @dev Throws if operator is not whitelisted.
   * @param _operator address
   */
  modifier onlyIfWhitelisted(address _operator) {
    checkRole(_operator, ROLE_WHITELISTED);
    _;
  }

  /**
   * @dev add an address to the whitelist
   * @param _operator address
   * @return true if the address was added to the whitelist, false if the address was already in the whitelist
   */
  function addAddressToWhitelist(address _operator)
    onlyOwner
    public
  {
    addRole(_operator, ROLE_WHITELISTED);
  }

  /**
   * @dev getter to determine if address is in whitelist
   */
  function whitelist(address _operator)
    public
    view
    returns (bool)
  {
    return hasRole(_operator, ROLE_WHITELISTED);
  }

  /**
   * @dev add addresses to the whitelist
   * @param _operators addresses
   * @return true if at least one address was added to the whitelist,
   * false if all addresses were already in the whitelist
   */
  function addAddressesToWhitelist(address[] _operators)
    onlyOwner
    public
  {
    for (uint256 i = 0; i < _operators.length; i++) {
      addAddressToWhitelist(_operators[i]);
    }
  }

  /**
   * @dev remove an address from the whitelist
   * @param _operator address
   * @return true if the address was removed from the whitelist,
   * false if the address wasn't in the whitelist in the first place
   */
  function removeAddressFromWhitelist(address _operator)
    onlyOwner
    public
  {
    removeRole(_operator, ROLE_WHITELISTED);
  }

  /**
   * @dev remove addresses from the whitelist
   * @param _operators addresses
   * @return true if at least one address was removed from the whitelist,
   * false if all addresses weren't in the whitelist in the first place
   */
  function removeAddressesFromWhitelist(address[] _operators)
    onlyOwner
    public
  {
    for (uint256 i = 0; i < _operators.length; i++) {
      removeAddressFromWhitelist(_operators[i]);
    }
  }

}

contract CrabData {
  modifier crabDataLength(uint256[] memory _crabData) {
    require(_crabData.length == 8);
    _;
  }

  struct CrabPartData {
    uint256 hp;
    uint256 dps;
    uint256 blockRate;
    uint256 resistanceBonus;
    uint256 hpBonus;
    uint256 dpsBonus;
    uint256 blockBonus;
    uint256 mutiplierBonus;
  }

  function arrayToCrabPartData(
    uint256[] _partData
  ) 
    internal 
    pure 
    crabDataLength(_partData) 
    returns (CrabPartData memory _parsedData) 
  {
    _parsedData = CrabPartData(
      _partData[0],   // hp
      _partData[1],   // dps
      _partData[2],   // block rate
      _partData[3],   // resistance bonus
      _partData[4],   // hp bonus
      _partData[5],   // dps bonus
      _partData[6],   // block bonus
      _partData[7]);  // multiplier bonus
  }

  function crabPartDataToArray(CrabPartData _crabPartData) internal pure returns (uint256[] memory _resultData) {
    _resultData = new uint256[](8);
    _resultData[0] = _crabPartData.hp;
    _resultData[1] = _crabPartData.dps;
    _resultData[2] = _crabPartData.blockRate;
    _resultData[3] = _crabPartData.resistanceBonus;
    _resultData[4] = _crabPartData.hpBonus;
    _resultData[5] = _crabPartData.dpsBonus;
    _resultData[6] = _crabPartData.blockBonus;
    _resultData[7] = _crabPartData.mutiplierBonus;
  }
}


contract GeneSurgeon {
  //0 - filler, 1 - body, 2 - leg, 3 - left claw, 4 - right claw
  uint256[] internal crabPartMultiplier = [0, 10**9, 10**6, 10**3, 1];

  function extractElementsFromGene(uint256 _gene) internal view returns (uint256[] memory _elements) {
    _elements = new uint256[](4);
    _elements[0] = _gene / crabPartMultiplier[1] / 100 % 10;
    _elements[1] = _gene / crabPartMultiplier[2] / 100 % 10;
    _elements[2] = _gene / crabPartMultiplier[3] / 100 % 10;
    _elements[3] = _gene / crabPartMultiplier[4] / 100 % 10;
  }

  function extractPartsFromGene(uint256 _gene) internal view returns (uint256[] memory _parts) {
    _parts = new uint256[](4);
    _parts[0] = _gene / crabPartMultiplier[1] % 100;
    _parts[1] = _gene / crabPartMultiplier[2] % 100;
    _parts[2] = _gene / crabPartMultiplier[3] % 100;
    _parts[3] = _gene / crabPartMultiplier[4] % 100;
  }
}

contract CryptantCrabNFT is ERC721Token, Whitelist, CrabData, GeneSurgeon {
  event CrabPartAdded(uint256 hp, uint256 dps, uint256 blockAmount);
  event GiftTransfered(address indexed _from, address indexed _to, uint256 indexed _tokenId);
  event DefaultMetadataURIChanged(string newUri);

  /**
   * @dev Pre-generated keys to save gas
   * keys are generated with:
   * CRAB_BODY       = bytes4(keccak256("crab_body"))       = 0xc398430e
   * CRAB_LEG        = bytes4(keccak256("crab_leg"))        = 0x889063b1
   * CRAB_LEFT_CLAW  = bytes4(keccak256("crab_left_claw"))  = 0xdb6290a2
   * CRAB_RIGHT_CLAW = bytes4(keccak256("crab_right_claw")) = 0x13453f89
   */
  bytes4 internal constant CRAB_BODY = 0xc398430e;
  bytes4 internal constant CRAB_LEG = 0x889063b1;
  bytes4 internal constant CRAB_LEFT_CLAW = 0xdb6290a2;
  bytes4 internal constant CRAB_RIGHT_CLAW = 0x13453f89;

  /**
   * @dev Stores all the crab data
   */
  mapping(bytes4 => mapping(uint256 => CrabPartData[])) internal crabPartData;

  /**
   * @dev Mapping from tokenId to its corresponding special skin
   * tokenId with default skin will not be stored. 
   */
  mapping(uint256 => uint256) internal crabSpecialSkins;

  /**
   * @dev default MetadataURI
   */
  string public defaultMetadataURI = "https://www.cryptantcrab.io/md/";

  constructor(string _name, string _symbol) public ERC721Token(_name, _symbol) {
    // constructor
    initiateCrabPartData();
  }

  /**
   * @dev Returns an URI for a given token ID
   * Throws if the token ID does not exist.
   * Will return the token's metadata URL if it has one, 
   * otherwise will just return base on the default metadata URI
   * @param _tokenId uint256 ID of the token to query
   */
  function tokenURI(uint256 _tokenId) public view returns (string) {
    require(exists(_tokenId));

    string memory _uri = tokenURIs[_tokenId];

    if(bytes(_uri).length == 0) {
      _uri = getMetadataURL(bytes(defaultMetadataURI), _tokenId);
    }

    return _uri;
  }

  /**
   * @dev Returns the data of a specific parts
   * @param _partIndex the part to retrieve. 1 = Body, 2 = Legs, 3 = Left Claw, 4 = Right Claw
   * @param _element the element of part to retrieve. 1 = Fire, 2 = Earth, 3 = Metal, 4 = Spirit, 5 = Water
   * @param _setIndex the set index of for the specified part. This will starts from 1.
   */
  function dataOfPart(uint256 _partIndex, uint256 _element, uint256 _setIndex) public view returns (uint256[] memory _resultData) {
    bytes4 _key;
    if(_partIndex == 1) {
      _key = CRAB_BODY;
    } else if(_partIndex == 2) {
      _key = CRAB_LEG;
    } else if(_partIndex == 3) {
      _key = CRAB_LEFT_CLAW;
    } else if(_partIndex == 4) {
      _key = CRAB_RIGHT_CLAW;
    } else {
      revert();
    }

    CrabPartData storage _crabPartData = crabPartData[_key][_element][_setIndex];

    _resultData = crabPartDataToArray(_crabPartData);
  }

  /**
   * @dev Gift(Transfer) a token to another address. Caller must be token owner
   * @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 giftToken(address _from, address _to, uint256 _tokenId) external {
    safeTransferFrom(_from, _to, _tokenId);

    emit GiftTransfered(_from, _to, _tokenId);
  }

  /**
   * @dev External function to mint a new token, for whitelisted address only.
   * Reverts if the given token ID already exists
   * @param _tokenOwner address the beneficiary that will own the minted token
   * @param _tokenId uint256 ID of the token to be minted by the msg.sender
   * @param _skinId the skin ID to be applied for all the token minted
   */
  function mintToken(address _tokenOwner, uint256 _tokenId, uint256 _skinId) external onlyIfWhitelisted(msg.sender) {
    super._mint(_tokenOwner, _tokenId);

    if(_skinId > 0) {
      crabSpecialSkins[_tokenId] = _skinId;
    }
  }

  /**
   * @dev Returns crab data base on the gene provided
   * @param _gene the gene info where crab data will be retrieved base on it
   * @return 4 uint arrays:
   * 1st Array = Body's Data
   * 2nd Array = Leg's Data
   * 3rd Array = Left Claw's Data
   * 4th Array = Right Claw's Data
   */
  function crabPartDataFromGene(uint256 _gene) external view returns (
    uint256[] _bodyData,
    uint256[] _legData,
    uint256[] _leftClawData,
    uint256[] _rightClawData
  ) {
    uint256[] memory _parts = extractPartsFromGene(_gene);
    uint256[] memory _elements = extractElementsFromGene(_gene);

    _bodyData = dataOfPart(1, _elements[0], _parts[0]);
    _legData = dataOfPart(2, _elements[1], _parts[1]);
    _leftClawData = dataOfPart(3, _elements[2], _parts[2]);
    _rightClawData = dataOfPart(4, _elements[3], _parts[3]);
  }

  /**
   * @dev For developer to add new parts, notice that this is the only method to add crab data
   * so that developer can add extra content. there's no other method for developer to modify
   * the data. This is to assure token owner actually owns their data.
   * @param _partIndex the part to add. 1 = Body, 2 = Legs, 3 = Left Claw, 4 = Right Claw
   * @param _element the element of part to add. 1 = Fire, 2 = Earth, 3 = Metal, 4 = Spirit, 5 = Water
   * @param _partDataArray data of the parts.
   */
  function setPartData(uint256 _partIndex, uint256 _element, uint256[] _partDataArray) external onlyOwner {
    CrabPartData memory _partData = arrayToCrabPartData(_partDataArray);

    bytes4 _key;
    if(_partIndex == 1) {
      _key = CRAB_BODY;
    } else if(_partIndex == 2) {
      _key = CRAB_LEG;
    } else if(_partIndex == 3) {
      _key = CRAB_LEFT_CLAW;
    } else if(_partIndex == 4) {
      _key = CRAB_RIGHT_CLAW;
    }

    // if index 1 is empty will fill at index 1
    if(crabPartData[_key][_element][1].hp == 0 && crabPartData[_key][_element][1].dps == 0) {
      crabPartData[_key][_element][1] = _partData;
    } else {
      crabPartData[_key][_element].push(_partData);
    }

    emit CrabPartAdded(_partDataArray[0], _partDataArray[1], _partDataArray[2]);
  }

  /**
   * @dev Updates the default metadata URI
   * @param _defaultUri the new metadata URI
   */
  function setDefaultMetadataURI(string _defaultUri) external onlyOwner {
    defaultMetadataURI = _defaultUri;

    emit DefaultMetadataURIChanged(_defaultUri);
  }

  /**
   * @dev Updates the metadata URI for existing token
   * @param _tokenId the tokenID that metadata URI to be changed
   * @param _uri the new metadata URI for the specified token
   */
  function setTokenURI(uint256 _tokenId, string _uri) external onlyIfWhitelisted(msg.sender) {
    _setTokenURI(_tokenId, _uri);
  }

  /**
   * @dev Returns the special skin of the provided tokenId
   * @param _tokenId cryptant crab's tokenId
   * @return Special skin belongs to the _tokenId provided. 
   * 0 will be returned if no special skin found.
   */
  function specialSkinOfTokenId(uint256 _tokenId) external view returns (uint256) {
    return crabSpecialSkins[_tokenId];
  }

  /**
   * @dev This functions will adjust the length of crabPartData
   * so that when adding data the index can start with 1.
   * Reason of doing this is because gene cannot have parts with index 0.
   */
  function initiateCrabPartData() internal {
    require(crabPartData[CRAB_BODY][1].length == 0);

    for(uint256 i = 1 ; i <= 5 ; i++) {
      crabPartData[CRAB_BODY][i].length = 2;
      crabPartData[CRAB_LEG][i].length = 2;
      crabPartData[CRAB_LEFT_CLAW][i].length = 2;
      crabPartData[CRAB_RIGHT_CLAW][i].length = 2;
    }
  }

  /**
   * @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, 
   *  or has been whitelisted by contract owner
   */
  function isApprovedOrOwner(address _spender, uint256 _tokenId) internal view returns (bool) {
    address owner = ownerOf(_tokenId);
    return _spender == owner || getApproved(_tokenId) == _spender || isApprovedForAll(owner, _spender) || whitelist(_spender);
  }

  /**
   * @dev Will merge the uri and tokenId together. 
   * @param _uri URI to be merge. This will be the first part of the result URL.
   * @param _tokenId tokenID to be merge. This will be the last part of the result URL.
   * @return the merged urL
   */
  function getMetadataURL(bytes _uri, uint256 _tokenId) internal pure returns (string) {
    uint256 _tmpTokenId = _tokenId;
    uint256 _tokenLength;

    // Getting the length(number of digits) of token ID
    do {
      _tokenLength++;
      _tmpTokenId /= 10;
    } while (_tmpTokenId > 0);

    // creating a byte array with the length of URL + token digits
    bytes memory _result = new bytes(_uri.length + _tokenLength);

    // cloning the uri bytes into the result bytes
    for(uint256 i = 0 ; i < _uri.length ; i ++) {
      _result[i] = _uri[i];
    }

    // appending the tokenId to the end of the result bytes
    uint256 lastIndex = _result.length - 1;
    for(_tmpTokenId = _tokenId ; _tmpTokenId > 0 ; _tmpTokenId /= 10) {
      _result[lastIndex--] = byte(48 + _tmpTokenId % 10);
    }

    return string(_result);
  }
}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[{"name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","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":"_operator","type":"address"},{"name":"_role","type":"string"}],"name":"checkRole","outputs":[],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_uri","type":"string"}],"name":"setTokenURI","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ROLE_WHITELISTED","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_partIndex","type":"uint256"},{"name":"_element","type":"uint256"},{"name":"_partDataArray","type":"uint256[]"}],"name":"setPartData","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_operator","type":"address"},{"name":"_role","type":"string"}],"name":"hasRole","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenOwner","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"_skinId","type":"uint256"}],"name":"mintToken","outputs":[],"payable":false,"stateMutability":"nonpayable","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":"_operators","type":"address[]"}],"name":"removeAddressesFromWhitelist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"}],"name":"removeAddressFromWhitelist","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":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"exists","outputs":[{"name":"","type":"bool"}],"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":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"name":"","type":"address"}],"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":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_partIndex","type":"uint256"},{"name":"_element","type":"uint256"},{"name":"_setIndex","type":"uint256"}],"name":"dataOfPart","outputs":[{"name":"_resultData","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_gene","type":"uint256"}],"name":"crabPartDataFromGene","outputs":[{"name":"_bodyData","type":"uint256[]"},{"name":"_legData","type":"uint256[]"},{"name":"_leftClawData","type":"uint256[]"},{"name":"_rightClawData","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"defaultMetadataURI","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator","type":"address"}],"name":"addAddressToWhitelist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_defaultUri","type":"string"}],"name":"setDefaultMetadataURI","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":"_operator","type":"address"}],"name":"whitelist","outputs":[{"name":"","type":"bool"}],"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":"_tokenId","type":"uint256"}],"name":"specialSkinOfTokenId","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":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operators","type":"address[]"}],"name":"addAddressesToWhitelist","outputs":[],"payable":false,"stateMutability":"nonpayable","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":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"giftToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_name","type":"string"},{"name":"_symbol","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"hp","type":"uint256"},{"indexed":false,"name":"dps","type":"uint256"},{"indexed":false,"name":"blockAmount","type":"uint256"}],"name":"CrabPartAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":true,"name":"_tokenId","type":"uint256"}],"name":"GiftTransfered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newUri","type":"string"}],"name":"DefaultMetadataURIChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"operator","type":"address"},{"indexed":false,"name":"role","type":"string"}],"name":"RoleAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"operator","type":"address"},{"indexed":false,"name":"role","type":"string"}],"name":"RoleRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"}],"name":"OwnershipRenounced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"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"}]

61012060405260006080908152633b9aca0060a052620f424060c0526103e860e0526001610100526200003790600e906005620003bf565b5060408051808201909152601f8082527f68747470733a2f2f7777772e6372797074616e74637261622e696f2f6d642f0060209092019182526200007e9160119162000417565b503480156200008c57600080fd5b506040516200310638038062003106833981016040528051602082015190820191018181620000e47f01ffc9a7000000000000000000000000000000000000000000000000000000006401000000006200020f810204565b620001187f80ac58cd000000000000000000000000000000000000000000000000000000006401000000006200020f810204565b6200014c7f4f558e79000000000000000000000000000000000000000000000000000000006401000000006200020f810204565b81516200016190600590602085019062000417565b5080516200017790600690602084019062000417565b50620001ac7f780e9d63000000000000000000000000000000000000000000000000000000006401000000006200020f810204565b620001e07f5b5e139f000000000000000000000000000000000000000000000000000000006401000000006200020f810204565b5050600c8054600160a060020a03191633179055620002076401000000006200027c810204565b50506200052b565b7fffffffff0000000000000000000000000000000000000000000000000000000080821614156200023f57600080fd5b7fffffffff00000000000000000000000000000000000000000000000000000000166000908152602081905260409020805460ff19166001179055565b60016000908152600080516020620030e68339815191526020527f2d38f25dad672093005fa1a92550a8b0c45028cccb3182a45738c2570cf826355415620002c357600080fd5b5060015b60058111620003bc576000818152600080516020620030e683398151915260205260409020600290620002fb90826200048a565b5060008181527fefdc4ba70f0ae92f1a397637a4df230c401f0faae89157f66f5d859e0773df96602052604090206002906200033890826200048a565b5060008181527f96a4fa1e17a4398c04ff8cfeb6137c348385627376f450c0c18476431144cd83602052604090206002906200037590826200048a565b5060008181527f2dcd6c1bb03adbe99ba3a80eb0f014309c59837ae95120a500bcb05f15a1197660205260409020600290620003b290826200048a565b50600101620002c7565b50565b82805482825590600052602060002090810192821562000405579160200282015b8281111562000405578251829063ffffffff16905591602001919060010190620003e0565b5062000413929150620004be565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200045a57805160ff191683800117855562000405565b8280016001018555821562000405579182015b82811115620004055782518255916020019190600101906200046d565b815481835581811115620004b957600802816008028360005260206000209182019101620004b99190620004de565b505050565b620004db91905b80821115620004135760008155600101620004c5565b90565b620004db91905b80821115620004135760008082556001820181905560028201819055600382018190556004820181905560058201819055600682018190556007820155600801620004e5565b612bab806200053b6000396000f3006080604052600436106101d75763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166301ffc9a781146101dc57806306fdde0314610212578063081812fc1461029c578063095ea7b3146102d05780630988ca8c146102f6578063162094c41461035d57806318160ddd1461038157806318b919e9146103a857806319fa8f50146103bd5780631c63c6c3146103ef578063217fe6c61461041757806323a36d2b1461047e57806323b872dd146104a557806324953eaa146104cf578063286dd3f5146105245780632f745c591461054557806342842e0e146105695780634f558e79146105935780634f6ccce7146105ab5780636352211e146105c357806370a08231146105db578063715018a6146105fc5780637195d94414610611578063761b59ac1461067f5780637939748e146107ba5780637b9417c8146107cf5780638da5cb5b146107f0578063954808791461080557806395d89b41146108255780639b19251a1461083a578063a22cb4651461085b578063b5dfad1614610881578063b88d4fde14610899578063c87b56dd14610908578063e2ec6ec314610920578063e985e9c514610975578063f2fde38b1461099c578063f5fc3d47146109bd575b600080fd5b3480156101e857600080fd5b506101fe600160e060020a0319600435166109e7565b604080519115158252519081900360200190f35b34801561021e57600080fd5b50610227610a06565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610261578181015183820152602001610249565b50505050905090810190601f16801561028e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102a857600080fd5b506102b4600435610a9d565b60408051600160a060020a039092168252519081900360200190f35b3480156102dc57600080fd5b506102f4600160a060020a0360043516602435610ab8565b005b34801561030257600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526102f4958335600160a060020a0316953695604494919390910191908190840183828082843750949750610b6e9650505050505050565b34801561036957600080fd5b506102f4600480359060248035908101910135610bdc565b34801561038d57600080fd5b50610396610c4a565b60408051918252519081900360200190f35b3480156103b457600080fd5b50610227610c50565b3480156103c957600080fd5b506103d2610c75565b60408051600160e060020a03199092168252519081900360200190f35b3480156103fb57600080fd5b506102f460048035906024803591604435918201910135610c99565b34801561042357600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526101fe958335600160a060020a0316953695604494919390910191908190840183828082843750949750610ff09650505050505050565b34801561048a57600080fd5b506102f4600160a060020a0360043516602435604435611063565b3480156104b157600080fd5b506102f4600160a060020a03600435811690602435166044356110b8565b3480156104db57600080fd5b50604080516020600480358082013583810280860185019096528085526102f49536959394602494938501929182918501908490808284375094975061115d9650505050505050565b34801561053057600080fd5b506102f4600160a060020a03600435166111ac565b34801561055157600080fd5b50610396600160a060020a03600435166024356111f3565b34801561057557600080fd5b506102f4600160a060020a0360043581169060243516604435611240565b34801561059f57600080fd5b506101fe600435611272565b3480156105b757600080fd5b5061039660043561128f565b3480156105cf57600080fd5b506102b46004356112c4565b3480156105e757600080fd5b50610396600160a060020a03600435166112ee565b34801561060857600080fd5b506102f4611321565b34801561061d57600080fd5b5061062f60043560243560443561138f565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561066b578181015183820152602001610653565b505050509050019250505060405180910390f35b34801561068b57600080fd5b50610697600435611504565b6040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b838110156106e35781810151838201526020016106cb565b50505050905001858103845288818151815260200191508051906020019060200280838360005b8381101561072257818101518382015260200161070a565b50505050905001858103835287818151815260200191508051906020019060200280838360005b83811015610761578181015183820152602001610749565b50505050905001858103825286818151815260200191508051906020019060200280838360005b838110156107a0578181015183820152602001610788565b505050509050019850505050505050505060405180910390f35b3480156107c657600080fd5b506102276115f7565b3480156107db57600080fd5b506102f4600160a060020a0360043516611685565b3480156107fc57600080fd5b506102b46116c9565b34801561081157600080fd5b506102f460048035602481019101356116d8565b34801561083157600080fd5b50610227611750565b34801561084657600080fd5b506101fe600160a060020a03600435166117b1565b34801561086757600080fd5b506102f4600160a060020a036004351660243515156117e0565b34801561088d57600080fd5b50610396600435611864565b3480156108a557600080fd5b50604080516020601f6064356004818101359283018490048402850184019095528184526102f494600160a060020a0381358116956024803590921695604435953695608494019181908401838280828437509497506118769650505050505050565b34801561091457600080fd5b506102276004356118b5565b34801561092c57600080fd5b50604080516020600480358082013583810280860185019096528085526102f495369593946024949385019291829185019084908082843750949750611a089650505050505050565b34801561098157600080fd5b506101fe600160a060020a0360043581169060243516611a57565b3480156109a857600080fd5b506102f4600160a060020a0360043516611a85565b3480156109c957600080fd5b506102f4600160a060020a0360043581169060243516604435611aa5565b600160e060020a03191660009081526020819052604090205460ff1690565b60058054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a925780601f10610a6757610100808354040283529160200191610a92565b820191906000526020600020905b815481529060010190602001808311610a7557829003601f168201915b505050505090505b90565b600090815260026020526040902054600160a060020a031690565b6000610ac3826112c4565b9050600160a060020a038381169082161415610ade57600080fd5b33600160a060020a0382161480610afa5750610afa8133611a57565b1515610b0557600080fd5b600082815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b610bd882600d836040518082805190602001908083835b60208310610ba45780518252601f199092019160209182019101610b85565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922092915050611af6565b5050565b33610c0a81604080519081016040528060098152602001600080516020612b60833981519152815250610b6e565b610c448484848080601f01602080910402602001604051908101604052809392919081815260200183838082843750611b0b945050505050565b50505050565b60095490565b6040805180820190915260098152600080516020612b60833981519152602082015281565b7f01ffc9a70000000000000000000000000000000000000000000000000000000081565b610ca16129f3565b600c54600090600160a060020a03163314610cbb57600080fd5b610cf184848080602002602001604051908101604052809392919081815260200183836020028082843750611b43945050505050565b91508560011415610d2357507fc398430e00000000000000000000000000000000000000000000000000000000610daf565b8560021415610d5357507f889063b100000000000000000000000000000000000000000000000000000000610daf565b8560031415610d8357507fdb6290a200000000000000000000000000000000000000000000000000000000610daf565b8560041415610daf57507f13453f89000000000000000000000000000000000000000000000000000000005b600160e060020a031981166000908152600f60209081526040808320888452909152902080546001908110610de057fe5b9060005260206000209060080201600001546000148015610e435750600160e060020a031981166000908152600f60209081526040808320888452909152902080546001908110610e2d57fe5b9060005260206000209060080201600101546000145b15610ee257600160e060020a031981166000908152600f60209081526040808320888452909152902080548391906001908110610e7c57fe5b9060005260206000209060080201600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e08201518160070155905050610f68565b600160e060020a031981166000908152600f60209081526040808320888452825280832080546001818101835591855293839020865160089095020193845591850151918301919091558301516002820155606083015160038201556080830151600482015560a0830151600582015560c0830151600682015560e08301516007909101555b7fed9950c79158ffe3c0b665a85f412eb27c20e971fa5a914310dfd6b1dee94a8384846000818110610f9657fe5b90506020020135858560018181101515610fac57fe5b90506020020135868660028181101515610fc257fe5b60408051958652602086810195909552930291909101358383015250519081900360600190a1505050505050565b600061105c83600d846040518082805190602001908083835b602083106110285780518252601f199092019160209182019101611009565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922092915050611c5c565b9392505050565b3361109181604080519081016040528060098152602001600080516020612b60833981519152815250610b6e565b61109b8484611c7b565b6000821115610c4457506000918252601060205260409091205550565b806110c33382611cca565b15156110ce57600080fd5b600160a060020a03841615156110e357600080fd5b600160a060020a03831615156110f857600080fd5b6111028483611d38565b61110c8483611da7565b6111168383611ee0565b8183600160a060020a031685600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a450505050565b600c54600090600160a060020a0316331461117757600080fd5b5060005b8151811015610bd8576111a4828281518110151561119557fe5b906020019060200201516111ac565b60010161117b565b600c54600160a060020a031633146111c357600080fd5b6111f081604080519081016040528060098152602001600080516020612b60833981519152815250611f29565b50565b60006111fe836112ee565b821061120957600080fd5b600160a060020a038316600090815260076020526040902080548390811061122d57fe5b9060005260206000200154905092915050565b8061124b3382611cca565b151561125657600080fd5b610c448484846020604051908101604052806000815250611876565b600090815260016020526040902054600160a060020a0316151590565b6000611299610c4a565b82106112a457600080fd5b60098054839081106112b257fe5b90600052602060002001549050919050565b600081815260016020526040812054600160a060020a03168015156112e857600080fd5b92915050565b6000600160a060020a038216151561130557600080fd5b50600160a060020a031660009081526003602052604090205490565b600c54600160a060020a0316331461133857600080fd5b600c54604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a2600c805473ffffffffffffffffffffffffffffffffffffffff19169055565b606060008085600114156113c5577fc398430e000000000000000000000000000000000000000000000000000000009150611454565b85600214156113f6577f889063b1000000000000000000000000000000000000000000000000000000009150611454565b8560031415611427577fdb6290a2000000000000000000000000000000000000000000000000000000009150611454565b85600414156101d7577f13453f890000000000000000000000000000000000000000000000000000000091505b600160e060020a031982166000908152600f60209081526040808320888452909152902080548590811061148457fe5b906000526020600020906008020190506114fa8161010060405190810160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820154815260200160078201548152505061203a565b9695505050505050565b60608060608060608061151687612156565b91506115218761229e565b905061155f600182600081518110151561153757fe5b9060200190602002015184600081518110151561155057fe5b9060200190602002015161138f565b955061158e600282600181518110151561157557fe5b9060200190602002015184600181518110151561155057fe5b94506115bd60038260028151811015156115a457fe5b9060200190602002015184600281518110151561155057fe5b93506115ec60048260038151811015156115d357fe5b9060200190602002015184600381518110151561155057fe5b925050509193509193565b6011805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561167d5780601f106116525761010080835404028352916020019161167d565b820191906000526020600020905b81548152906001019060200180831161166057829003601f168201915b505050505081565b600c54600160a060020a0316331461169c57600080fd5b6111f081604080519081016040528060098152602001600080516020612b608339815191528152506123fc565b600c54600160a060020a031681565b600c54600160a060020a031633146116ef57600080fd5b6116fb60118383612a39565b507f1fdac1904931a18a5d52e0a2f2c12e0533c25aa2bd3c0c09088f407e86e9130682826040518080602001828103825284848281815260200192508082843760405192018290039550909350505050a15050565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a925780601f10610a6757610100808354040283529160200191610a92565b60006112e882604080519081016040528060098152602001600080516020612b60833981519152815250610ff0565b600160a060020a0382163314156117f657600080fd5b336000818152600460209081526040808320600160a060020a03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b60009081526010602052604090205490565b816118813382611cca565b151561188c57600080fd5b6118978585856110b8565b6118a3858585856124ce565b15156118ae57600080fd5b5050505050565b6060806118c183611272565b15156118cc57600080fd5b6000838152600b602090815260409182902080548351601f60026000196101006001861615020190931692909204918201849004840281018401909452808452909183018282801561195f5780601f106119345761010080835404028352916020019161195f565b820191906000526020600020905b81548152906001019060200180831161194257829003601f168201915b505050505090508051600014156112e85760118054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815261105c93909290918301828280156119fd5780601f106119d2576101008083540402835291602001916119fd565b820191906000526020600020905b8154815290600101906020018083116119e057829003601f168201915b50505050508461263b565b600c54600090600160a060020a03163314611a2257600080fd5b5060005b8151811015610bd857611a4f8282815181101515611a4057fe5b90602001906020020151611685565b600101611a26565b600160a060020a03918216600090815260046020908152604080832093909416825291909152205460ff1690565b600c54600160a060020a03163314611a9c57600080fd5b6111f081612786565b611ab0838383611240565b8082600160a060020a031684600160a060020a03167faebbb4ee1fc853915b9cedb29924255ea7bd0dcbea2122e66f15e5f6773ca44560405160405180910390a4505050565b611b008282611c5c565b1515610bd857600080fd5b611b1482611272565b1515611b1f57600080fd5b6000828152600b602090815260409091208251611b3e92840190612ab7565b505050565b611b4b6129f3565b81518290600814611b5b57600080fd5b61010060405190810160405280846000815181101515611b7757fe5b906020019060200201518152602001846001815181101515611b9557fe5b906020019060200201518152602001846002815181101515611bb357fe5b906020019060200201518152602001846003815181101515611bd157fe5b906020019060200201518152602001846004815181101515611bef57fe5b906020019060200201518152602001846005815181101515611c0d57fe5b906020019060200201518152602001846006815181101515611c2b57fe5b906020019060200201518152602001846007815181101515611c4957fe5b6020908102909101015190529392505050565b600160a060020a03166000908152602091909152604090205460ff1690565b611c858282612804565b600980546000838152600a60205260408120829055600182018355919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af015550565b600080611cd6836112c4565b905080600160a060020a031684600160a060020a03161480611d11575083600160a060020a0316611d0684610a9d565b600160a060020a0316145b80611d215750611d218185611a57565b80611d305750611d30846117b1565b949350505050565b81600160a060020a0316611d4b826112c4565b600160a060020a031614611d5e57600080fd5b600081815260026020526040902054600160a060020a031615610bd8576000908152600260205260409020805473ffffffffffffffffffffffffffffffffffffffff1916905550565b6000806000611db6858561285f565b600084815260086020908152604080832054600160a060020a0389168452600790925290912054909350611df190600163ffffffff6128f516565b600160a060020a038616600090815260076020526040902080549193509083908110611e1957fe5b90600052602060002001549050806007600087600160a060020a0316600160a060020a0316815260200190815260200160002084815481101515611e5957fe5b6000918252602080832090910192909255600160a060020a0387168152600790915260408120805484908110611e8b57fe5b6000918252602080832090910192909255600160a060020a0387168152600790915260409020805490611ec2906000198301612b25565b50600093845260086020526040808520859055908452909220555050565b6000611eec8383612907565b50600160a060020a039091166000908152600760209081526040808320805460018101825590845282842081018590559383526008909152902055565b611f9382600d836040518082805190602001908083835b60208310611f5f5780518252601f199092019160209182019101611f40565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922092915050612997565b81600160a060020a03167fd211483f91fc6eff862467f8de606587a30c8fc9981056f051b897a418df803a826040518080602001828103825283818151815260200191508051906020019080838360005b83811015611ffc578181015183820152602001611fe4565b50505050905090810190601f1680156120295780820380516001836020036101000a031916815260200191505b509250505060405180910390a25050565b6040805160088082526101208201909252606091602082016101008038833950508351825192935091839150600090811061207157fe5b9060200190602002018181525050816020015181600181518110151561209357fe5b6020908102909101015260408201518151829060029081106120b157fe5b6020908102909101015260608201518151829060039081106120cf57fe5b6020908102909101015260808201518151829060049081106120ed57fe5b6020908102909101015260a082015181518290600590811061210b57fe5b6020908102909101015260c082015181518290600690811061212957fe5b6020908102909101015260e082015181518290600790811061214757fe5b60209081029091010152919050565b60408051600480825260a08201909252606091602082016080803883390190505090506064600e600181548110151561218b57fe5b9060005260206000200154838115156121a057fe5b048115156121aa57fe5b068160008151811015156121ba57fe5b60209081029091010152600e80546064919060029081106121d757fe5b9060005260206000200154838115156121ec57fe5b048115156121f657fe5b0681600181518110151561220657fe5b60209081029091010152600e805460649190600390811061222357fe5b90600052602060002001548381151561223857fe5b0481151561224257fe5b0681600281518110151561225257fe5b60209081029091010152600e805460649190600490811061226f57fe5b90600052602060002001548381151561228457fe5b0481151561228e57fe5b0681600381518110151561214757fe5b60408051600480825260a0820190925260609160208201608080388339019050509050600a6064600e60018154811015156122d557fe5b9060005260206000200154848115156122ea57fe5b048115156122f457fe5b048115156122fe57fe5b0681600081518110151561230e57fe5b60209081029091010152600e8054600a91606491600290811061232d57fe5b90600052602060002001548481151561234257fe5b0481151561234c57fe5b0481151561235657fe5b0681600181518110151561236657fe5b60209081029091010152600e8054600a91606491600390811061238557fe5b90600052602060002001548481151561239a57fe5b048115156123a457fe5b048115156123ae57fe5b068160028151811015156123be57fe5b60209081029091010152600e8054600a9160649160049081106123dd57fe5b9060005260206000200154848115156123f257fe5b0481151561228457fe5b61246682600d836040518082805190602001908083835b602083106124325780518252601f199092019160209182019101612413565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220929150506129b9565b81600160a060020a03167fbfec83d64eaa953f2708271a023ab9ee82057f8f3578d548c1a4ba0b5b7004898260405180806020018281038252838181518152602001915080519060200190808383600083811015611ffc578181015183820152602001611fe4565b6000806124e385600160a060020a03166129de565b15156124f25760019150612632565b6040517f150b7a020000000000000000000000000000000000000000000000000000000081523360048201818152600160a060020a03898116602485015260448401889052608060648501908152875160848601528751918a169463150b7a0294938c938b938b93909160a490910190602085019080838360005b8381101561258557818101518382015260200161256d565b50505050905090810190601f1680156125b25780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b1580156125d457600080fd5b505af11580156125e8573d6000803e3d6000fd5b505050506040513d60208110156125fe57600080fd5b5051600160e060020a031981167f150b7a020000000000000000000000000000000000000000000000000000000014925090505b50949350505050565b60608160008281805b600190930192600a85049450600085111561265e57612644565b838851016040519080825280601f01601f19166020018201604052801561268f578160200160208202803883390190505b509250600091505b875182101561270a5787828151811015156126ae57fe5b90602001015160f860020a900460f860020a0283838151811015156126cf57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600190910190612697565b508151869450600019015b600085111561277a57825160001982019160f860020a6030600a8906010291859190811061273f57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a85049450612715565b50909695505050505050565b600160a060020a038116151561279b57600080fd5b600c54604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600c805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a038216151561281957600080fd5b6128238282611ee0565b6040518190600160a060020a038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b81600160a060020a0316612872826112c4565b600160a060020a03161461288557600080fd5b600160a060020a0382166000908152600360205260409020546128af90600163ffffffff6128f516565b600160a060020a03909216600090815260036020908152604080832094909455918152600190915220805473ffffffffffffffffffffffffffffffffffffffff19169055565b60008282111561290157fe5b50900390565b600081815260016020526040902054600160a060020a03161561292957600080fd5b6000818152600160208181526040808420805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0388169081179091558452600390915290912054612977916129e6565b600160a060020a0390921660009081526003602052604090209190915550565b600160a060020a0316600090815260209190915260409020805460ff19169055565b600160a060020a0316600090815260209190915260409020805460ff19166001179055565b6000903b1190565b818101828110156112e857fe5b6101006040519081016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612a7a5782800160ff19823516178555612aa7565b82800160010185558215612aa7579182015b82811115612aa7578235825591602001919060010190612a8c565b50612ab3929150612b45565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612af857805160ff1916838001178555612aa7565b82800160010185558215612aa7579182015b82811115612aa7578251825591602001919060010190612b0a565b815481835581811115611b3e57600083815260209020611b3e9181019083015b610a9a91905b80821115612ab35760008155600101612b4b560077686974656c6973740000000000000000000000000000000000000000000000a165627a7a72305820917211784d735b8f5264b3e1acdec385367f2276bcb4905e717f8c8268cd85e60029acaad30a60136f9a134199b40a8b167b54db64466e488b6aad6c4783c2173b2800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000d4372797074616e7420437261620000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024343000000000000000000000000000000000000000000000000000000000000

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

00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000d4372797074616e7420437261620000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024343000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _name (string): Cryptant Crab
Arg [1] : _symbol (string): CC

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [2] : 000000000000000000000000000000000000000000000000000000000000000d
Arg [3] : 4372797074616e74204372616200000000000000000000000000000000000000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [5] : 4343000000000000000000000000000000000000000000000000000000000000


Swarm Source

bzzr://917211784d735b8f5264b3e1acdec385367f2276bcb4905e717f8c8268cd85e6
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.