ERC-1155 입력 사양 파일

Blockchain App Builder 초기화 명령은 입력 사양 파일을 읽고 체인 코드 개발 프로세스를 지원하는 몇 가지 도구를 사용하여 비계 프로젝트를 생성합니다.

동일한 사양 파일에서 ERC-1155 표준을 기반으로 하는 표준 자산과 대체 가능 및 비정확 토큰 자산을 모두 정의할 수 있습니다. 동일한 사양 파일에서 둘 이상의 표준을 기반으로 토큰 자산을 정의할 수 없습니다.

사양 파일에 표준 자산을 포함하는 방법에 대한 자세한 내용은 입력 사양 파일을 참조하십시오.

ERC-1155 토큰 자산에 대한 다음 샘플 사양 파일은 Blockchain App Builder 패키지에서 사용할 수 있습니다.
  • NFTArtCollectionMarketplacewithERC1155-TypeScript.yml
  • FractionalNFTinRealEstate-TypeScript.yml

표준 등록 정보 및 섹션 외에도 토큰 자산은 사양 파일에서 behavioranatomy 섹션을 지원합니다. 또한 사용할 수 없는 토큰 자산은 metadata 섹션을 지원합니다. 다음 예에서는 두 개의 ERC-1155 토큰 자산에 대한 사양 파일 구조, 전체 비정지 토큰 및 소수 대체 가능 토큰을 보여 줍니다.

assets:
    - name: ArtCollection #Asset name
      type: token #Asset type
      standard: erc1155+   # Token standard
      
      anatomy:
          type: nonfungible # Token type
          unit: whole  #Token unit
      
      behavior:
        - indivisible                
        - mintable:                   
            max_mint_quantity: 20000
        - transferable                
        - burnable
        - lockable
        - roles:
            minter_role_name: minter
      
      properties:  # Custom asset attributes for non-fungible token 
          
          - name: price # Custom asset attribute to set the price of a non-fungible token in the marketplace
            type: number
          
          - name: on_sale_flag # Custom asset attribute maintains non-fungible token selling status in the marketplace
            type: boolean
      
      metadata: #  Use this section to maintain the metadata on the blockchain. Only the user creating the non-fungible token can assign metadata attribute values, which cannot be updated later.
          
          - name: painting_name
            type: string
          
          - name: description
            type: string
          
          - name: image
            type: string
          
          - name: painter_name
            type: string

    - name: Loyalty # Asset name
      type: token  # Asset type
      standard: erc1155+   # Token standard

      anatomy: 
          type: fungible # Token type
          unit: fractional # Token unit

      behavior: # Token behaviors
          - divisible: 
                decimal: 2  
          - mintable: 
                max_mint_quantity: 10000 
          - transferable
          - burnable 
          - roles: 
                minter_role_name: minter 

      properties:
          - name: currency_name # Custom attribute to represent the token in a specific currency.
            type: string

          - name: token_to_currency_ratio # Custom attribute to specify the token to currency ratio.
            type: number

다음 예에서는 소수 자릿수가 아닌 토큰에 대한 사양 파일의 구조를 보여 줍니다.

- name: RealEstateProperty #Asset name
      type: token #Asset type
      standard: erc1155+ # Token standard
      
      anatomy:
          type: nonfungible # Token type
          unit: fractional #Token unit
      
      behavior:
        - divisible:
        - mintable:
        - transferable
        - roles:
            minter_role_name: minter
      
      properties: # Custom asset attributes for non-fungible token.
          
          - name: propertySellingPrice # Custom asset attribute to set the real estate property selling price
            type: number
 
          - name: propertyRentingPrice # Custom asset attribute maintains the renting amount for the real estate property
            type: number
            
      metadata: # To maintain the metadata on-chain, this tag will be used. Users won't be able to update the metadata attribute values.
          
          - name: propertyType
            type: string
 
          - name: propertyName
            type: string
 
          - name: propertyAddress
            type: string
          
          - name: propertyImage
            type: string

표 7-7 ERC-1155 토큰 사양 파일에 대한 매개변수 설명 및 예

항목 설명
type:

assets 섹션에 type: token를 지정해야 합니다.

assets:
    - name: ArtCollection #Asset name
      type: token #Asset type
