ERC-721 的輸入規格檔案
Blockchain App Builder 初始化命令會讀取輸入規格檔案,並產生具有數個工具的鷹架式專案,以協助鏈碼開發流程。
您可以在相同的規格檔案中,根據 ERC-721 標準來定義標準資產與變數替代字資產。下列限制適用於包含 ERC-721 權杖資產定義的規格檔案:
- 您無法根據相同規格檔案中的多個標準來定義變數替代字資產。
- 您無法在單一規格檔案中定義多個不可執行的變數替代字資產。
權杖擁有者可以更新不可變權杖資產的自訂屬性值。
如需在規格檔案中包含標準資產的資訊,請參閱輸入規格檔案。
「區塊鏈 App 產生器」套裝程式提供下列 ERC-721 權杖資產的規格檔案範例:
NFTArtCollectionMarketPlace with ERC-721-Typescript.yml
除了標準特性和區段之外,不可變的記號資產還支援規格檔案中的 behavior
、anatomy
和 metadata
區段。不可執行的記號資產也支援 standard
和 symbol
特性。下列範例顯示 ERC-721 權杖資產的規格檔案結構:
assets:
- name: ArtCollection #Asset name
type: token #Asset type
symbol: ART # Token symbol
standard: erc721+ # Token standard
anatomy:
type: nonfungible # Token type
unit: whole #Token unit
behavior:
- indivisible
- singleton
- mintable:
max_mint_quantity: 20000
- transferable
- burnable
- lockable
- roles:
minter_role_name: minter
properties: # Custom asset attributes for non-fungible tokens
- 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
表格 4-2 ERC-721 權杖規格檔案的參數描述與範例
進入 | 描述 | 範例 |
---|---|---|
type: |
您必須在 |
|
symbol: |
symbol 特性代表識別記號合約的符號,例如 ART 。通常符號的長度為 3 到 4 個字元。
|
|
standard: |
standard 特性對於不可行的權杖是必要的。它代表產生鏈碼時要遵循的權杖標準。在 Blockchain App Builder 中,無法驗證的權杖遵循部分版本的 ERC-721 標準。如需詳細資訊,請參閱限制。
|
|
anatomy: |
anatomy 區段具有兩個不可變記號的必要參數:
|
|
behavior: |
本節說明權杖的功能與限制。mintable 、transferable 、singleton 及 indivisible 行為對不可行的記號而言是必要的。
|
|
metadata: |
在範例中, |
|
限制
Blockchain App Builder 為 ERC-721 標準提供部分支援。目前不支援下列 ERC-721 事件與方法。
事件:
event Transfer
event Approval
event ApprovalForAll
方法:
approve
getApproved
setApprovalForAll
isApprovedForAll