Contract 0x01ed068115ba99b94c65c7791d4ac5dee1253835

 

TxHash Block Age From To Value [TxFee]
0xe4c256f728cebc99963e4a726a74a53801a4eaa1050a960c570bf4f19266554373941391 day 5 hrs ago0x914752ab614840b7c4052b91d247158992b4bb6d IN  FOAM_TreasureHunt0 Ether0.000072322
0x40ad389810ef335b5861f26bae3d0120375dc71af2ef76fa92299bf913aa2de3725749624 days 8 hrs ago0x51c416e89c083859562322a0412a3e130c69641b IN  FOAM_TreasureHunt0 Ether0.000365472
0xed2896e1e668bfe532b47740f672dec70dda5d1d374ad88ba4e60e5fd69946f9722032333 days 4 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.000768955
0x5901c5b4347b17a72416c658ea32be2833e517912ea1b29371e6199df2cb9a91722031833 days 4 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.000768955
0x9979e7b19c0929ac86a1baf4cf2ee1ef82165f39614aac00e4c39de52277433d722031633 days 4 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.000768955
0x5b9b245ca23219a3b2eeab14d3b3b30b309b5400da63a2627d998838c70ade21722030933 days 4 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.000768955
0x4d89446e000ab783261ccf0919bbdcd34d60967d4902ffccf645da3a02e8acfa722030233 days 4 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.000768955
0xd9c3e1db19713fd18d2db1bb26ada92c1dfe4d0263da3a485cfd686f6fabfd45722029933 days 4 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.000768955
0xce30aa046be9b6d2a82ab18c06ff1849e37c0e7be93346c25d70eea1cf09893e722028733 days 4 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.000768955
0x471d03de8339878d12ae82db8660c50f075f7965c4d441d06ab9ecdddd988657721517434 days 9 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.000768955
0xe8149fe2500ee4c723548395eb1aeaa9e231eacdc366a61d8d1915c4784ac007721516934 days 9 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.000768955
0xfbf9bed369ce6e8fc89b54f16d6fc79f4dcad153b3e31522e68b294220e3a0eb721516234 days 9 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.000768955
0xa0cc74ca0dc0d4e76da474ff505ba38dd27235b1d698b5d59d17b7ac95d3c9fd721515634 days 9 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.000768955
0x2d16d62dbf164c6e1884bd56af8d5fbb09098fe2ee2abeb4ac7dbc818c7454a4721515234 days 9 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.000768955
0xbc631331e0a84aaca5fb7f645a11f04b58f3f5e4aa8032b4de0832711b0a5498721514234 days 9 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.000768955
0x6d82649db9a3878f835bc588d7f9d2fd3f0faba0dd65e3d588f266303a9717d5721513734 days 9 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.000768955
0xfd783e4fa1df4fc6ea8ae8810c44a1be4b71984890c82ace3627bb9e7ae92f9e721513034 days 10 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.000768955
0x3021f3af91340b8fdadf60d7296628eb75ba42686a96b519ca7e86f19973a80c721314134 days 21 hrs ago0xaf7f0deccfcc5a9f800e8390dbd6b4e170f0275d IN  FOAM_TreasureHunt0 Ether0.000102322
0xd2d6293fdb3aa27f65ac4a135b77a20cc543df313a4dd8f313bfc4769f19af3d721209435 days 3 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.0008150923
0x007d53a7590934894bee9b10d0dc764b2fa7687b33f26af57b674278f0f42402721208735 days 3 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.0007355923
0x1b576a4c40506c99fb14b3a5a6f8f3d57a71049426d8cda73832869fc2c1886b721208335 days 3 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.000768955
0x4f01132ae9917a7dd238aa91877ade019b0e9118fae93c7ba4f26afc7ae35856721207335 days 3 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.0008147531
0xeb58ce712a06b33a29d3597d2c5406700360f7e1f96337ea309842067858fbcf721206935 days 3 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.0008150923
0x1c53605aff4d9a21424ea0b375e6e6ece5a9a4179a15253ec86952748bd54a94721206635 days 3 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.0008150923
0xff90ff3988ef6b99074f32f061557f826688abe41b834543473a66358355e61b721206435 days 3 hrs ago0xc73495fbadd6416b1285b04d82a9d756a0b0198c IN  FOAM_TreasureHunt0 Ether0.0008150923
[ Download CSV Export 

Internal Transactions as a result of Contract Execution

Parent TxHash Block Age From To Value
Warning: The compiled contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) Solidity Compiler Bugs.

