Defining and implementing the ERC-20 interface
The ERC-20 interface defines a set of rules that a token must follow in order to be traded on the Ethereum network. There are a total of six mandatory functions and three optional functions that a token contract must implement. We define the ERC-20 token interface as follows. MyERC20Token
will implement the ERC-20 interface:
interface ERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); &...