http://www.7klian.com

Ink!开拓 Substrate ERC20 智能合约利用教程

•成果先容:
1.2 安装cargo contract插件


function transfer(address _to, uint _value) returns (bool success);


Utilities to develop Wasm smart contracts


切换到一个新分支 'v2.0.0-rc4'
USAGE:
1.1 安装Substrate节点


function approve(address _spender, uint _value) returns (bool success);
•安装呼吁


cargo-contract 0.6.1
help Prints this message or the help of the given subcommand(s)

cargo contract <SUBCOMMAND>

function allowance(address _owner, address _spender) constant returns (uint remaining);


2.2 ERC20接口
test Test the smart contract off-chain
function balanceOf(address _owner) constant returns (uint balance);
build Compiles the smart contract


function transferFrom(address _from, address _to, uint _value) returns (bool success);
new Setup and create a new smart contract project
(master)$ git checkout -b v2.0.0-rc4 v2.0.0-rc4

•辅佐手册

-V, --version Prints version information

generate-metadata Generate contract metadata artifacts
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);

ERC20界说了一些尺度的接口函数:balanceOf 、 totalSupply 、transfer 、transferFrom 、approve和allowance 。以及一些可选的字段,譬喻通证名称、标记以及小数保存位数等。


$ cargo contract --help

详见:https://github.com/ethereum/EIPs/blob/master/EIPS/...
2.1 什么是ERC20尺度


$ cargo install cargo-contract --vers 0.6.1 --force


SUBCOMMANDS:








}



(v2.0.0-rc4)$ cargo build --release

$ cd substrate

$ git clone git@github.com:paritytech/substrate.git
function totalSupply() constant returns (uint theTotalSupply);
-h, --help Prints help information
2 ERC20合约先容

ERC20 通证尺度(ERC20 Token Standard)是通过以太坊建设通证时的一种类型。凭据 ERC20 的类型可以编写一个
智能合约,,建设“可交流畅证”。它并非强制要求,但遵循这个尺度,所建设的通证可以与浩瀚生意业务所、钱包等举办交互,它此刻已被行业普遍接管。



contract ERC20 {




OPTIONS:

郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。

相关文章阅读