Skip to main content

🖼️ Marketplace

Simple Summary

NFTs represent proof of ownership on the blockchain. Creators need a way to group NFTs in a higher order entity. This entity is a collection. If a collection is created, NFTs can be put in it at its creation or after. Marketplaces are entities used, primarily, to sell and buy NFTs. A marketplace's ownership and rules are also defined by the chain.

Abstract

In the objective of seeling and buying NFTs, we created the marketplace entity. Each user can create his own marketplace and define rules that apply to who can put on sale, what is the listing (putting on sale) cost and what is the commission fee. This document descrive the motivation and specification of the marketplace entity.

🎯 Motivation

The main objective of marketplaces is to have a support / media to exchange NFTs other than plain P2P transfer. Having marketplaces allows user to define price for their NFTs. Those NFTs can be art, gaming items, tickets or any asset that can be represneted by a digital entity.

🌊 Workflows

Creating a marketplace

The following is the workflow proposed for creating a marketplace:

  1. User create the marketplace specifying the kind.
  2. User retrieves the marketplace id.
Transferring a marketplace ownership

The following is the workflow proposed for transferring a marketplace ownership:

  1. User has already created a marketplace and knows its id.
  2. User calls the "set_marketplace_owner" function with the address of the recipient.
  3. The recipient is now the owner of the marketplace.
Changing the kind/type of a marketplace

The following is the workflow proposed for changing the kind / type of a marketplace:

  1. User has already created a marketplace and knows its id.
  2. User calls the "set_marketplace_kind" specifying private of public.
  3. The marketplace is now private or public. The account_list is respectively an allow list or ban list.
Changing the comission fee to a pecentage

The following is the workflow proposed for changing the commission fee to a percentage:

  1. User has already created a marketplace and knows its id.
  2. User calls the "set_marketplace_configuration" function with the parameters (Set(Percentage(200000)), NoOp, NoOp, NoOp).
  3. The commission fee is now changed to 20% while other values did not.
Changing the listing_fee to a flat amount of token

The following is the workflow proposed for changing the listing_fee to a flat amount of token:

  1. User has already created a marketplace and knows its id.
  2. User calls the "set_marketplace_configuration" function with the parameters (NoOp, Set(Flat(10_000_000_000_000_000_000)), NoOp, NoOp).
  3. The listing_fee is now changed to 10 CAPS while other values did not change.
Removing the listing_fee

The following is the workflow proposed for removing the listing_fee:

  1. User has already created a marketplace and knows its id.
  2. User calls the "set_marketplace_configuration" function with the parameters (NoOp, Remove, NoOp, NoOp).
  3. The listing_fee is now removed.
Setting the account_list

The following is the workflow proposed for setting the account_list:

  1. User has already created a marketplace and knows its id.
  2. User calls the "set_marketplace_configuration" function with the parameters (NoOp, NoOp, Set(BoundedVec::try_from(vec![5CDG..., 5Haz...])), NoOp).
  3. The account_list is now set.
Setting offchain data

The following is the workflow proposed for setting offchain data:

  1. User has already created a marketplace and knows its id.
  2. User prepares the metadata file in JSON format.
  3. User uploads it on IPFS retrieving the CID.
  4. User calls the "set_marketplace_configuration" function with the parameters (NoOp, NoOp, NoOp, Set(CID)).
  5. The marketplace has offchain data set.
Listing an NFT

The following is the workflow proposed for listing an NFT:

  1. User has already created an NFT and knows its id.
  2. User knows the marketplace id on which he wants to list.
  3. User calls the "list_nft" function with the nft id, the marketplace id and the price.
  4. The NFT is now listed on the specified marketplace.
Unlisting an NFT

The following is the workflow proposed for unlisting an NFT:

  1. User has already created and listed an NFT and knows its id.
  2. User calls the "unlist_nft" function with the nft id.
  3. The NFT is now unlisted.
Buying an NFT

The following is the workflow proposed for buying an NFT:

  1. User knows the NFT he wants to buy.
  2. User has enough funds to buy the NFT.
  3. User calls the "buy_nft" function with the nft id.
  4. The NFT is now owned by the buyer.