Eingabespezifikationsdatei für ERC-1155
Der Initialisierungsbefehl Blockchain App Builder liest die Eingabespezifikationsdatei und generiert das gerüstete Projekt mit mehreren Tools, um den Chaincode-Entwicklungsprozess zu unterstützen.
Sie können Standardassets und fungible und nicht fungible Tokenassets definieren, die auf dem ERC-1155-Standard in derselben Spezifikationsdatei basieren. Sie können Tokenassets nicht basierend auf mehr als einem Standard in derselben Spezifikationsdatei definieren.
Informationen zum Einschließen von Standardassets in die Spezifikationsdatei finden Sie unter Eingabespezifikationsdatei.
NFTArtCollectionMarketplacewithERC1155-TypeScript.yml
FractionalNFTinRealEstate-TypeScript.yml
Zusätzlich zu den Standardeigenschaften und Abschnitten unterstützen Tokenassets die Abschnitte behavior
und anatomy
in der Spezifikationsdatei. Darüber hinaus unterstützen nicht fungible Tokenassets den Abschnitt metadata
. Das folgende Beispiel zeigt die Struktur einer Spezifikationsdatei für zwei ERC-1155-Token-Assets, ein ganzes nicht fungibles Token und ein fraktioniertes fungibles Token:
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
Das folgende Beispiel zeigt die Struktur einer Spezifikationsdatei für ein fraktioniertes, nicht fungibles Token:
- 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
Tabelle 4-3: Parameterbeschreibungen und Beispiele für eine ERC-1155-Tokenspezifikationsdatei
Eintrag | Beschreibung | Beispiele |
---|---|---|
type: |
Sie müssen |
|
standard: |
Die Eigenschaft standard ist für ERC-1155-Token obligatorisch. Es stellt den Token-Standard dar, der während der Chaincode-Generierung folgen soll.
|
|
anatomy: |
Der Abschnitt
anatomy enthält zwei obligatorische Parameter:
|
|
behavior: |
In diesem Abschnitt werden die Funktionen und Einschränkungen des Tokens beschrieben. Das Verhalten mintable und transferable ist für alle Token obligatorisch. Das Verhalten indivisible ist für ganze nicht fungible Token obligatorisch.
|
|
metadata: |
Die Eigenschaft Im Beispiel ist |
|
Einschränkungen
Blockchain App Builder bietet teilweise Unterstützung für den ERC-1155-Standard. Derzeit werden die folgenden ERC-1155-Ereignisse und -Methoden nicht unterstützt.
TransferSingle
TransferBatch
ApprovalForAll
URI
safeTransferFrom
balanceOf
setApprovalForAll
isApprovedForAll