# Marketplace Module

The marketplace module provides functionality for buying and selling assets in a decentralized manner. Nyvo supports setting up marketplaces for various asset types:



* **NFT Marketplace:** A common use-case where users can list NFTs (Solana SPL standard NFTs) for sale, and others can buy them with SOL or another token. The Nyvo marketplace program will escrow the NFT in a program-owned account (using the Token Program and Associated Token Accounts) and handle the trade securely – ensuring the seller gets paid and the buyer receives the NFT atomically.
* **Fungible Token Exchange:** Alternatively, Nyvo can create a marketplace for fungible tokens or even over-the-counter trades. This might resemble a basic decentralized exchange order book or a simpler listing system (like users post offers to sell X tokens for Y price).
* **Key Accounts:** The program might use a PDA for each listing (derived from a listing ID or the seller’s pubkey + token mint) to store listing info. The advantage of PDAs is determinism – given a seller and an asset, the address of the listing account is known, and the program signs for it.
* **UI Elements:** The front-end includes listing creation forms (to list an item for sale), a browsing interface of current listings, and purchase buttons. When a user initiates a purchase, the front-end constructs a transaction calling the marketplace’s **buy** instruction, including references to the seller’s account, the buyer’s payment account, the mint, and the PDA of the listing. Nyvo’s platform ensures these instructions execute as a single atomic transaction so that payment and item transfer succeed together or fail together.
* **Payments and Fees:** The module likely supports setting a marketplace fee or royalty (which might go to a specified address). As a developer, you can configure the fee percentage. The program then automatically allocates that fee on each sale (e.g., transferring a cut to the marketplace owner’s address). Nyvo abstracts the Solana token program intricacies – e.g. ensuring associated token accounts exist for the buyer and seller, creating them if needed for the token being traded.
* **Extensibility:** You can customize the accepted payment currency (SOL or a stablecoin like USDC), and whether the marketplace is open (anyone can list) or restricted. Because Nyvo provides the audited base code, you can launch a marketplace quickly without worrying about writing escrow logic or token transfers incorrectly.

####
