Coin / Token API 对比
这个附录对比了 Coin 和 Token 模块的 API,可以用作快速参考。
| Function | Coin | Token | Note |
|---|---|---|---|
| mint | + | + | Requires TreasuryCap |
| burn | + | + | Requires TreasuryCap |
| join | + | + | Public |
| split | + | + | Public |
| zero | + | + | Public |
| destroy_zero | + | + | Public |
| keep | - | + | Send Token to sender, not required for Coin due to lack of transfer restrictions |
| transfer | + | [protected] | Coin is transferable by default, Token requires authorization |
| to_balance / to_coin | + | [protected] | Token can be converted "to_coin", requires authorization |
| from_balance / from_coin | + | [protected] | Token can be created "from_coin", requires authorization |
| spend | - | [protected] | Token can be "spent", requires authorization (see "spending") |