組合權杖架構鏈碼套件

此組合權杖架構使用區塊鏈 App 產生器支援的延伸 ERC-1155 標準。

NFT Art Collection Marketplace 範例說明合併的單詞通用架構的使用。此範例包含一個鏈碼,代表一個市場,用於購買和銷售與藝術品相關的不可變權杖 (NFT)。在此範例中,NFT 平台提供者在區塊鏈網路中為圖稿薄荷 (建立) NFT 的博物館上架。消費者接著可以使用 Eth 硬幣或 ERC-20 硬幣從博物館購買 NFT。當消費者購買 NFT 時,博物館會將忠誠度權杖授予其有趣的權杖帳戶。消費者也可以經銷 NFT。鏈碼會實作管理權杖生命週期所需的方法,包括權杖初始化、帳戶作業、角色指定、採礦、移轉及燃燒。它還提供核准採礦、移轉及燒錄作業的公證帳戶,並透過每日限制和稽核程序支援合規性。NFT Art Collection Marketplace 範例是專為 TypeScript 中的鏈碼開發所設計。

您可以從 Oracle Blockchain Platform 主控台下載合併的記號架構,並包含下列元件。

  • NFTCollectiblesWithERC1155.zip,包含要部署之封裝鏈碼的封存檔案。
  • NFTCollectiblesWithERC1155-TypeScript.yaml,您可以與區塊鏈應用程式建置器搭配使用的規格檔案,用來編排 NFTCollectiblesWithERC1155 鏈碼。
  • NFTCollectiblesWithERC1155_postman_collection.json 是一種 Postman 集合,可讓您測試鏈碼中的 API。
  • README.md,用於使用鏈碼的逐步指南。

若要取得有趣的記號架構,請在 Oracle Blockchain Platform Digital Assets 主控台中,按一下數位資產頁籤,然後選取組合記號架構

如需有關使用 Postman 集合的詳細資訊,請參閱 Blockchain App Builder for Oracle Blockchain Platform 中的下列主題。

規格檔案

用來產生藝術收藏市集鏈碼的規格檔案包含 events 屬性。鏈碼事件函數支援所產生鏈碼中的事件回呼,以啟用即時通知並觸發工作流程。如需有關規格檔案與規格檔案中所使用參數的詳細資訊,請參閱 Blockchain App Builder for Oracle Blockchain Platform 中的 Input Specification File for Combined Tokens

藝術收藏市集鏈碼是以延伸的 ERC-1155 標準為基礎,如下列規格檔案所示。
#
# Copyright (c) 2026, 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