An online restaurant food application that enables wallet integration, with images stored on IPFS. Additionally, the web app provides the option to view the calorie count per serving for each dish.
Indulge in nutritious meals while effortlessly monitoring the calorie content per serving. Our system utilizes IPFS to store food images, which are seamlessly listed within the contract along with descriptive data for each item.
yarn install
to install locally.yarn chain
..env
file to packages/hardhat
folder.packages/hardhat/hardhat.config.js
file. Then change the defaultnetwork
.DEPLOYER_PRIVATE_KEY
variable in the .env
file and insert your wallet's private key.yarn deploy
yarn verify
or, if using a network other than sepolia without altering the default network, execute yarn verify --network your_network
.YourContract.sol
in packages/hardhat/contracts
packages/nextjs/pages
packages/hardhat/deploy
packages/hardhat/data
This Solidity smart contract, YourContract.sol
. The contract is geared towards listing items, facilitating user purchases, and enabling the owner to withdraw the accumulated funds.
Item: Represents an item for sale with attributes such as ID, name, category, image URL, cost, rating, and description.
Order: Captures the details of a purchase order, including the timestamp of the transaction and the associated item.
list()
:Description: Allows the contract owner to list new items.
Parameters:
_id: Unique identifier for the item.
_name: Name of the item.
_category: Category to which the item belongs.
_image: URL pointing to the item's image.
_cost: Cost of the item.
_rating: Rating assigned to the item.
_description: Descriptive information about the item.
Access Restriction: Only accessible by the contract owner (onlyOwner modifier).
Behavior:
buy()
:withdraw()
Initiates a fund withdrawal to the owner's address using a low-level call operation.
Ensures the withdrawal is successful.
Listing Items:
The owner lists items by calling the list()
function, providing details such as name, category, cost, and more.
Making a Purchase:
Users initiate a purchase by calling the buy()
function with the ID of the desired item and sending sufficient Ether.
Owner Withdrawal:
The contract owner can withdraw the accumulated funds using the withdraw()
function.
This food web app was built with Scaffold-ETH 2.