/dApp_wishList

A decentralized application for creating and managing wish lists on the blockchain. Empower your gifting experience with transparency and security.

Primary LanguageJavaScript

WishList dApp Logo

WishList dApp

Solidity Hardhat Next.js React TailwindCSS License: MIT

A decentralized application for creating and managing wish lists on the blockchain. Empower your gifting experience with transparency and security.

WishList Homepage

Explore Demo โ€ข Report Bug โ€ข Request Feature

๐Ÿ“‘ Table of Contents

๐ŸŒŸ Features

  • ๐Ÿ“ Create and manage personal wish lists on the blockchain
  • ๐ŸŽ Add items with names, descriptions, and prices
  • ๐Ÿ‘€ View wish lists of friends and family
  • ๐Ÿ’ฐ Purchase items from others' wish lists securely
  • ๐Ÿ”’ Transparent and tamper-proof transactions
  • ๐ŸŒ Cross-platform compatibility (Desktop & Mobile)

๐Ÿ› ๏ธ Tech Stack

Backend

  • Solidity ^0.8.24
  • Hardhat 2.22.5
  • OpenZeppelin Contracts 5.0.2
  • Ethers.js 6.4.0

Frontend

  • Next.js 14.2.5
  • React 18
  • TailwindCSS 3.4.1
  • RainbowKit 2.1.3
  • wagmi 2.12.0

Testing & Quality Assurance

  • Chai
  • Mocha
  • Hardhat Network Helpers
  • Solidity Coverage

๐Ÿ—๏ธ Architecture

wishlist-dapp/
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ contracts/
โ”‚   โ”‚   โ””โ”€โ”€ WishList.sol
โ”‚   โ”œโ”€โ”€ test/
โ”‚   โ”‚   โ””โ”€โ”€ WishList.test.js
โ”‚   โ”œโ”€โ”€ scripts/
โ”‚   โ”‚   โ””โ”€โ”€ deploy.js
โ”‚   โ”œโ”€โ”€ hardhat.config.js
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ pages/
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ styles/
โ”‚   โ””โ”€โ”€ package.json
โ””โ”€โ”€ README.md

๐Ÿ“œ Smart Contract

The WishList.sol contract is the backbone of our dApp, enabling users to:

  1. Add items to their wish list
  2. Buy items from others' wish lists
  3. Retrieve wish list data

Key Functions

function addToWishList(string calldata _name, uint256 _price) external;
function buyItem(address _for, uint16 _itemId) external payable;
function getWishList(address _of) external view returns(Item[] memory);

๐Ÿš€ Deployed on Polygon AMOY testnet

๐Ÿ” View full contract on Polygonscan

๐Ÿ–ฅ๏ธ Frontend

Our frontend provides an intuitive interface for seamless interaction with the WishList smart contract:

  • ๐ŸŒˆ Connect wallet using RainbowKit
  • โž• Add and manage items in personal wish list
  • ๐Ÿ” Explore and purchase items from friends' wish lists
  • ๐Ÿ“ฑ Responsive design for optimal mobile and desktop experience

๐Ÿš€ Getting Started

  1. Clone the repository
git clone https://github.com/adelamare-blockchain/dApp_wishList
cd wishlist-dapp
  1. Install dependencies
cd backend && yarn
cd ../frontend && yarn
  1. Set up environment variables (refer to .env.example in both directories)

  2. Run the development server

# Terminal 1: Backend
cd backend
yarn hardhat node

# Terminal 2: Frontend
cd frontend
yarn run dev
  1. Open http://localhost:3000 in your browser

๐Ÿงช Testing

We've rigorously tested all functionalities using Hardhat. Run the test suite:

cd backend
yarn hardhat test
View Test Results
WishList
  Deployment
    โœ” Should deploy with an empty wish list
  addToWishList
    โœ” Should allow users to add items to their wish list
  buyItem
    โœ” Should allow users to buy items from the wish list
    โœ” Should revert if not enough funds are sent
    โœ” Should revert if the item is already bought
  getWishList
    โœ” Should return the correct wish list for an address

6 passing (1.52s)

๐ŸŒ Deployment

  1. Deploy the smart contract
cd backend
yarn hardhat run scripts/deploy.js --network polygonAmoy
  1. Get the contract address & ABI in frontend/constants/index.jsx

  2. Build and deploy the frontend

cd frontend
yarn run build
# Deploy the 'out' directory to your preferred hosting service

๐Ÿ“ธ Screenshots

WishList Homepage Add Item to WishList
View Friend's WishList

๐Ÿค Contributing

Contributions are welcome! Please check out our Contribution Guidelines for details on our code of conduct and the process for submitting pull requests.

๐Ÿ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • OpenZeppelin for secure smart contract libraries
  • Hardhat for Ethereum development environment
  • RainbowKit for wallet connection UI
  • TailwindCSS for utility-first CSS framework
Made with โค๏ธ by Antoine Delamare (https://github.com/adelamare-blockchain)