// ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // ---------------------------------------------------------------------------- contract ERC20Interface { functiontotalSupply() public constant returns (uint); functionbalanceOf(address tokenOwner) public constant returns (uint balance); functionallowance(address tokenOwner, address spender) public constant returns (uint remaining); functiontransfer(address to, uint tokens) public returns (bool success); functionapprove(address spender, uint tokens) public returns (bool success); functiontransferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); }
同时规定了三个必须定义的变量,分别是
合约名称
合约代号
合约进制
1 2 3
string public constant name = "Token Name"; string public constant symbol = "SYM"; uint8 public constant decimals = 18; // 18 is the most common number of decimal places