File specifica di input per ERC-1155
Il comando di inizializzazione Blockchain App Builder legge il file di specifica di input e genera il progetto impalcato con diversi strumenti per assistere nel processo di sviluppo del codice concatenato.
È possibile definire cespiti standard e asset token fungibili e non fungibili basati sullo standard ERC-1155 nello stesso file di specifica. Impossibile definire asset token in base a più standard nello stesso file di specifica.
Per informazioni sull'inclusione degli asset standard nel file di specifica, vedere File di specifica di input.
NFTArtCollectionMarketplacewithERC1155-TypeScript.yml
FractionalNFTinRealEstate-TypeScript.yml
Oltre alle proprietà e alle sezioni standard, gli asset token supportano le sezioni behavior
e anatomy
nel file di specifica. Inoltre, gli asset token non fungibili supportano la sezione metadata
. L'esempio seguente mostra la struttura di un file di specifica per due asset token ERC-1155, un token intero non fungibile e un token fungibile frazionario:
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
L'esempio seguente mostra la struttura di un file di specifica per un token non fungibile frazionario:
- 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
Tabella 7-7 Descrizioni ed esempi dei parametri per un file di specifica token ERC-1155
Voce | Descrizione | Esempi |
---|---|---|
type: |
È necessario specificare |
|
standard: |
La proprietà standard è obbligatoria per i token ERC-1155. Rappresenta lo standard token da seguire durante la generazione del codice concatenato.
|
|
anatomy: |
La sezione
anatomy contiene due parametri obbligatori:
|
|
behavior: |
Questa sezione descrive le capacità e le limitazioni del token. I comportamenti mintable e transferable sono obbligatori per tutti i token. Il comportamento indivisible è obbligatorio per tutti i token non fungibili.
|
|
metadata: |
La proprietà Nell'esempio, |
|
Limiti
Blockchain App Builder fornisce supporto parziale per lo standard ERC-1155. Attualmente, i seguenti eventi e metodi ERC-1155 non sono supportati.
TransferSingle
TransferBatch
ApprovalForAll
URI
safeTransferFrom
balanceOf
setApprovalForAll
isApprovedForAll