Contract 0x7e9d2ebb9dd861271f7a1bc4d8c43c8d23e2085a

Contract Overview

Balance:
0 Ether
TxHash Block Age From To Value [TxFee]
0xe191ef69866e0a120ded08d523d327c7a263fc31aa87ff45d9a35e22874085e73967029199 days 3 hrs ago0x66c4f3495c5ee23d16c105fba05c1ed5224c2d15 IN  0x7e9d2ebb9dd861271f7a1bc4d8c43c8d23e2085a0.001 Ether0.000334794
0xddbce3be002dbe01dd59ce94aa492111a91df2bbbf57822b6160c78683e1106c3967013199 days 3 hrs ago0x66c4f3495c5ee23d16c105fba05c1ed5224c2d15 IN  0x7e9d2ebb9dd861271f7a1bc4d8c43c8d23e2085a0.001 Ether0.000424794
0x579de4c969d052a4177df25706087b50e88a829415a2b9f6d0d3fea4f4db83513966996199 days 3 hrs ago0x66c4f3495c5ee23d16c105fba05c1ed5224c2d15 IN  0x7e9d2ebb9dd861271f7a1bc4d8c43c8d23e2085a0.001 Ether0.000428675
0x8eccfa2cf22aad0d0d83aad52dabf3cd4b2b468d953ce385b80f0e409cc735c73966988199 days 3 hrs ago0x263e13a485ae463ad6679dac6e1d359a05423cd8 IN  0x7e9d2ebb9dd861271f7a1bc4d8c43c8d23e2085a0 Ether0.000144125
0x24b278c7f5945b7372ac107342f4f2a20b06242012c1bf7d31fb60d67aca8ff73966987199 days 3 hrs ago0x263e13a485ae463ad6679dac6e1d359a05423cd8 IN  0x7e9d2ebb9dd861271f7a1bc4d8c43c8d23e2085a0 Ether0.000144125
0x3546ec3fda54202ae4ab1c0c42b66d8944dce690db51603cf0fe00fe9b2909883966983199 days 3 hrs ago0x263e13a485ae463ad6679dac6e1d359a05423cd8 IN  0x7e9d2ebb9dd861271f7a1bc4d8c43c8d23e2085a0 Ether0.000115044
0x1c8ff8f9a11834a681f4e4de85b0762291653c4b124564b82ec886df6e0edca73966881199 days 4 hrs ago0x263e13a485ae463ad6679dac6e1d359a05423cd8 IN  0x7e9d2ebb9dd861271f7a1bc4d8c43c8d23e2085a0 Ether0.000339468
0xbe4c7cde7f1faeb9fd4caf4732d77e6f0fac10ae25228bebb183bd2aa3779f803966873199 days 4 hrs ago0x263e13a485ae463ad6679dac6e1d359a05423cd8 IN  0x7e9d2ebb9dd861271f7a1bc4d8c43c8d23e2085a0 Ether0.000989412
0xe0966d136dd6070113c06d879d6ae6484835cbf1da87f8e27eb08c5aaa6ab22b3966868199 days 4 hrs ago0x263e13a485ae463ad6679dac6e1d359a05423cd8 IN  0x7e9d2ebb9dd861271f7a1bc4d8c43c8d23e2085a0 Ether0.000494706
0x0517b7d9e0ef2d6b3705b684dbc3f3d7151b149471c760b558443bd25b0f90483966846199 days 4 hrs ago0x263e13a485ae463ad6679dac6e1d359a05423cd8 IN  0x7e9d2ebb9dd861271f7a1bc4d8c43c8d23e2085a0 Ether0.001967665
0x597e0f54b319815c5af8613928e6d9436e915af051422a9647983941237b21a63966826199 days 4 hrs ago0x263e13a485ae463ad6679dac6e1d359a05423cd8 IN  Contract Creation0 Ether0.01003839
[ Download CSV Export 

Latest 6 internal transactions Internal Transactions as a result of Contract Execution

Parent TxHash Block Age From To Value
0xe191ef69866e0a120ded08d523d327c7a263fc31aa87ff45d9a35e22874085e73967029199 days 3 hrs ago0x7e9d2ebb9dd861271f7a1bc4d8c43c8d23e2085a0x263e13a485ae463ad6679dac6e1d359a05423cd80.0009 Ether
0xe191ef69866e0a120ded08d523d327c7a263fc31aa87ff45d9a35e22874085e73967029199 days 3 hrs ago0x7e9d2ebb9dd861271f7a1bc4d8c43c8d23e2085a0x263e13a485ae463ad6679dac6e1d359a05423cd80.0001 Ether
0xddbce3be002dbe01dd59ce94aa492111a91df2bbbf57822b6160c78683e1106c3967013199 days 3 hrs ago0x7e9d2ebb9dd861271f7a1bc4d8c43c8d23e2085a0x263e13a485ae463ad6679dac6e1d359a05423cd80.0009 Ether
0xddbce3be002dbe01dd59ce94aa492111a91df2bbbf57822b6160c78683e1106c3967013199 days 3 hrs ago0x7e9d2ebb9dd861271f7a1bc4d8c43c8d23e2085a0x263e13a485ae463ad6679dac6e1d359a05423cd80.0001 Ether
0x579de4c969d052a4177df25706087b50e88a829415a2b9f6d0d3fea4f4db83513966996199 days 3 hrs ago0x7e9d2ebb9dd861271f7a1bc4d8c43c8d23e2085a0x263e13a485ae463ad6679dac6e1d359a05423cd80.0009 Ether
0x579de4c969d052a4177df25706087b50e88a829415a2b9f6d0d3fea4f4db83513966996199 days 3 hrs ago0x7e9d2ebb9dd861271f7a1bc4d8c43c8d23e2085a0x263e13a485ae463ad6679dac6e1d359a05423cd80.0001 Ether
[ Download CSV Export 
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:
AssetToken

Compiler Version
v0.4.24+commit.e67f0147

Optimization Enabled:
Yes

Runs (Optimizer):
200

Contract Source Code

pragma solidity ^0.4.24;


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

  bytes4 internal 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 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63;
  /**
   * 0x780e9d63 ===
   *   bytes4(keccak256('totalSupply()')) ^
   *   bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^
   *   bytes4(keccak256('tokenByIndex(uint256)'))
   */

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

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

  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;

  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
   * @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
  {
    require(isApprovedOrOwner(msg.sender, _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
  {
    // 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(checkAndCallSafeTransfer(_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 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);
  }
}


contract AssetToken is ERC721BasicToken, Ownable {
    
    struct Asset {
        string name;
        string iamge;
        string description;
        uint price;
        address artist;
        bool forSale;
    }

    Asset[] public assets;

    function getAssetsCount() public view returns(uint) {
        return assets.length;
    }

    function createAsset(string _name, string _image, string _description, uint _price, address _artist) public {
        uint id = assets.length;
        assets.push(Asset(_name, _image, _description, _price, _artist, false));
        _mint(msg.sender, id);
    }

    function updateAsset(uint _tokenId, string _name, string _image, string _description, uint _price, address _artist) public {
        require(msg.sender == ownerOf(_tokenId) || msg.sender == owner);
        assets[_tokenId] = Asset(_name, _image, _description, _price, _artist, assets[_tokenId].forSale);
    }

    function updateForSale(uint _tokenId) public {
        require(msg.sender == ownerOf(_tokenId) || msg.sender == owner);
        assets[_tokenId].forSale = !assets[_tokenId].forSale;
    }

    function buyAsset(uint _tokenId) public payable {
        require(assets[_tokenId].forSale);
        require(msg.value == assets[_tokenId].price);
        address oldOwner = ownerOf(_tokenId);
        clearApproval(oldOwner, _tokenId);
        removeTokenFrom(oldOwner, _tokenId);
        addTokenTo(msg.sender, _tokenId);
        uint portion = msg.value / 10;
        assets[_tokenId].artist.transfer(portion);
        oldOwner.transfer(msg.value - portion);
        assets[_tokenId].price += assets[_tokenId].price / 5;
        emit Transfer(oldOwner, msg.sender, _tokenId);
    }
}

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":"_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":"getAssetsCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"buyAsset","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"InterfaceId_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_name","type":"string"},{"name":"_image","type":"string"},{"name":"_description","type":"string"},{"name":"_price","type":"uint256"},{"name":"_artist","type":"address"}],"name":"updateAsset","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":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":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"},{"name":"_image","type":"string"},{"name":"_description","type":"string"},{"name":"_price","type":"uint256"},{"name":"_artist","type":"address"}],"name":"createAsset","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":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":"","type":"uint256"}],"name":"assets","outputs":[{"name":"name","type":"string"},{"name":"iamge","type":"string"},{"name":"description","type":"string"},{"name":"price","type":"uint256"},{"name":"artist","type":"address"},{"name":"forSale","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"updateForSale","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"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"}]

Contract Creation Code

60806040526100367f01ffc9a70000000000000000000000000000000000000000000000000000000064010000000061007f810204565b6100687f80ac58cd0000000000000000000000000000000000000000000000000000000064010000000061007f810204565b60058054600160a060020a031916331790556100eb565b7fffffffff0000000000000000000000000000000000000000000000000000000080821614156100ae57600080fd5b7fffffffff00000000000000000000000000000000000000000000000000000000166000908152602081905260409020805460ff19166001179055565b6116ec806100fa6000396000f3006080604052600436106101115763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166301ffc9a78114610116578063081812fc1461014c578063095ea7b3146101805780630aac5dfd146101a6578063110d35b8146101cd57806319fa8f50146101d857806323b872dd1461020a578063372c66e31461023457806342842e0e1461031f5780636352211e1461034957806370a0823114610361578063715018a6146103825780638da5cb5b14610397578063928c82a2146103ac578063a22cb46514610492578063b88d4fde146104b8578063cf35bdd014610527578063e985e9c5146106a3578063f2fde38b146106ca578063fc14ed71146106eb575b600080fd5b34801561012257600080fd5b50610138600160e060020a031960043516610703565b604080519115158252519081900360200190f35b34801561015857600080fd5b50610164600435610722565b60408051600160a060020a039092168252519081900360200190f35b34801561018c57600080fd5b506101a4600160a060020a036004351660243561073d565b005b3480156101b257600080fd5b506101bb6107e6565b60408051918252519081900360200190f35b6101a46004356107ed565b3480156101e457600080fd5b506101ed6109a6565b60408051600160e060020a03199092168252519081900360200190f35b34801561021657600080fd5b506101a4600160a060020a03600435811690602435166044356109ca565b34801561024057600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526101a495833595369560449491939091019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a9998810197919650918201945092508291508401838280828437509497505084359550505050602090910135600160a060020a03169050610a6d565b34801561032b57600080fd5b506101a4600160a060020a0360043581169060243516604435610c06565b34801561035557600080fd5b50610164600435610c27565b34801561036d57600080fd5b506101bb600160a060020a0360043516610c51565b34801561038e57600080fd5b506101a4610c84565b3480156103a357600080fd5b50610164610ce5565b3480156103b857600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526101a494369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a9998810197919650918201945092508291508401838280828437509497505084359550505050602090910135600160a060020a03169050610cf4565b34801561049e57600080fd5b506101a4600160a060020a03600435166024351515610e33565b3480156104c457600080fd5b50604080516020601f6064356004818101359283018490048402850184019095528184526101a494600160a060020a038135811695602480359092169560443595369560849401918190840183828082843750949750610eb79650505050505050565b34801561053357600080fd5b5061053f600435610edf565b6040805160608101859052600160a060020a038416608082015282151560a082015260c080825288519082015287519091829160208084019284019160e08501918c019080838360005b838110156105a1578181015183820152602001610589565b50505050905090810190601f1680156105ce5780820380516001836020036101000a031916815260200191505b5084810383528951815289516020918201918b019080838360005b838110156106015781810151838201526020016105e9565b50505050905090810190601f16801561062e5780820380516001836020036101000a031916815260200191505b5084810382528851815288516020918201918a019080838360005b83811015610661578181015183820152602001610649565b50505050905090810190601f16801561068e5780820380516001836020036101000a031916815260200191505b50995050505050505050505060405180910390f35b3480156106af57600080fd5b50610138600160a060020a03600435811690602435166110f2565b3480156106d657600080fd5b506101a4600160a060020a0360043516611120565b3480156106f757600080fd5b506101a4600435611143565b600160e060020a03191660009081526020819052604090205460ff1690565b600090815260026020526040902054600160a060020a031690565b600061074882610c27565b9050600160a060020a03838116908216141561076357600080fd5b33600160a060020a038216148061077f575061077f81336110f2565b151561078a57600080fd5b6000828152600260205260408082208054600160a060020a031916600160a060020a0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6006545b90565b6000806006838154811015156107ff57fe5b906000526020600020906005020160040160149054906101000a900460ff16151561082957600080fd5b600680548490811061083757fe5b9060005260206000209060050201600301543414151561085657600080fd5b61085f83610c27565b915061086b82846111e8565b610875828461124c565b61087f33846112d5565b600a3404905060068381548110151561089457fe5b60009182526020822060046005909202010154604051600160a060020a039091169183156108fc02918491818181858888f193505050501580156108dc573d6000803e3d6000fd5b50604051600160a060020a038316903483900380156108fc02916000818181858888f19350505050158015610915573d6000803e3d6000fd5b50600560068481548110151561092757fe5b90600052602060002090600502016003015481151561094257fe5b0460068481548110151561095257fe5b600091825260208220600360059092020101805490920190915560405184913391600160a060020a038616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b7f01ffc9a70000000000000000000000000000000000000000000000000000000081565b6109d43382611358565b15156109df57600080fd5b600160a060020a03831615156109f457600080fd5b600160a060020a0382161515610a0957600080fd5b610a1383826111e8565b610a1d838261124c565b610a2782826112d5565b8082600160a060020a031684600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b610a7686610c27565b600160a060020a031633600160a060020a03161480610a9f5750600554600160a060020a031633145b1515610aaa57600080fd5b60c06040519081016040528086815260200185815260200184815260200183815260200182600160a060020a03168152602001600688815481101515610aec57fe5b600091825260209091206005909102016004015474010000000000000000000000000000000000000000900460ff16151590526006805488908110610b2d57fe5b90600052602060002090600502016000820151816000019080519060200190610b57929190611628565b506020828101518051610b709260018501920190611628565b5060408201518051610b8c916002840191602090910190611628565b506060820151600382015560808201516004909101805460a0909301511515740100000000000000000000000000000000000000000274ff000000000000000000000000000000000000000019600160a060020a03909316600160a060020a03199094169390931791909116919091179055505050505050565b610c228383836020604051908101604052806000815250610eb7565b505050565b600081815260016020526040812054600160a060020a0316801515610c4b57600080fd5b92915050565b6000600160a060020a0382161515610c6857600080fd5b50600160a060020a031660009081526003602052604090205490565b600554600160a060020a03163314610c9b57600080fd5b600554604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a260058054600160a060020a0319169055565b600554600160a060020a031681565b600680546040805160c081018252888152602080820189905291810187905260608101869052600160a060020a0385166080820152600060a0820181905260018401808655949052805180519394939192600586027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0192610d799284920190611628565b506020828101518051610d929260018501920190611628565b5060408201518051610dae916002840191602090910190611628565b506060820151600382015560808201516004909101805460a0909301511515740100000000000000000000000000000000000000000274ff000000000000000000000000000000000000000019600160a060020a03909316600160a060020a0319909416939093179190911691909117905550610e2b33826113b7565b505050505050565b600160a060020a038216331415610e4957600080fd5b336000818152600460209081526040808320600160a060020a03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b610ec28484846109ca565b610ece84848484611412565b1515610ed957600080fd5b50505050565b6006805482908110610eed57fe5b60009182526020918290206005919091020180546040805160026001841615610100026000190190931692909204601f810185900485028301850190915280825291935091839190830182828015610f865780601f10610f5b57610100808354040283529160200191610f86565b820191906000526020600020905b815481529060010190602001808311610f6957829003601f168201915b505050505090806001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110245780601f10610ff957610100808354040283529160200191611024565b820191906000526020600020905b81548152906001019060200180831161100757829003601f168201915b50505060028085018054604080516020601f60001961010060018716150201909416959095049283018590048502810185019091528181529596959450909250908301828280156110b65780601f1061108b576101008083540402835291602001916110b6565b820191906000526020600020905b81548152906001019060200180831161109957829003601f168201915b505050506003830154600490930154919291600160a060020a038116915074010000000000000000000000000000000000000000900460ff1686565b600160a060020a03918216600090815260046020908152604080832093909416825291909152205460ff1690565b600554600160a060020a0316331461113757600080fd5b6111408161157f565b50565b61114c81610c27565b600160a060020a031633600160a060020a031614806111755750600554600160a060020a031633145b151561118057600080fd5b600680548290811061118e57fe5b906000526020600020906005020160040160149054906101000a900460ff16156006828154811015156111bd57fe5b906000526020600020906005020160040160146101000a81548160ff02191690831515021790555050565b81600160a060020a03166111fb82610c27565b600160a060020a03161461120e57600080fd5b600081815260026020526040902054600160a060020a0316156112485760008181526002602052604090208054600160a060020a03191690555b5050565b81600160a060020a031661125f82610c27565b600160a060020a03161461127257600080fd5b600160a060020a03821660009081526003602052604090205461129c90600163ffffffff6115f016565b600160a060020a039092166000908152600360209081526040808320949094559181526001909152208054600160a060020a0319169055565b600081815260016020526040902054600160a060020a0316156112f757600080fd5b60008181526001602081815260408084208054600160a060020a031916600160a060020a038816908117909155845260039091529091205461133891611607565b600160a060020a0390921660009081526003602052604090209190915550565b60008061136483610c27565b905080600160a060020a031684600160a060020a0316148061139f575083600160a060020a031661139484610722565b600160a060020a0316145b806113af57506113af81856110f2565b949350505050565b600160a060020a03821615156113cc57600080fd5b6113d682826112d5565b6040518190600160a060020a038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60008061142785600160a060020a0316611620565b15156114365760019150611576565b6040517f150b7a020000000000000000000000000000000000000000000000000000000081523360048201818152600160a060020a03898116602485015260448401889052608060648501908152875160848601528751918a169463150b7a0294938c938b938b93909160a490910190602085019080838360005b838110156114c95781810151838201526020016114b1565b50505050905090810190601f1680156114f65780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b15801561151857600080fd5b505af115801561152c573d6000803e3d6000fd5b505050506040513d602081101561154257600080fd5b5051600160e060020a031981167f150b7a020000000000000000000000000000000000000000000000000000000014925090505b50949350505050565b600160a060020a038116151561159457600080fd5b600554604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a360058054600160a060020a031916600160a060020a0392909216919091179055565b6000808383111561160057600080fd5b5050900390565b60008282018381101561161957600080fd5b9392505050565b6000903b1190565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061166957805160ff1916838001178555611696565b82800160010185558215611696579182015b8281111561169657825182559160200191906001019061167b565b506116a29291506116a6565b5090565b6107ea91905b808211156116a257600081556001016116ac5600a165627a7a723058202c8694c1291d4d637c58474fc0c59ff3468059cf9a6cfdbc6811d2e04c2875050029

Swarm Source

bzzr://2c8694c1291d4d637c58474fc0c59ff3468059cf9a6cfdbc6811d2e04c287505
Block Age Transaction Difficulty GasUsed Reward
Block Age Uncle Number Difficulty GasUsed Reward