DEV Community

Medusa Devs for ComposableNFT

Posted on

Introducing ComposableNFT

We developed, used and tested in the last year an implementation of extensions of the already widely used ERC721 and ERC1155 standards for NFT composability.

This architecture is written focusing on gas consumption efficiency.

We decided to open-source it and we would like to introduce it to the community.

These extensions permit the attachment and detachment of ERC1155 component (ERC1155C) tokens to and from ERC721 composable (ERC721C) tokens through the use of simple methods.

Using this implementation there are some properties to keep in mind:

  • attached component tokens cannot be transfered;
  • when a composable token is transfered, all its components get transfered too;
  • a composable token can be transfered only if its contract is approved to transfer its components.

Just think about ERC721C as a box and ERC1155C as its contained tokens, so many type of applications can leverage composable NFTs like games, social virtual realities, licensing systems, etc.

  • Games can use ERC721C tokens to represent characters and ERC1155C for any type of equipment.
  • In social virtual realities ERC721C tokens can represent avatar characters and ERC1155C their accessories.
  • In licensing systems ERC721C tokens can represent the basic subscriptions and ERC1155C its additional packages.

The maximum quantity of components that can be attached to an ERC721C token is settable in the constructor, this argument can be set to 0 to handle unlimited number of components, but this is not recommended.

Three more extensions have been developed to handle more specific cases:

  • ERC721CUniqueComponents:
    ensures that each attached component token is unique;

  • ERC721CCompatibleContracts:
    ensures that only component tokens of specific contracts can be attached;

  • ERC721CMutexComponents:
    ensures that mutually exclusive token cannot be attached.

More info and examples can be found on composablenft.org

Top comments (0)