This tutorial helps you to create an example ERC-20 compatible token that conforms to the Klaytn Token Standards, especially Fungible Token Standard (ERC-20).

ERC-20 Token Standard defines two events and 9 methods (including 3 optional methods) as below. ERC-20-compatible tokens are token contracts that implements the following interface.

function name() public view returns (string) //optional
function symbol() public view returns (string) //optional
function decimals() public view returns (uint8) //optional
function totalSupply() public view returns (uint256)
function balanceOf(address _owner) public view returns (uint256 balance)
function transfer(address _to, uint256 _value) public returns (bool success)
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)
function approve(address _spender, uint256 _value) public returns (bool success)
function allowance(address _owner, address _spender) public view returns (uint256 remaining)
event Transfer(address indexed _from, address indexed _to, uint256 _value)
event Approval(address indexed _owner, address indexed _spender, uint256 _value)

Based on above interface, developers may customize tokens by adding new features and logics, and deploy on Klaytn network. For more information, refer to official ERC-20 documentation.

In this tutorial, you are going to implement MyERC20.sol, an ERC-20 compatible token. This token will issue a predefined amount of tokens and sends all of the tokens to the contract owner on its deploy.

MyERC20.sol is based on OpenZeppelin's ERC20 implementation. A major part of the code in this tutorial is forked from OpenZeppelin 2.3 and following Solidity files are used to implement MyERC20.sol.

The rest of this tutorial is organized as follows.