Stablecoin Chaincode-Paket
Die Oracle Blockchain Platform Digital Assets Edition enthält Beispiel-Chaincode für ein Stablecoin-Lebenszyklus-Szenario.
Der Stablecoin Chaincode unterstützt den gesamten Lebenszyklus eines Stablecoins, dargestellt durch ein fungibles Token, das auf dem erweiterten Token Taxonomy Framework-Standard basiert. Mit Chaincode-Methoden können Sie Token mit rollenbasierten Genehmigungen prägen, übertragen, sperren und brennen.
Das Stablecoin Chaincode-Paket kann von der Oracle Blockchain Platform-Konsole heruntergeladen werden und umfasst die folgenden Komponenten.
Stablecoin.zip, eine Archivdatei, die den in einem Package integrierten Chaincode für das Deployment enthält.Stablecoin.yaml, eine Spezifikationsdatei, die Sie mit Blockchain App Builder verwenden können, um denStablecoin-Chaincode zu erstellen.Stablecoin_postman_collection.json, eine Postman-Collection, mit der Sie die APIs im Chaincode testen können.README.md, eine Schritt-für-Schritt-Anleitung zum Arbeiten mit dem Chaincode.
Um das Stablecoin-Chaincode-Paket abzurufen, klicken Sie in der Oracle Blockchain Platform Digital Assets-Konsole auf die Registerkarte Digital Assets, und wählen Sie Stablecoin-Anwendung aus.
Spezifikationsdatei
Die Stablecoin-Spezifikationsdatei (Stablecoin.yml) basiert auf der erweiterten Token Taxonomy Framework-Spezifikationsdatei. Zusätzlich zum Asset stablecoin definiert die Spezifikationsdatei die Assets AccountPolicyCheck, ApprovalPolicyCheck und 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