Product management

Product Account: Monetizable Data Structure

The Productarrow-up-right data structure encapsulates key details of digital products. It includes seller identity or product authority, a split unique identifier, the marketplace to which it belongs and payment details like price and payment mint.

  • Init productarrow-up-right: The main validation done during this instructions is checking if the user holds the access mint to be able to list products, in case of a token-gate marketplace.

  • Init product treearrow-up-right: It creates a merkle tree for cNFTs and a metaplex master editon to be able to fetch cNFTs from different merkle trees.

  • Edit productarrow-up-right: Product authority can change payment mint, product price and update the merkle tree (but planning to delete the constraint to allow anyone or marketplace authority to update those trees for the seller).

These register buy instructions handles multiple transfers: payment and optional fees and rewards.

  • Register buy with tokenarrow-up-right: Mints a fungible token representing the product purchase, the product pda is the mint authority, only calling this instruction and paying users receive this token.

  • Register buy with cNFTarrow-up-right: Similar to the previous option but the user receives a cNFT, as the user does not need an ATA is cheaper, but the seller has to pay upfront for the merkle tree.

  • Register buyarrow-up-right: The indexing strategy with this instruction is using a payment pda as an account input, in this case is not initialized:

#[account(
    mut,
    seeds = [
        b"payment".as_ref(),
        signer.key().as_ref(),
        product.key().as_ref(),
    ],
    bump,
)]
pub payment: Account<'info, Payment>,
  • Register buy with counterarrow-up-right: In this case the Payment account is initialized and just holds the authority and a counter, representing the units purchased of that product by that signer.

Last updated