Game Asset Marketplace - Live Link
- GameBit and GameItem: both these contracts, are used to represent the fungible and non-fungible aspects of our game assets
- retreiveListings: gathers information from all tokenIds, including address owner, price it is listed at and uri. Returns array of listings. Used for front end to save all listed items and information about them to dynamically update homepage
- List Function is utilized to list a game asset for sale. It checks whether the item is listed or not.The listings mapping is employed to store the seller’s address, the price, and other details associated with the listed item.
- updateListing Function allows the owner of a listed item to update its price. It checks if the item is listed and if the caller is the owner.
- Delist Function is used to remove the listed item from the market. It sets the seller’s address[0] and the price to 0. It checks if the item is listed or not and if the caller is the owner.
- buySellItem Function is used for purchase of a game asset. It transfers the ownership of the NFT (gameItem.transferFrom) and transfers the payment in the form of tokens(gameBit.transferFrom). The function checks if the buyer has enough funds before proceeding.
- Smart Contract (Solidity Programming Language)
- Vite + React
- Hardhat
- Tailwind css
- Ether.js
- Infura
- Netlify
Testing on Hardhat Localhost
- Download DApp folder
- Go into market-contract
- Type ‘npm install’
- Type ‘npx hardhat compile’
- Type ’npx hardhat node’
- Go to the same directory in a new terminal
- Type ‘npx hardhat run .\scripts\deploy.js --network localhost’
- Go market-app, client
- Type ‘npm install’ 10.Type ‘npm run dev’
- Open up provided link
Deploying to Sepolia Testnet
- Download DApp folder
- Go into market-contract
- Type ‘npm install’
- Make sure hardhat.config.js has correct Infura API Url and deployer private key
- Type ‘npx hardhat compile’
- Type npx hardhat run .\scripts\deploy.js --network sepolia’
- Go to market-app/client
- Type ‘npm install’
- Type ‘npm run build’ 10.Use ‘dist’ folder in market-app to deploy front-end on Netlify
- Open up provided link
TODO:
- Add events with popup
- Need to do: buy
- Implement batchOf function?