結合トークン・フレームワーク・チェーンコード・パッケージ

結合されたトークン・フレームワークでは、ブロックチェーン・アプリケーション・ビルダーでサポートされている拡張ERC-1155標準が使用されます。

NFTアートコレクションマーケットプレイスのサンプルは、結合されたトークン汎用フレームワークの使用を示しています。このサンプルには、アート作品に関連する非代替性トークン(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: チェーンコード内のAPIをテストできるPostmanコレクション。
  • README.mdは、チェーンコードを使用するためのステップバイステップ・ガイドです。

確定可能なトークン・フレームワークを取得するには、Oracle Blockchain Platformデジタル・アセット・コンソールで「デジタル・アセット」タブをクリックし、「結合されたトークン・フレームワーク」を選択します。

Postmanコレクションの使用の詳細については、次のトピックを参照してください。

仕様ファイル

アート・コレクション・マーケットプレイス・チェーンコードの生成に使用される仕様ファイルには、events属性が含まれます。チェーンコード・イベント関数は、生成されたチェーンコードのイベント・コールバックをサポートし、リアルタイム通知を有効にしてワークフローをトリガーします。仕様ファイルおよび仕様ファイルで使用されるパラメータの詳細は、Oracle Blockchain Platformの使用結合トークンの入力仕様ファイルを参照してください。

アート・コレクション・マーケットプレイス・チェーンコードは、次の仕様ファイルに示すように、拡張ERC-1155標準に基づいています。
#
# 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