标记分类框架的输入规范文件
Blockchain App Builder 初始化命令读取输入规范文件,并使用多个工具生成基架项目,以协助链码开发过程。
您可以在同一规范文件中定义基于令牌分类框架的标准资产和令牌资产。不能根据同一规范文件中的多个标准定义标记资产。
有关在规范文件中包括标准资产的信息,请参见 Input Specification File 。
Blockchain App Builder 程序包中提供了以下可替换令牌资产的示例规范文件:
FiatMoneyToken.yml
LoyaltyToken-Go.yml
除了标准属性和节外,可替换令牌资产还支持规范文件中的 behavior
和 anatomy
部分。可替换令牌资产还支持 standard
属性。以下示例显示了基于令牌分类框架的可替换令牌资产的规范文件的结构:
assets:
- name: OBPTOK # Asset name
type: token # Asset type
anatomy:
type: fungible # Token type
unit: fractional # Token unit
behavior: # Token behaviors
- divisible:
decimal: 2
- mintable:
max_mint_quantity: 1000
- transferable
- burnable
- roles:
minter_role_name: minter
properties:
- name: currency_name # Custom attribute to represent the token in certain currency. This attribute is helpful for exchanging the tokens with fiat currency.
type: string
- name: token_to_currency_ratio # Custom attribute to specify the token to currency ratio. This attribute is helpful for exchanging the tokens with fiat currency.
type: number
表 7-5 可替代标记规范文件的参数说明和示例
进入 | 说明 | 示例 |
---|---|---|
type: |
必须在 |
|
standard: |
standard 属性表示链代码生成期间要遵循的标记标准。可替换令牌仅支持 ttf+ 值。如果未为可替换令牌指定 standard 属性,则遵循令牌分类框架 (Token Taxonomy Framework,TTF) 标准。
|
|
anatomy: |
anatomy 部分具有两个可替换令牌的必需参数:
|
|
behavior: |
本节介绍令牌的功能和限制。mintable 和 transferable 行为对于可替换令牌是必需的。
|
|
要创建使用不同 max_mint_quantity
参数的多个可替换令牌 ID,请为规范文件中的每个令牌 ID 创建单独的令牌资产,并在令牌资产和令牌 ID 之间建立 1:1 关系。
要创建使用相同 max_mint_quantity
参数或不使用 max_mint_quantity
参数的多个可替换令牌 ID,请在规范文件中创建单个令牌资产以用于所有令牌 ID。