Skip to content

Latest commit

 

History

History
24 lines (21 loc) · 711 Bytes

File metadata and controls

24 lines (21 loc) · 711 Bytes

第31讲(數據儲存位置)

事件

/**
 * Transfer時呼叫
 */
event Transfer(address indexed from, address indexed to, uint256 value);

/**
 * Approve時呼叫
 */
event Approval(address indexed owner, address indexed spender, uint256 value);

函數

  1. totalSupply() => 總供給量
  2. balanceOf(account) => 帳戶餘額
  3. transfer(to, amount) => 從自己到轉代幣到to
  4. allowance(owner, spender) => 返回owner授權給spender的額度
  5. approve(spender, amount) => 自己授權代幣給spender
  6. transferFrom(from, to, amount) => 透過授權,從from帳戶轉向to代幣。同時allowance的額度會被扣除。
  7. mint(amount) => 鑄造代幣
  8. burn(amount) => 銷毀代幣