Creating a Sale

The SALE module defines entry functions that enable the creation, management, and closure of NFT sales, as well as the purchase and withdrawal of proceeds. These functions integrate closely with ART20 NFTs, ensuring proper authorization, deny list checks, and event emission.

create_nft_sale<CURRENCY>(...) Purpose: Initialize a new sale by selecting a batch of NFTs, specifying a fixed price, and linking it to a collection.

Key Parameters:

  • nfts: A vector of NFT objects to be listed.

  • nft_amount: How many NFTs to include in the sale.

  • price_per_nft: The cost of each NFT in the sale.

  • collection_cap: Reference to the collection capabilities (ensuring the caller is the creator or authorized party).

  • ctx: The transaction context.

Process:

  1. Validate that price_per_nft is within allowed limits.

  2. Ensure nft_amount does not exceed batch limits and that the user has sufficient UserBalance.

  3. Lock the NFTs into the sale object and set is_active = true.

  4. Emit a SaleCreated event.

Use Cases:

  • A creator wants to list the first 100 NFTs of their new collection at a fixed price.

  • An artist sets up a single sale object for the entire collection mint.

Last updated