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 Digital Assets 콘솔에서 디지털 자산 탭을 클릭한 다음 Stablecoin 애플리케이션을 선택합니다.

사양 파일

Stablecoin 사양 파일 (Stablecoin.yml)은 확장 된 토큰 분류법 프레임워크 사양 파일을 기반으로합니다. 사양 파일은 stablecoin 자산 외에도 AccountPolicyCheck, ApprovalPolicyCheckApprovalTransactions 자산을 정의합니다.
#
# 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