有趣的權杖架構鏈碼套件

有趣的變數替代字架構使用區塊鏈 App 產生器支援的延伸變數替代字分類標準架構標準。

存款權杖範例說明使用有趣的權杖一般架構,此架構是以 Blockchain App Builder 支援的延伸權杖分類架構標準為基礎。此範例代表一個系統,其中保證金記號代表在金融機構持有並由受監管的金融機構發行和管理之 Fiat 貨幣。範例規格檔案會產生起始存款變數替代字、管理帳戶、指派角色,以及完成作業 (例如採礦、移轉及燒錄變數替代字) 的方法。它也提供公證帳戶來核准採礦與移轉、強制遵守帳戶層級的每日限制,以及啟用稽核程序。

您可以從 Oracle Blockchain Platform 主控台下載有趣的權杖架構鏈碼套件,並包含下列元件。
  • DepositToken.zip,包含用於部署之封裝鏈碼的封存檔案。
  • DepositToken.yaml,您可以搭配 Blockchain App Builder 使用以編排 DepositToken 鏈碼的規格檔案。
  • DepositToken_postman_collection.json - Postman 集合,可讓您測試鏈碼中的 API。
  • README.md - 使用鏈碼的逐步指南。

若要取得有趣的權杖架構,請在 Oracle Blockchain Platform Digital Assets 主控台中,按一下數位資產頁籤,然後選取有趣的權杖架構

如需有關使用 Postman 集合的詳細資訊,請參閱 Blockchain App Builder for Oracle Blockchain Platform 中的下列主題。

規格檔案

用來產生保證金權杖鏈碼的規格檔案包含 events 屬性。鏈碼事件功能支援所產生鏈碼中的事件回呼,以啟用即時通知並觸發工作流程。如需有關規格檔案與規格檔案中所使用參數的詳細資訊,請參閱使用 Oracle Blockchain Platform 中的輸入規格檔案 (適用於有趣的權杖)

存款變數替代字鏈碼是以延伸的「變數替代字分類標準架構」標準為基礎,並具有支援應用程式案例的自訂項目。若要啟用這些自訂項目,規格檔案的下列行為區段是必要的。
behavior: # Token behaviors
    - divisible:
          decimal: 2
    - mintable:
          mint_approval_required: true
    - transferable
    - burnable
    - holdable
    - roles:
          minter_role_name: minter
          notary_role_name: notary
          mint_approver_role_name: notary
下列代碼是保證金變數替代字樣本的規格檔案。
#
# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
#
 
assets:
 
# This specification file is an example how to build any fungible token application.
# For a fungible token application, deposit token system has been used as an example.
# Deposit token is a digital representation of deposits held at commercial banks, enabling transactions on blockchain networks while maintaining the value and stability of traditional bank deposits.
 
 
    - name: Deposit # Asset name
      type: token  # Asset type
      standard: ttf+   # 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:
                mint_approval_required: true
          - transferable 
          - holdable
          - burnable
          - roles:
                minter_role_name: minter
                notary_role_name: notary
                mint_approver_role_name: notary
 
 
      properties:
          - name: Token_Name # Custom attribute to represent the deposit 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:

鏈碼方法中的背書人明細

Oracle Blockchain Platform Digital Assets Edition 會為所有 setter 方法的要求有效負載新增背書參數。參數的值為 endorserssameOrgEndorser。如果 sameOrgEndorser 參數為 true,則交易背書必須來自與要求者相同的組織。endorsers 參數會指定必須為交易背書的對等清單。如需詳細資訊,請參閱 Oracle Blockchain Platform 區塊鏈 App 產生器中的 Endorsement Support in Postman Collections 。下表顯示每個方法的背書人類型。

方法 背書人類型
activateAccount endorsers
addTokenAdmin sameOrgEndorser
addTokenAuditor sameOrgEndorser
addOrgAdmin sameOrgEndorser
addOrgAuditor sameOrgEndorser
addRole endorsers
approveMint sameOrgEndorser
executeHoldTokens endorsers
associateTokenToAccount endorsers
createAccount endorsers
getAccount endorsers
getAccountBalance endorsers
getAccountsByUser endorsers
getAccountTransactionHistory endorsers
getAccountTransactionHistoryWithFiltersFromRichHistDB endorsers
getNetTokens endorsers
getOnHoldIds endorsers
getTotalMintedTokens endorsers
getUserByAccountId endorsers
getUsersByRole endorsers
holdTokens endorsers
init endorsers
initializeDepositToken sameOrgEndorser
issueTokens sameOrgEndorser
rejectMint sameOrgEndorser
releaseHoldTokens endorsers
removeTokenAdmin sameOrgEndorser
removeTokenAuditor sameOrgEndorser
removeOrgAdmin sameOrgEndorser
removeOrgAuditor sameOrgEndorser
removeRole endorsers
requestMint sameOrgEndorser
burnTokens sameOrgEndorser
setMaxDailyAmount endorsers
setMaxDailyTransactionCount endorsers
suspendAccount endorsers
transferTokens endorsers
initializeExchangePoolUser sameOrgEndorser
createExchangePoolAccounts sameOrgEndorser
addConversionRate sameOrgEndorser
updateConversionRate sameOrgEndorser
mintWithFundingExchangePool sameOrgEndorser
tokenConversion endorsers
getConversionRate endorsers
getConversionHistory endorsers
getConversionRateHistory endorsers
getExchangePoolUser endorsers
getAccountOnHoldBalance endorsers
getAccountStatus endorsers
getAccountsByRole endorsers