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); Â Â Â &...