standard: ERC-1155 토큰의 경우 standard 속성은 필수입니다. 체인코드 생성 중 따라야 할 토큰 표준을 나타냅니다.
standard: erc1155+ # Token standard
anatomy:
anatomy 섹션에는 두 개의 필수 매개변수가 있습니다.
  • type: nonfungible 또는 type: fungible

    사용할 수 없는 토큰은 고유합니다.

  • unit: whole 또는 unit: fractional

    전체 토큰은 작은 소수 단위로 세분화할 수 없습니다. 소수점 토큰은 지정된 소수점 자릿수에 따라 더 작은 단위 또는 공유로 세분화할 수 있습니다.

anatomy:
          type: nonfungible # Token type
          unit: whole #Token unit
behavior: 이 절에서는 토큰의 기능 및 제한 사항에 대해 설명합니다. 모든 토큰에 대해 mintable, transferable 동작은 필수입니다. indivisible 동작은 완전히 사용할 수 없는 토큰에 대해 필수입니다.
  • indivisible: 이 동작은 전체 토큰을 분수로 나눌 수 없도록 제한을 지원합니다.
  • divisible: 이 동작은 토큰을 세분화하는 방법에 대해 설명합니다. decimal 매개변수는 사용할 수 있는 소수점 자리 수를 지정합니다. 소수 자릿수로 가능한 가장 작은 분수는 소유할 수 있는 토큰의 가장 작은 단위입니다. decimal 매개변수가 지정되지 않은 경우 기본값은 0 소수점 자리입니다.
  • mintable: 이 필수 동작은 새 토큰 인스턴스 민트를 지원합니다. 선택적 max_mint_quantity 매개변수는 조인할 수 있는 총 토큰 수를 지정합니다. max_mint_quantity 매개변수를 지정하지 않으면 원하는 수의 토큰을 연동할 수 있습니다.
  • transferable: 이 필수 동작은 토큰 소유권 이전을 지원합니다.
  • burnable: 이 동작은 토큰 비활성화 또는 레코딩을 지원합니다. 레코딩은 토큰을 삭제하지 않고 대신 사용할 수 없는 영구 상태에 놓습니다. 불타는 것은 되돌릴 수 없다.
  • lockable: 이 동작은 선택사항이며 사용할 수 없는 토큰에서만 지원됩니다. 이 동작을 통해 토큰 소유자는 사용할 수 없는 토큰을 잠글 수 있습니다. 잠긴 토큰은 다른 사용자에게 전송하거나 레코딩할 수 없습니다.
  • roles: 이 동작은 토큰 동작을 특정 역할을 가진 사용자로 제한합니다. 현재 minter_role_nameburner_role_name 역할을 사용할 수 있습니다. 역할을 지정하지 않으면 모든 사용자가 채굴자 또는 버너 역할을 할 수 있습니다. 예를 들어, 버너 역할이 지정되지 않은 경우 모든 계정 사용자는 암시적으로 버너 역할을 가집니다. 버너 역할이 지정된 경우 토큰 설정 프로세스 중 Token Admin 사용자는 버너 역할을 명시적으로 다른 사용자에게 지정해야 합니다.
behavior:
        - indivisible
        - mintable:
            max_mint_quantity: 20000
        - transferable
        - burnable
        - lockable
        - roles:
            minter_role_name: minter
metadata:

metadata 등록 정보는 선택 사항이며 사용할 수 없는 토큰에서만 지원됩니다. 이 속성은 블록 체인에 저장되는 메타데이터 정보를 변경할 수 없는 토큰에 대해 지정합니다. 메타데이터 속성 값은 토큰을 채우는 토큰 소유자만 지정할 수 있으며, 토큰이 조인된 후에는 업데이트할 수 없습니다.

예제에서 name는 메타 데이터 속성의 이름이고 type는 속성에 포함된 값의 유형입니다.

metadata:
                                
                                - name: painting_name
                                type: string
                                
                                - name: description
                                type: string
                                
                                - name: image
                                type: string
                                
                                - name: painter_name
                                type: string

제한

Blockchain App Builder는 ERC-1155 표준을 부분적으로 지원합니다. 현재 다음의 ERC-1155 이벤트 및 메서드는 지원되지 않습니다.

이벤트:
  • TransferSingle
  • TransferBatch
  • ApprovalForAll
  • URI
메소드:
  • safeTransferFrom
  • balanceOf
  • setApprovalForAll
  • isApprovedForAll