Code Monkey home page Code Monkey logo

marketplace_solana_2023's Introduction

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.

marketplace_solana_2023's People

Contributors

savvycodings avatar

Stargazers

Jscott avatar  avatar

Watchers

 avatar

Forkers

rpdlib

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.