DEV Community

Medusa Devs for ComposableNFT

Posted on

1

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

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay