Skip to content

CineCapsule/kryptopixel-marketplace

Repository files navigation

CineCapsule Project 🍿

Principle

  • A user puts an item for sale, the ownership of the item will be transferred from the creator to the marketplace.
  • A user purchases an item, the purchase price will be transferred from the buyer to the seller and the item will be transferred from the marketplace to the buyer.
  • The marketplace owner will be able to set a listing fee. This fee will be taken from the seller and transferred to the contract owner upon completion of any sale, enabling the owner of the marketplace to earn recurring revenue from any sale transacted in the marketplace.

The marketplace logic will consist of two smart contracts

  • NFT Contract - This contract allows users to mint unique digital assets.
  • Marketplace Contract - This contract allows users to put their digital assets for sale on an open market.

Docs.

Main technologies used 🧰

  • Web application framework - Next.js
  • Solidity development environment - Hardhat
  • File Storage - IPFS
  • Ethereum Web Client Library - Ethers.js

Prerequisites

  • Node.js installed on your machine
  • Metamask wallet extension installed as a browser extension

About Polygon

"Polygon is a protocol and a framework for building and connecting Ethereum-compatible blockchain networks. Aggregating scalable solutions on Ethereum supporting a multi-chain Ethereum ecosystem."

Local setup

To run this project locally, follow these steps.

  1. Clone the project locally, change into the directory, and install the dependencies:
git clone https://github.com/Margotte83/Kryptopixel-marketplace.git

cd Kryptopixel-marketplace

# install using NPM or Yarn
npm install

# or

yarn
  1. Start the local Hardhat node
npx hardhat node
  1. With the network running, deploy the contracts to the local network in a separate terminal window
npx hardhat run scripts/deploy.js --network localhost
  1. Start the app
npm run dev

Configuration

To deploy to Polygon test or main networks, update the configurations located in hardhat.config.js to use a private key and, optionally, deploy to a private RPC like Infura.

require("@nomiclabs/hardhat-waffle");
const fs = require('fs');
const privateKey = fs.readFileSync(".secret").toString().trim() || "";

// infuraId is optional if you are using Infura RPC
const infuraId = fs.readFileSync(".infuraid").toString().trim() || "";

module.exports = {
  defaultNetwork: "hardhat",
  networks: {
    hardhat: {
      chainId: 1337
    },
    mumbai: {
      // Infura
      // url: `https://polygon-mumbai.infura.io/v3/${infuraId}`
      url: "https://matic-mumbai.chainstacklabs.com",
      accounts: [privateKey]
    },
    matic: {
      // Infura
      // url: `https://polygon-mainnet.infura.io/v3/${infuraId}`,
      url: "https://rpc-mainnet.maticvigil.com",
      accounts: [privateKey]
    }
  },
  solidity: {
    version: "0.8.4",
    settings: {
      optimizer: {
        enabled: true,
        runs: 200
      }
    }
  }
};

If using Infura, update .infuraid with your Infura project ID.

🚨 Be sure to never commit any private keys to Git. To be extra safe, consider storing these values in temporary environment variables when working with wallets that contain real tokens. To omit from Git, add .secret to your .gitignore file.

Basic Sample Hardhat Project

This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, a sample script that deploys that contract, and an example of a task implementation, which simply lists the available accounts.

Try running some of the following tasks:

npx hardhat accounts
npx hardhat compile
npx hardhat clean
npx hardhat test
npx hardhat node
node scripts/sample-script.js
npx hardhat help

Releases

No releases published

Packages

 
 
 

Contributors