Package Chaincode framework token combinato
Il framework di token combinato utilizza lo standard ERC-1155 esteso supportato da Blockchain App Builder.
L'esempio di NFT Art Collection Marketplace illustra l'uso del framework generico token combinato. Il campione include un codice concatenato per rappresentare un mercato per l'acquisto e la vendita di token non fungibili (NFT) associati a opere d'arte. In questo esempio, il fornitore di piattaforme NFT a bordo dei musei che possono coniare (creare) NFT per opere d'arte nella rete blockchain. I consumatori possono quindi acquistare NFT dai musei utilizzando monete Eth o monete ERC-20. Quando i consumatori acquistano NFT, i musei premiano i token fedeltà ai loro conti fungibili. I consumatori possono anche rivendere NFT. Il codice concatenato implementa i metodi necessari per la gestione dei cicli di vita dei token, tra cui l'inizializzazione dei token, le operazioni del conto, le assegnazioni dei ruoli, la coniazione, i trasferimenti e la masterizzazione. Fornisce inoltre conti notarili per l'approvazione delle operazioni di conio, trasferimento e masterizzazione e supporta la conformità attraverso limiti giornalieri e procedure di audit. L'esempio di NFT Art Collection Marketplace è stato progettato per lo sviluppo di codici concatenati in TypeScript.
Il framework di token combinato può essere scaricato dalla console di Oracle Blockchain Platform e include i componenti riportati di seguito.
NFTCollectiblesWithERC1155.zip
, un file di archivio che contiene il codice concatenato per la distribuzione.NFTCollectiblesWithERC1155-TypeScript.yaml
, un file di specifica che è possibile utilizzare con Blockchain App Builder per impiantare il codice concatenatoNFTCollectiblesWithERC1155
.NFTCollectiblesWithERC1155_postman_collection.json
, una raccolta Postman che consente di eseguire il test delle API nel codice concatenato.README.md
, una guida dettagliata per l'utilizzo del codice concatenato.
Per ottenere il framework token fungibile, nella console degli asset digitali di Oracle Blockchain Platform fare clic sulla scheda Asset digitali, quindi selezionare Struttura token combinata.
File specifica
Il file di specifica utilizzato per generare il codice concatenato del marketplace della raccolta arte include l'attributo events
. La funzione eventi codice concatenato supporta i callback degli eventi nei codici concatenati generati per abilitare le notifiche in tempo reale e attivare i flussi di lavoro. Per ulteriori informazioni sui file di specifica e sui parametri utilizzati nei file di specifica, vedere File di specifica di input per i token combinati in Utilizzo di Oracle Blockchain Platform.
#
# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
#
# This specification file is an example how to build any whole combined token application that includes fungible and non-fungible tokens together.
# For a combined token application, art collection marketplace with loyalty token has been used as an example.
# Art collection marketplace is a digital marketplace for buying and selling NFT art that rewards users with fungible loyalty tokens for their participation.
assets:
- name: ArtCollection #Asset name
type: token #Asset type
symbol: ART # Token symbol
standard: erc721+ # Token standard
events: true # Supports event code generation for non-GET methods
anatomy:
type: nonfungible # Token type
unit: whole #Token unit
behavior:
- indivisible
- singleton
- mintable:
max_mint_quantity: 20000
- transferable
- 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: float
- name: On_Sale_Flag # Custom asset attribute to maintain non-fungible token selling status in the marketplace
type: boolean
metadata: # To maintain the metadata on-chain, this tag will be used. Users won't be able to update the metadata attribute values after an NFT is minted.
- name: Painting_Name # Custom asset attribute to represent the title given to a piece of artwork.
type: string
- name: Description # Custom asset attribute to represent a detailed explanation or interpretation of the painting's concept, style, or message.
type: string
- name: Painter_Name # Custom asset attribute to represent the name of the artist who created the painting.
type: string
- name: Loyalty #Asset name
type: token #Asset type
standard: erc1155+ # Token standard
events: true # Supports event code generation for non-GET methods
anatomy:
type: fungible # Token type
unit: fractional #Token unit
behavior: # Token behaviors
- divisible:
decimal: 2
- mintable:
max_mint_quantity: 100000
- transferable
- burnable
- roles:
minter_role_name: minter
properties:
- name: Token_Name # Custom attribute to represent the token name.
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
customMethods:
- executeQuery
- "post(token_id: string, selling_price: number)" # Post the non-fungible token for selling in the marketplace
- "buyWithEthCoin(from_org_id: string, from_user_id: string, to_org_id: string, to_user_id: string, nft_id: string[], loyalty_id: string[], eth_qty: number[], loyalty_reward_quantity: number[])" # Buy the non-fungible token after paying the amount using Eth Coin and receive loyalty points in return