Giter Site home page Giter Site logo

capsy14 / marketplace-with-chainlink-oracle Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 332 KB

NFT Marketplace with Chainlink Oracle Integration

Home Page: https://nft-market-place-roan-sigma.vercel.app

Solidity 25.14% JavaScript 58.64% HTML 0.72% CSS 8.89% TypeScript 6.60%

marketplace-with-chainlink-oracle's Introduction

NFT Marketplace with Chainlink Oracle Integration

Overview

This project showcases an NFT marketplace smart contract that leverages the Chainlink testnet oracle to make API requests from CryptoCompare. The oracle fetches the latest ETH price in USD, allowing users to list NFTs for sale in USD, with the payment converted to ETH at the time of the transaction. The marketplace takes a 10% commission from each successful trade, which is transferred to the admin (contract deployer).

  • BUY NFT

image

  • Listed and Owned NFTs

image

  • Owned NFTs

image

Features

  • Oracle Integration: Uses Chainlink testnet oracle to get the latest ETH price in USD from CryptoCompare.
  • NFT Listing: Users can list their NFTs for sale in USD.
  • ETH Payment: Buyers are charged in ETH equivalent to the USD price at the time of the sale.
  • Admin Commission: 10% commission from each successful trade goes to the wallet that deployed the contract.
  • The GRAPH: Uses The Graph to index all NFTs and provides a GraphQL schema for querying.

Tech Stack

  • Solidity: Smart contract development.
  • Vite: Frontend build tool.
  • React: Frontend framework.
  • TypeScript: Type-safe JavaScript.
  • The Graph: Indexing protocol for querying blockchain data.
  • ethers.js: Library for interacting with the Ethereum blockchain.
  • Hardhat: Ethereum development environment.

Setup

Prerequisites

  • Node.js and npm installed.
  • A GitHub account to clone the repository.
  • Access to the Sepolia testnet.
  • Pinata account for IPFS storage.

Installation

  1. Clone the repository

    git clone https://github.com/capsy14/NFT-MarketPlace
    cd NFT-MarketPlace
    
  2. Install Dependencies

    npm install
    
  3. Create an .env file

    • In the project root, create a .env file with the following content:
    SEPOLIA_URL=<Your_Sepolia_Testnet_URL>
    VITE_PINATA_API_KEY=<Your_Pinata_API_Key>
    VITE_PINATA_SECRET_API_KEY=<Your_Pinata_Secret_API_Key>
    VITE_PUBLIC_GRAPH_URL=<Your_GraphQL_API_URL>
    VITE_NFT_MARKET_ADDRESS=<Your_NFT_Marketplace_Contract_Address>
    
  4. Install Graph CLI

    npm install -g @graphprotocol/graph-cli
    
  5. Create a Subgraph

    graph init --product hosted-service <GITHUB_USER>/<SUBGRAPH_NAME>
    
  6. Configure Subgraph

Update the subgraph.yaml file with the necessary configurations including the contract address and ABI.

  1. Deploy Subgraph

    graph auth --product hosted-service <ACCESS_TOKEN>
    graph deploy --product hosted-service <GITHUB_USER>/<SUBGRAPH_NAME>
    
    
    
  2. Start the development server

    npm run dev
    
    

Smart Contract Details

  • NFT Marketplace The smart contract allows users to list NFTs for sale and buyers to purchase them using ETH. The listing price is specified in USD, and the contract uses the Chainlink oracle to fetch the current ETH/USD exchange rate to determine the equivalent ETH amount. Upon a successful purchase, 10% of the sale price is sent to the admin.

image

  • Commission The contract is designed to take a 10% commission from every sale, which is automatically transferred to the admin's address.

image

  • GraphQL Integration The project uses The Graph to index all NFTs. This allows efficient querying of NFT data through a GraphQL API. The schema includes the necessary types and queries to fetch NFT details, listings, and sale information.

image

image

Test the project at : NFTMarketPlace

Author

Made by Kartik Bhatt

marketplace-with-chainlink-oracle's People

Contributors

capsy14 avatar

Watchers

 avatar

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.