债券市场链代码包

Oracle Blockchain Platform Digital Assets Edition 包含债券 NFT 市场场景的示例链代码。

债券市场链代码支持管理和交易债券,以小数非同质代币 (NFT) 表示。您可以使用链代码方法在分散的环境中发行、购买、兑换和交易债券 NFT。

可以从 Oracle Blockchain Platform 控制台下载债券市场链代码包,其中包含以下组件。
  • BondMarketplace.zip,包含要部署的打包链代码的归档文件。
  • BondMarketplace.yaml,可与区块链应用程序构建器一起使用的规范文件,用于支持 WholesaleCBDC 链代码。
  • BondMarketplace_postman_collection.json,一个 Postman 集合,允许您测试链代码中的 API。
  • README.md,用于处理链代码的分步指南。

要获取债券市场链代码包,请在 Oracle Blockchain Platform Digital Assets 控制台中单击 Digital Assets 选项卡,然后选择 Bond Marketplace Application

规范文件

债券市场规范文件 (Bond_Marketplace.yml) 基于扩展的 ERC-1155 规范文件。它包含一个 model 属性,用于生成特定于应用程序的链代码。在这种情况下,生成链代码时,model: bond 会为债券市场应用程序创建其他方法。此外,必须在文件的元数据部分中设置特定参数。
#
# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
#
 
# Token asset to manage the complete lifecycle of a Bond in a primary Bond marketplace.  

assets:
    - name: Bond #Asset name
      type: token #Asset type
      standard: erc1155+   # Token standard
      events: true # Supports event code generation for non-GET methods
      model: bond # Supports creation of additional methods for Primary Bond marketplace
      
      anatomy:
          type: nonfungible # Token type
          unit: fractional  #Token unit
      
      behavior: # Bond token behaviors
        - divisible:                                  
        - mintable:                   
        - transferable
        - burnable                
        - roles:
            minter_role_name: minter
            burner_role_name: burner
      
      properties:  # Custom asset attributes for non-fungible Bond token.

          - name: status # Custom asset attribute maintains the status of the Bond.
            type: string
            mandatory: true
               
            
      metadata: # To maintain the metadata on-chain, this tag will be used. Users won't be able to update the metadata attribute values after the bond token is minted.
          
          - name: ISIN # A unique alphanumeric code that identifies a specific bond internationally.
            type: string
            mandatory: true
 
          - name: Segment # The classification of bonds based on issuer type or purpose, such as corporate, government, sovereign, or green bonds.
            type: string
 
          - name: Issuer # The entity, such as a corporation or government, that issues the bond.
            type: string
            mandatory: true
          
          - name: FaceValue # The principal amount of the bond that will be repaid at maturity.
            type: number
            mandatory: true

          - name: IssueSize # The total monetary value or quantity of bonds issued by the issuer.
            type: number
            mandatory: true

          - name: CouponRate # The annual interest rate that the bond pays, typically as a percentage of the face value.
            type: float 
            mandatory: true 

          - name: InterestPaymentType # Specifies whether the bond pays simple or compound interest.
            type: string
            mandatory: true
            validate: /^\\s*(simple)\\s*$/

          - name: InterestFrequency # The regularity with which interest payments are made, such as monthly, quarterly, annually or at maturity.
            type: string
            mandatory: true
            validate: /^\s*["]?((monthly|quarterly|annually|at maturity)\s*)["]?\s*$/

          - name: IssueDate # The date when the bond was initially issued.
            type: date
            mandatory: true 

          - name: MaturityDate # The date on which the bond’s principal amount will be repaid to the bondholder.
            type: date
            mandatory: true    
 
customMethods:

表 4-1 Bond Marketplace 规范文件的元数据参数

进入 说明
name: ISIN

用于标识键的唯一 12 个字符的字母数字代码的字符串。

name: Segment

表示债券的段类型的字符串。

name: Issuer

表示债券签发人的字符串。

name: FaceValue

表示债券代币面值(价格)的数字。

name: IssueSize

表示债券发行规模(总数量)的数字。

name: CouponRate 表示债券的息票利率(利率)的数字。它必须是每年费率。
name: InterestRateType 表示利息付款类型的字符串。唯一支持的值为 simple
name: InterestFrequency 表示债券令牌的兴趣频率的字符串。以下列表显示了支持的值。
  • monthly
  • quarterly
  • annually
  • at maturity
name: IssueDate 代表债券发行日期的日期。
name: MaturityDate 表示债券到期日的日期。