Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 1.05 KB

File metadata and controls

40 lines (31 loc) · 1.05 KB

ERC20

事件

// 转移
event Transfer(address indexed _addr, address indexed _from, uint256 amount);
// 授权
event Approve(address indexed owner, address indexed spender, uint256 amount);

函数

// 代币总数
function totalSupply() external view returns (uint256);
// 账户余额
function balanceOf(address _address) external view returns(uint256);
// 授权额度
function allowance(address owner,address spender) external view returns(uint256);

// 转帐
function transfer(address _address, uint256 amount) external view returns(bool);

// 授权 
function approve(address spender,uint256 amount) external view returns(bool);

// 授权转帐
function approveTransfer(address from, address to, uint256 amount) external view returns(bool);

代码实现

IERC20接口
ERC20实现

代币水龙头

需求

我们将一些代币存放到水龙头合约里,用户可以通过这个合约领取代币,每个地址只允许领取一次

代码

Faucet代码实现