Skip to Content
Mastering Blockchain Programming with Solidity
book

Mastering Blockchain Programming with Solidity

by Jitendra Chittoda
August 2019
Intermediate to advanced
486 pages
13h 52m
English
Packt Publishing
Content preview from Mastering Blockchain Programming with Solidity

Create tokens with metadata using DetailedERC20.sol

Using the DetailedERC20.sol contract, you can define the optional fields for an ERC20 token; that is, the name, symbol, and decimals of the token. 

The OpenZeppelin contract present at Chapter09/openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol is defined as follows:

import "./IERC20.sol";contract ERC20Detailed is IERC20 {    string private _name;    string private _symbol;    uint8 private _decimals;    constructor (string memory name, string memory symbol, uint8 decimals)     public {        _name = name;        _symbol = symbol;        _decimals = decimals;    }    function name() public view returns (string memory) {        return _name;    }    function symbol() public view returns (string memory) {        return _symbol;    }    function ...
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

Mastering Ethereum

Mastering Ethereum

Andreas M. Antonopoulos, Gavin Wood
Complete Cryptocurrency and Blockchain Course | Learn Solidity

Complete Cryptocurrency and Blockchain Course | Learn Solidity

Ravinder Deol, Codestars By Rob Percival, Thomas Wiesner

Publisher Resources

ISBN: 9781839218262Supplemental Content