#HRC20 Token 标准
HECO 完全兼容以太坊 ERC20 标准,interface 和 event 如下:
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(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);
}
标准请参考:
eip-20
实现请参考:
openzeppelin-contracts
创建合约教程
1.下载MetaMask钱包
官网地址:https://metamask.io/
浏览器插件下载(国内):https://ext.chrome.360.cn/webstore/detail/cickkggoijngnjkmbmkibdhmklahopfi
2.选择网络,自定义RPC
3.填入HECO网络信息
网络名称(随意填):火币生态链或Huobi ECO Chain
新增 RPC 网址:https://http-mainnet-node.huobichain.com
链 ID:128
符号(选填):HT
区块浏览器 URL(选填): https://hecoinfo.com