Marketplace to sell and buy NFTs (ERC721) with ERC20 tokens through the 0x v4 protocol.
- Install dependencies
cd hardhat && npm install
- Create .env file (like .env.example) with your keys
INFURA_API_KEY=
PRIVATE_KEY= # your account's private key in order to deploy contracts
ETHERSCAN_API_KEY= # to verify the deployed contracts
- To compile the contracts and generate typechain typings for compiled contracts:
npx hardhat clean && npx hardhat compile && npx hardhat typechain
- (Optional) You need to copy and paste the Typechain typings generated to the frontend directory so the Dapp works. There is already a script for that:
npm run typechain
- Run tests:
npx hardhat test
- NextJS : React Framework
- Prisma : Node.js and TypeScript ORM
- PostgreSQL : Open Source Relational Database
- RainbowKit : Connect Wallet Button
- Web3UIKit : UI Components
- wagmi : React Hooks for Ethereum
- NFT Swap SDK : P2P Swap Library powered by the 0x protocol
In order to run the project locally follow the next steps:
- Install dependencies
cd frontend && npm install
- Create .env file (like .env.example) with your keys. You can omit setting database variables one by one and copy the database URL directly in
DATABASE_URL
. TheNEXT_PUBLIC_API_TOKEN
helps making the API routes private, only within the client.
ALCHEMY_API_KEY=
DATABASE_HOST=
POSTGRES_USER=
POSTGRES_PASSWORD=
POSTGRES_DB=
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_HOST}/${POSTGRES_DB}
DATABASE_URL_WITH_SCHEMA=${DATABASE_URL}?schema=public
NEXT_PUBLIC_API_TOKEN=
- Create and start the docker container with the PostgreSQL database:
docker compose up -d
- Create migrations from the Prisma schema, apply them to the database and generate artifacts:
npx prisma migrate dev --preview-feature
- Run the app:
npm run dev
Open http://localhost:3000 with your browser to see the website
- Users can request new NFT tokens to be minted, no restrictions here, anyone can request new NFT minting free-of-charge
- Users can list their NFT token for sale for any price they want using the ERC-20 token.
- Users can list and review all existing and yet not executed sell offers.
- Users can accept the existing sell order from some other user and purchase the NFT using ERC-20
- ERC-20 token standard using the OpenZeppelin implementation.
- ERC-721 token standard using the Azuki project implementation.