Stablecoinチェーンコードパッケージ

Oracle Blockchain Platform Digital Assets Editionには、stablecoinライフサイクル・シナリオ用のサンプル・チェーンコードが含まれています。

stablecoinチェーンコードは、拡張されたトークンタクソノミ・フレームワーク標準に基づく真菌性トークンによって表される、stablecoinの完全なライフサイクルをサポートします。チェーンコード・メソッドを使用して、ロールベースの承認でトークンをミント、転送、保持および書き込むことができます。

stablecoinチェーンコード・パッケージは、Oracle Blockchain Platformコンソールからダウンロード可能で、次のコンポーネントが含まれています。
  • Stablecoin.zip: デプロイメント用のパッケージ・チェーンコードを含むアーカイブ・ファイル。
  • Stablecoin.yaml。ブロックチェーン・アプリケーション・ビルダーでStablecoinチェーンコードをスキャフォールドするために使用できる仕様ファイルです。
  • Stablecoin_postman_collection.jsonは、チェーンコード内のAPIをテストできるPostmanコレクションです。
  • README.mdは、チェーンコードを使用するためのステップバイステップ・ガイドです。

stablecoinチェーンコード・パッケージを取得するには、Oracle Blockchain Platformデジタル・アセット・コンソールで「デジタル・アセット」タブをクリックし、「Stablecoinアプリケーション」を選択します。

仕様ファイルまたは

stablecoin仕様ファイル(Stablecoin.yml)は、拡張されたトークン・タクソノミ・フレームワーク仕様ファイルに基づいています。stablecoinアセットに加えて、仕様ファイルはAccountPolicyCheckApprovalPolicyCheckおよびApprovalTransactionsアセットを定義します。
#
# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 
#

assets:

# Token asset to manage the complete lifecycle of stablecoin

    - name: stablecoin # Asset name
      type: token # Asset type
      standard: ttf+   # Token standard

      anatomy:
          type: fungible # Token type 
          unit: fractional # Token unit

      behavior: # Token behaviors
          - divisible:
                decimal: 2 
          - mintable: 
                mint_approval_required: true  
          - transferable 
          - burnable:
                burn_approval_required: true 
          - holdable
          - roles:
                minter_role_name: minter
                burner_role_name: burner
                notary_role_name: notary
                mint_approver_role_name: notary
                burn_approver_role_name: notary 

      properties: # Custom asset attributes for stablecoin

          - name: currencyName # The currency name that the stablecoin is pegged with
            type: string
            mandatory: true

          - name: conversionRate # The currency to stablecoin conversion rate
            type: float
            mandatory: true

# Generic asset to maintain the account policy and approval policy details

    - name: AccountPolicyCheck # Asset name

      properties: # Asset attributes 

          - name: accountPolicyId
            type: string
            mandatory: true
            id: true
            derived:
              strategy: concat
              format: ["APID~%1~%2","orgId","userId"]

          - name: orgId
            type: string
            mandatory: true
            validate: required()

          - name: userId
            type: string
            mandatory: true
            validate: required()

          - name: kycCompliance  
            type: string
            validate: /^\s*(true|false)\s*$/
            mandatory: true            

          - name: amlCompliance 
            type: string
            validate: /^\s*(true|false)\s*$/
            mandatory: true

          - name: riskScore 
            type: float
            validate: min(0)

          - name: restrictionFlag 
            type: string
            validate: /^\s*(true|false)\s*$/ 
            mandatory: true

      methods:
          crud: [create, update, getById, delete]
          others: [getHistoryById, getByRange]  

    - name: ApprovalPolicyCheck # Asset name
      
      properties: # Asset attributes 

          - name: approvalPolicyId
            type: string
            mandatory: true
            id: true
            derived:
              strategy: concat
              format: ["GPID~%1~%2","transactionLowerLimit","transactionUpperLimit"]

          - name: transactionLowerLimit
            type: string
            validate: required()

          - name: transactionUpperLimit
            type: string
            validate: required()

          - name: numberOfApprovalsRequired
            type: number
            mandatory: true
            validate: min(0)

          - name: approverDetails
            type: approverDetails[]
 

      methods:
          crud: [create, update, getById, delete]
          others: [getHistoryById, getByRange]    

    - name: approverDetails # Asset name
      type: embedded
      properties: # Asset attributes 

          - name: approverOrgId  
            type: string
            mandatory: true
            validate: required()

          - name: approverUserId  
            type: string
            mandatory: true
            validate: required()

          - name: approvalSequence  
            type: number
            mandatory: true
            validate: positive()

    - name: ApprovalTransactions # Asset name
      
      properties: # Asset attributes 

          - name: approvalTransactionId
            type: string
            mandatory: true
            id: true
            derived:
              strategy: concat
              format: ["%1~%2","approvalOperationId","approverAccountId"]

          - name: approvalOperationId
            type: string
            mandatory: true

          - name: fromAccountId
            type: string  
            mandatory: true

          - name: toAccountId
            type: string
            mandatory: true

          - name: approverAccountId
            type: string
            mandatory: true   

          - name: totalApprovals
            type: number 
            mandatory: true 
            validate: min(0)

          - name: timestamp
            type: string 
            mandatory: true             

      methods:
          crud: [getById ]
          others: []
          
customMethods:

  - "getApproverDetailsByTransferAmount(Amount: number)" # Customized method for fetching approver details