Skip to Content
Ethereum Cookbook
book

Ethereum Cookbook

by Manoj P R
August 2018
Intermediate to advanced
404 pages
11h 19m
English
Packt Publishing
Content preview from Ethereum Cookbook

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Building Ethereum Dapps

Building Ethereum Dapps

Roberto Infante
Ethereum For Dummies

Ethereum For Dummies

Michael G. Solomon

Publisher Resources

ISBN: 9781789133998Supplemental Content