有趣的權杖架構鏈碼套件

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

存款變數替代字範例說明使用有趣的變數替代字一般架構,此架構是根據區塊鏈應用程式產生器支援的延伸變數替代字分類標準架構標準。此範例代表一個系統,其中存款權杖代表金融機構持有且由受管制金融機構核發與管理的法定貨幣。範例規格檔案會產生初始化保證金權杖、管理帳戶、指派角色以及執行作業 (例如採礦、移轉和燒錄權杖) 的方法。它也提供核准採礦與移轉的公證帳戶、強制遵守帳戶層級的每日限制,以及啟用稽核程序。

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

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

規格檔案

用來產生保證金權杖鏈碼的規格檔案包含 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) 2024, 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 參數指定必須為交易背書的對等項目清單。如需詳細資訊,請參閱 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