Skip to content

Semi fungible tokens support (ERC1155 equivalent) #2839

Closed
@MarvinJanssen

Description

@MarvinJanssen

(Is this better at home in https://github.com/clarity-lang/reference/issues?)

It is amazing that Clarity has built-in support for fungible and non-fungible tokens. However, the intermediary semi-fungible token (or "multi token") is missing.

A semi-fungible token has both an ID and a supply. The equivalent Ethereum standard is ERC1155 / EIP1155: https://eips.ethereum.org/EIPS/eip-1155.

A straightforward way to mentally picture the use of semi-fungible tokens is to consider digital trading cards or in-game items: not all trading cards are the same, but there might be more than one of a particular kind. (Each with their own supply and rarity.)

Granted, you could just define fungible tokens and deploy a new contract for each new type but this is more prohibitive for apps / games that require many different items to be represented on-chain. With a semi-fungible, all it would take is a contract call. Another upside is programmatic / VRF generation of new tokens types and supplies. But it is not limited to applications of this kind, art NFTs can benefit by being able to mint a series or editions of a particular piece. Having a semi-fungible token type also allows for easier creation of bulk mint & transfer actions that aid scalability.

One can likely jerry-rig existing built-ins and use data maps to achieve the same result but then we lose out on native events and post conditions.

The function signatures for semi fungibles could look like this:

(define-semi-fungible-token asset-name asset-identifier-type)
(sft-mint? asset-name asset-identifier amount recipient)
(sft-transfer? asset-name asset-identifier amount sender recipient)
;; And so on...

Posting to hopefully open a discussion on the usefulness of such a token.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions