How to do it…

  1. Create a new contract that inherits the BasicERC721 contract created in the previous recipe. This removes the need to declare the token and ownership properties:
pragma solidity ^0.4.23;import "./BasicERC721.sol";contract ERC721Token {    //...}
  1. A token can be transferred by the owner or by the approved person. The approval can be of two types. The user can set approval for one specific token or all the tokens owned by an address. Create two different mappings to maintain this:
// Mapping from token ID to approved addressmapping (uint256 => address) internal tokenApprovals;// Mapping from owner to operator approvalsmapping (address => mapping (address => bool)) internal operatorApprovals;
  1. Declare dedicated functions to verify ...

Get Ethereum Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.