Contract Source Code Verified (Exact Match)

Contract Name:
TreasureHunt

Compiler Version
v0.4.24+commit.e67f0147

Optimization Enabled:
Yes

Runs (Optimizer):
200

Contract Source Code

pragma solidity ^0.4.24;

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

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


/**
 * @title Roles
 * @dev Library for managing addresses assigned to a Role.
 */
library Roles {
  struct Role {
    mapping (address => bool) bearer;
  }

  /**
   * @dev give an account access to this role
   */
  function add(Role storage role, address account) internal {
    require(account != address(0));
    require(!has(role, account));

    role.bearer[account] = true;
  }

  /**
   * @dev remove an account's access to this role
   */
  function remove(Role storage role, address account) internal {
    require(account != address(0));
    require(has(role, account));

    role.bearer[account] = false;
  }

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



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

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

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

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

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

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


contract MinterRole {
  using Roles for Roles.Role;

  event MinterAdded(address indexed account);
  event MinterRemoved(address indexed account);

  Roles.Role private minters;

  constructor() internal {
    _addMinter(msg.sender);
  }

  modifier onlyMinter() {
    require(isMinter(msg.sender));
    _;
  }

  function isMinter(address account) public view returns (bool) {
    return minters.has(account);
  }

  function addMinter(address account) public onlyMinter {
    _addMinter(account);
  }

  function renounceMinter() public {
    _removeMinter(msg.sender);
  }

  function _addMinter(address account) internal {
    minters.add(account);
    emit MinterAdded(account);
  }

  function _removeMinter(address account) internal {
    minters.remove(account);
    emit MinterRemoved(account);
  }
}










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

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

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

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

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

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

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



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



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

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

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

    return c;
  }

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

    return c;
  }

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

    return c;
  }

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

    return c;
  }

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



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

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

}



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

  using SafeMath for uint256;
  using Address for address;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    emit Transfer(from, to, tokenId);
  }

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

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

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

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

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

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

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

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

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

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





/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract IERC721Metadata is IERC721 {
  function name() external view returns (string);
  function symbol() external view returns (string);
  function tokenURI(uint256 tokenId) external view returns (string);
}






contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
  // Token name
  string private _name;

  // Token symbol
  string private _symbol;

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

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

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

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

  /**
   * @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) external view returns (string) {
    require(_exists(tokenId));
    return _tokenURIs[tokenId];
  }

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







/**
 * @title ERC721MetadataMintable
 * @dev ERC721 minting logic with metadata
 */
contract ERC721MetadataMintable is ERC721, ERC721Metadata, MinterRole {
  /**
   * @dev Function to mint tokens
   * @param to The address that will receive the minted tokens.
   * @param tokenId The token id to mint.
   * @param tokenURI The token URI of the minted token.
   * @return A boolean that indicates if the operation was successful.
   */
  function mintWithTokenURI(
    address to,
    uint256 tokenId,
    string tokenURI
  )
    public
    onlyMinter
    returns (bool)
  {
    _mint(to, tokenId);
    _setTokenURI(tokenId, tokenURI);
    return true;
  }
}


