ERC-1155 的輸入規格檔案
Blockchain App Builder 初始化命令會讀取輸入規格檔案,並使用多種工具產生結構化專案,以協助鏈碼開發程序。
您可以定義標準資產,以及以相同規格檔案中 ERC-1155 標準為基礎的有趣與非有趣的權杖資產。您無法根據相同規格檔案中的多個標準來定義權杖資產。
如需有關在規格檔案中包含標準資產的資訊,請參閱輸入規格檔案。
NFTArtCollectionMarketplacewithERC1155-TypeScript.yml
FractionalNFTinRealEstate-TypeScript.yml
除了標準特性和區段之外,記號資產還支援規格檔案中的 behavior
和 anatomy
區段。此外,不可行的權杖資產也支援 metadata
區段。下列範例顯示兩個 ERC-1155 記號資產的規格檔案結構、整個不可行記號,以及一個小數的有趣記號:
assets:
- name: ArtCollection #Asset name
type: token #Asset type
standard: erc1155+ # Token standard
anatomy:
type: nonfungible # Token type
unit: whole #Token unit
behavior:
- indivisible
- mintable:
max_mint_quantity: 20000
- transferable
- burnable
- lockable
- roles:
minter_role_name: minter
properties: # Custom asset attributes for non-fungible token
- name: price # Custom asset attribute to set the price of a non-fungible token in the marketplace
type: number
- name: on_sale_flag # Custom asset attribute maintains non-fungible token selling status in the marketplace
type: boolean
metadata: # Use this section to maintain the metadata on the blockchain. Only the user creating the non-fungible token can assign metadata attribute values, which cannot be updated later.
- name: painting_name
type: string
- name: description
type: string
- name: image
type: string
- name: painter_name
type: string
- name: Loyalty # Asset name
type: token # Asset type
standard: erc1155+ # Token standard
anatomy:
type: fungible # Token type
unit: fractional # Token unit
behavior: # Token behaviors
- divisible:
decimal: 2
- mintable:
max_mint_quantity: 10000
- transferable
- burnable
- roles:
minter_role_name: minter
properties:
- name: currency_name # Custom attribute to represent the token in a specific currency.
type: string
- name: token_to_currency_ratio # Custom attribute to specify the token to currency ratio.
type: number
下列範例顯示小數不可行記號的規格檔案結構:
- name: RealEstateProperty #Asset name
type: token #Asset type
standard: erc1155+ # Token standard
anatomy:
type: nonfungible # Token type
unit: fractional #Token unit
behavior:
- divisible:
- mintable:
- transferable
- roles:
minter_role_name: minter
properties: # Custom asset attributes for non-fungible token.
- name: propertySellingPrice # Custom asset attribute to set the real estate property selling price
type: number
- name: propertyRentingPrice # Custom asset attribute maintains the renting amount for the real estate property
type: number
metadata: # To maintain the metadata on-chain, this tag will be used. Users won't be able to update the metadata attribute values.
- name: propertyType
type: string
- name: propertyName
type: string
- name: propertyAddress
type: string
- name: propertyImage
type: string
表格 7-7 ERC-1155 記號規格檔案的參數描述與範例
進入 | 描述 | 範例 |
---|---|---|
type: |
您必須在 |
|
standard: |
ERC-1155 記號必須要有 standard 特性。它代表產生鏈碼時要遵循的記號標準。
|
|
anatomy: |
anatomy 區段有兩個必要參數:
|
|
behavior: |
本節說明記號的功能與限制。所有記號都必須要有 mintable 、transferable 行為。indivisible 行為對整個不可行記號而言是必要的。
|
|
metadata: |
在範例中, |
|
限制
Blockchain App Builder 為 ERC-1155 標準提供部分支援。目前不支援下列 ERC-1155 事件和方法。
TransferSingle
TransferBatch
ApprovalForAll
URI
safeTransferFrom
balanceOf
setApprovalForAll
isApprovedForAll