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

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

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

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

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

指定ファイル

安定コイン仕様ファイル(Stablecoin.yml)は、拡張トークン・タクソノミ・フレームワーク仕様ファイルに基づいています。仕様ファイルでは、stablecoinアセットに加えて、TransferRestrictionアセットのAccountPolicyCheckApprovalPolicyCheckおよびApprovalTransactionsを定義します。
#
# Copyright (c) 2026, 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

# AccountPolicyCheck — Defines policies for an account to decide whether an account is eligible to transact

    - name: AccountPolicyCheck # Asset name

      properties: # Asset attributes 

          - name: accountPolicyId   #Unique derived ID for the account policy, ensuring one policy per account. 
            type: string
            mandatory: true
            id: true
            derived:
              strategy: concat
              format: ["APID~%1~%2","orgId","userId"]

          - name: orgId             # Organization owning the account. 
            type: string
            mandatory: true
            validate: required()

          - name: userId           # Account holder identifier linked to this policy.
            type: string
            mandatory: true
            validate: required()

          - name: kycCompliance    # Indicates whether KYC verification is complete. Required for transaction eligibility. If true, the account can transfer stablecoins.  
            type: string
            validate: /^\s*(true|false)\s*$/
            mandatory: true            

          - name: amlCompliance    # Indicates AML screening status. Prevents suspicious accounts from transacting. If true, the account can transfer stablecoins.
            type: string
            validate: /^\s*(true|false)\s*$/
            mandatory: true

          - name: riskScore       # Quantitative risk indicator.
            type: float
            validate: min(0)

          - name: restrictionFlag   #Transaction blocking flag. If true, hold operations are limited to the lowest bucket range defined in the approval policy, and any amount above that range is rejected; 
                                    #for transfer operations, the account can transfer only within the bucket limits specified in the TransferRestriction asset.
            type: string
            validate: /^\s*(true|false)\s*$/ 
            mandatory: true

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


# ApprovalPolicyCheck — Maps transaction amount slabs to approval rules

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

          - name: approvalPolicyId               # Unique derived identifier for each approval slab based on amount range.
            type: string
            mandatory: true
            id: true
            derived:
              strategy: concat
              format: ["GPID~%1~%2","transactionLowerLimit","transactionUpperLimit"]

          - name: transactionLowerLimit         # Minimum transaction amount where this rule applies.
            type: float
            validate: min(0)
            mandatory: true

          - name: transactionUpperLimit         # Maximum transaction amount covered by this rule.
            type: float
            validate: min(0)
            mandatory: true

          - name: numberOfApprovalsRequired     # Total approvals needed for transactions in this range.
            type: number
            mandatory: true
            validate: min(0)

          - name: approverDetails               # List of authorized approvers and their sequence for this slab.
            type: approverDetails[]
 

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

# ApproverDetails (Embedded) — Defines the list of approvers along with the approval sequences

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

          - name: approverOrgId       # Organization to which the approver belongs.
            type: string
            mandatory: true
            validate: required()

          - name: approverUserId      # Specific user authorized to approve. 
            type: string
            mandatory: true
            validate: required()

          - name: approvalSequence    # Order of approval when sequential approvals are enforced.
            type: number
            mandatory: true
            validate: positive()

# ApprovalTransactions — Tracks approval progress for a specific operation            

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

          - name: approvalTransactionId    # Unique ID for each approval action tied to operation and approver.
            type: string
            mandatory: true
            id: true
            derived:
              strategy: concat
              format: ["%1~%2~%3","approvalOperationId","approverOrgId", "approverUserId"]

          - name: approvalOperationId      # Identifier of the original transaction requiring approval.
            type: string
            mandatory: true

          - name: fromAccountId            # Source account involved in the operation.
            type: string  
            mandatory: true

          - name: toAccountId              # Destination account for the operation.
            type: string
            mandatory: true

          - name: approverOrgId            # Organization of the approver performing the action.
            type: string
            mandatory: true   

          - name: approverUserId           # User who approved the operation.
            type: string
            mandatory: true               

          - name: receivedApprovalsCount   # Number of approvals completed so far.
            type: number 
            mandatory: true 
            validate: min(0)

          - name: requiredApprovalsCount   # Total approvals needed before execution.
            type: number 
            mandatory: true 
            validate: min(0)            

          - name: timestamp                # Time when the approval was recorded for audit traceability.
            type: string 
            mandatory: true             

      methods:
          crud: [getById ]
          others: []

# TransferRestriction — Defines global transaction boundaries          

    - name: TransferRestriction # Asset name
      
      properties: # Asset attributes 

          - name: id                        # Unique identifier for the restriction rule.
            type: string
            mandatory: true
            id: true

          - name: transactionLowerLimit    # Smallest allowable transfer amount in the system.
            type: number
            mandatory: true
            default: 0
            validate: min(0)  

          - name: transactionUpperLimit    # Largest allowable transfer amount without special governance.
            type: number  
            mandatory: true  
            default: 1000000
            validate: min(0)            

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

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