Skip to content

The provided code represents a robust Solana program that powers a decentralised NFT marketplace. This program facilitates secure and transparent NFT trading within the Solana network. Below, you'll find an overview of the program's core instructions.

Notifications You must be signed in to change notification settings

savvycodings/marketplace_solana_2023

Repository files navigation

Solana Marketplace Program

The provided code represents a robust Solana program that powers a decentralised NFT marketplace. Leveraging the capabilities of Solana's blockchain infrastructure, this program facilitates secure and transparent NFT trading within the Solana network. Below, you'll find an overview of the program's core instructions.

The process begins with the initialization of a new marketplace. We then enable the whitelisting of NFT assets based on their collection ID, allowing users to list NFTs from these collections using the 'create_listing' and 'deposit_nft' instructions. If a user wishes to cancel their listing, they can utilize the 'withdraw_nft' instruction, followed by 'close_vault' to retrieve their funds from the opened vault.

When a user purchases an NFT, we execute multiple actions. We send SOL tokens to the NFT maker and deposit fees into the treasury account. Simultaneously, we transfer the NFT to the buyer, mint rewards tokens for the buyer, and eventually close the vault. This comprehensive process ensures a secure and transparent NFT trading experience on the Solana network.

Table of Contents

  • [Introduction]
  • [Instructions]
    • [Initialize]
    • [WhitelistCollection]
    • [Purchase]
    • [List]
    • [Delist]

Introduction

This Solana program serves as the backbone of a decentralized marketplace, enabling the seamless exchange of NFTs and SOL tokens within the Solana ecosystem. It delivers a secure and efficient environment for users to interact with NFTs while taking full advantage of Solana's high-performance blockchain technology.

Initialize

The Initialize instruction is used to set up the initial parameters of the Solana Marketplace.

  • admin: The signer responsible for initializing the marketplace.
  • marketplace: Account for managing the marketplace state. It is initialized with a unique seed based on the provided name.
  • rewards: Account representing the rewards associated with the marketplace.
  • treasury: System account responsible for managing funds.
  • token_program: Program for token management.
  • system_program: Program for system-level operations.

WhitelistCollection

The WhitelistCollection instruction is used to whitelist a collection of NFTs within the marketplace. It sets the bump value for the whitelist account.

  • admin: The signer initiating the whitelisting.
  • marketplace: Account representing the marketplace.
  • mint: Account representing the NFT mint.
  • whitelist: Whitelist account for storing whitelist information.
  • system_program: Program for system-level operations.

Purchase

The Purchase instruction is used to purchase an NFT from the marketplace. It handles the transfer of SOL and NFTs, as well as closing associated token accounts.

  • taker: The signer initiating the purchase.
  • maker: The unchecked account representing the maker.
  • marketplace: Account representing the marketplace.
  • taker_ata: Associated token account of the taker.
  • vault: Vault account for the maker.
  • treasury: System account for managing funds.
  • maker_mint: Account representing the NFT mint.
  • collection_mint: Account representing the collection's mint.
  • whitelist: Whitelist account for checking permissions.
  • listing: Mutable account for the listing.
  • associated_token_program: Program for managing associated tokens.
  • token_program: Program for token operations.
  • system_program: Program for system-level operations.

List

The List instruction is used to list an NFT in the marketplace. It handles the creation of listings, deposits, and transfers of NFTs and SOL tokens.

  • maker: The signer initiating the listing.
  • marketplace: Account representing the marketplace.
  • maker_ata: Associated token account of the maker.
  • vault: Vault account for the maker.
  • maker_mint: Account representing the NFT mint.
  • collection_mint: Account representing the collection's mint.
  • whitelist: Whitelist account for checking permissions.
  • listing: Mutable account for the listing.
  • metadata: Metadata account for the NFT.
  • metadata_program: Program for managing metadata.
  • associated_token_program: Program for managing associated tokens.
  • token_program: Program for token operations.
  • system_program: Program for system-level operations.

Delist

The Delist instruction allows users to delist an NFT from the marketplace. It includes actions like withdrawing NFTs, transferring funds, and closing accounts.

  • maker: The signer initiating the delisting.
  • marketplace: Account representing the marketplace.
  • maker_ata: Associated token account of the maker.
  • vault: Vault account for the maker.
  • maker_mint: Account representing the NFT mint.
  • collection_mint: Account representing the collection's mint.
  • whitelist: Whitelist account for checking permissions.
  • listing: Mutable account for the listing.
  • associated_token_program: Program for managing associated tokens.
  • token_program: Program for token operations.
  • system_program: Program for system-level operations.

About

The provided code represents a robust Solana program that powers a decentralised NFT marketplace. This program facilitates secure and transparent NFT trading within the Solana network. Below, you'll find an overview of the program's core instructions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published