contract TreasureHunt is ERC721Metadata("FOAM Treasure Hunt", "FTH"), ERC721MetadataMintable {

  constructor () public {
  }
}

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":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":"from","type":"address"},{"name":"to","type":"address"},{"name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"tokenId","type":"uint256"},{"name":"tokenURI","type":"string"}],"name":"mintWithTokenURI","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addMinter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceMinter","outputs":[],"payable":false,"stateMutability":"nonpayable","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":"account","type":"address"}],"name":"isMinter","outputs":[{"name":"","type":"bool"}],"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":true,"inputs":[{"name":"owner","type":"address"},{"name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"MinterAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"MinterRemoved","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"}]

Contract Creation Code

60806040523480156200001157600080fd5b50604080518082018252601281527f464f414d2054726561737572652048756e7400000000000000000000000000006020808301919091528251808401909352600383527f46544800000000000000000000000000000000000000000000000000000000009083015290620000af7f01ffc9a70000000000000000000000000000000000000000000000000000000064010000000062000165810204565b620000e37f80ac58cd0000000000000000000000000000000000000000000000000000000064010000000062000165810204565b8151620000f8906005906020850190620002b7565b5080516200010e906006906020840190620002b7565b50620001437f5b5e139f0000000000000000000000000000000000000000000000000000000064010000000062000165810204565b50506200015f33620001d2640100000000026401000000009004565b6200035c565b7fffffffff0000000000000000000000000000000000000000000000000000000080821614156200019557600080fd5b7fffffffff00000000000000000000000000000000000000000000000000000000166000908152602081905260409020805460ff19166001179055565b620001ed60088264010000000062000ea76200022482021704565b604051600160a060020a038216907f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f690600090a250565b600160a060020a03811615156200023a57600080fd5b6200024f82826401000000006200027f810204565b156200025a57600080fd5b600160a060020a0316600090815260209190915260409020805460ff19166001179055565b6000600160a060020a03821615156200029757600080fd5b50600160a060020a03166000908152602091909152604090205460ff1690565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620002fa57805160ff19168380011785556200032a565b828001600101855582156200032a579182015b828111156200032a5782518255916020019190600101906200030d565b50620003389291506200033c565b5090565b6200035991905b8082111562000338576000815560010162000343565b90565b61100d806200036c6000396000f3006080604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166301ffc9a781146100f557806306fdde0314610140578063081812fc146101ca578063095ea7b3146101fe57806323b872dd1461022457806342842e0e1461024e57806350bb4e7f146102785780636352211e146102e157806370a08231146102f957806395d89b411461032c578063983b2d56146103415780639865027514610362578063a22cb46514610377578063aa271e1a1461039d578063b88d4fde146103be578063c87b56dd1461042d578063e985e9c514610445575b600080fd5b34801561010157600080fd5b5061012c7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff196004351661046c565b604080519115158252519081900360200190f35b34801561014c57600080fd5b506101556104a0565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561018f578181015183820152602001610177565b50505050905090810190601f1680156101bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101d657600080fd5b506101e2600435610537565b60408051600160a060020a039092168252519081900360200190f35b34801561020a57600080fd5b50610222600160a060020a0360043516602435610569565b005b34801561023057600080fd5b50610222600160a060020a036004358116906024351660443561061f565b34801561025a57600080fd5b50610222600160a060020a03600435811690602435166044356106ad565b34801561028457600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261012c948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506106ce9650505050505050565b3480156102ed57600080fd5b506101e2600435610702565b34801561030557600080fd5b5061031a600160a060020a036004351661072c565b60408051918252519081900360200190f35b34801561033857600080fd5b5061015561075f565b34801561034d57600080fd5b50610222600160a060020a03600435166107c0565b34801561036e57600080fd5b506102226107e0565b34801561038357600080fd5b50610222600160a060020a036004351660243515156107eb565b3480156103a957600080fd5b5061012c600160a060020a036004351661086f565b3480156103ca57600080fd5b50604080516020601f60643560048181013592830184900484028501840190955281845261022294600160a060020a0381358116956024803590921695604435953695608494019181908401838280828437509497506108829650505050505050565b34801561043957600080fd5b506101556004356108aa565b34801561045157600080fd5b5061012c600160a060020a036004358116906024351661095f565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191660009081526020819052604090205460ff1690565b60058054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561052c5780601f106105015761010080835404028352916020019161052c565b820191906000526020600020905b81548152906001019060200180831161050f57829003601f168201915b505050505090505b90565b60006105428261098d565b151561054d57600080fd5b50600090815260026020526040902054600160a060020a031690565b600061057482610702565b9050600160a060020a03838116908216141561058f57600080fd5b33600160a060020a03821614806105ab57506105ab813361095f565b15156105b657600080fd5b600082815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b61062933826109aa565b151561063457600080fd5b600160a060020a038216151561064957600080fd5b6106538382610a09565b61065d8382610a7a565b6106678282610b10565b8082600160a060020a031684600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6106c98383836020604051908101604052806000815250610882565b505050565b60006106d93361086f565b15156106e457600080fd5b6106ee8484610ba0565b6106f88383610bfb565b5060019392505050565b600081815260016020526040812054600160a060020a031680151561072657600080fd5b92915050565b6000600160a060020a038216151561074357600080fd5b50600160a060020a031660009081526003602052604090205490565b60068054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561052c5780601f106105015761010080835404028352916020019161052c565b6107c93361086f565b15156107d457600080fd5b6107dd81610c2e565b50565b6107e933610c76565b565b600160a060020a03821633141561080157600080fd5b336000818152600460209081526040808320600160a060020a03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b600061072660088363ffffffff610cbe16565b61088d84848461061f565b61089984848484610cf5565b15156108a457600080fd5b50505050565b60606108b58261098d565b15156108c057600080fd5b60008281526007602090815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845290918301828280156109535780601f1061092857610100808354040283529160200191610953565b820191906000526020600020905b81548152906001019060200180831161093657829003601f168201915b50505050509050919050565b600160a060020a03918216600090815260046020908152604080832093909416825291909152205460ff1690565b600090815260016020526040902054600160a060020a0316151590565b6000806109b683610702565b905080600160a060020a031684600160a060020a031614806109f1575083600160a060020a03166109e684610537565b600160a060020a0316145b80610a015750610a01818561095f565b949350505050565b81600160a060020a0316610a1c82610702565b600160a060020a031614610a2f57600080fd5b600081815260026020526040902054600160a060020a031615610a76576000818152600260205260409020805473ffffffffffffffffffffffffffffffffffffffff191690555b5050565b81600160a060020a0316610a8d82610702565b600160a060020a031614610aa057600080fd5b600160a060020a038216600090815260036020526040902054610aca90600163ffffffff610e7716565b600160a060020a03909216600090815260036020908152604080832094909455918152600190915220805473ffffffffffffffffffffffffffffffffffffffff19169055565b600081815260016020526040902054600160a060020a031615610b3257600080fd5b6000818152600160208181526040808420805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0388169081179091558452600390915290912054610b8091610e8e565b600160a060020a0390921660009081526003602052604090209190915550565b600160a060020a0382161515610bb557600080fd5b610bbf8282610b10565b6040518190600160a060020a038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b610c048261098d565b1515610c0f57600080fd5b600082815260076020908152604090912082516106c992840190610f49565b610c3f60088263ffffffff610ea716565b604051600160a060020a038216907f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f690600090a250565b610c8760088263ffffffff610ef516565b604051600160a060020a038216907fe94479a9f7e1952cc78f2d6baab678adc1b772d936c6583def489e524cb6669290600090a250565b6000600160a060020a0382161515610cd557600080fd5b50600160a060020a03166000908152602091909152604090205460ff1690565b600080610d0a85600160a060020a0316610f41565b1515610d195760019150610e6e565b6040517f150b7a020000000000000000000000000000000000000000000000000000000081523360048201818152600160a060020a03898116602485015260448401889052608060648501908152875160848601528751918a169463150b7a0294938c938b938b93909160a490910190602085019080838360005b83811015610dac578181015183820152602001610d94565b50505050905090810190601f168015610dd95780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015610dfb57600080fd5b505af1158015610e0f573d6000803e3d6000fd5b505050506040513d6020811015610e2557600080fd5b50517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1981167f150b7a020000000000000000000000000000000000000000000000000000000014925090505b50949350505050565b60008083831115610e8757600080fd5b5050900390565b600082820183811015610ea057600080fd5b9392505050565b600160a060020a0381161515610ebc57600080fd5b610ec68282610cbe565b15610ed057600080fd5b600160a060020a0316600090815260209190915260409020805460ff19166001179055565b600160a060020a0381161515610f0a57600080fd5b610f148282610cbe565b1515610f1f57600080fd5b600160a060020a0316600090815260209190915260409020805460ff19169055565b6000903b1190565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610f8a57805160ff1916838001178555610fb7565b82800160010185558215610fb7579182015b82811115610fb7578251825591602001919060010190610f9c565b50610fc3929150610fc7565b5090565b61053491905b80821115610fc35760008155600101610fcd5600a165627a7a72305820c79117ae4b71c96a0666dc3fcf7f4bec95fa931b2500ee225d4506f8a8f7c3c50029

Swarm Source

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