Wine-NFTv1.0

An example of a NFT marketplace in JsLIGO

Built by LIGOBuilt with React, JsLIGOLicense MIT

Use template

git clone https://github.com/marigold-dev/training-nft-4

Readme

Wine NFT marketplace

This complete DApp is a Wine marketplace extending the @ligo/fa package from the Ligo repository

NFT standard provides these actions :

  • transfer
  • balance_of
  • update_operators

The Wine marketplace is providing these features on top a generic NFT contract :

  • mint new wine bottles
  • update wine bottle metadata details
  • buy wine bottles
  • sell wine bottles

You can play with the final demo

This DApp is composed by :

  • a smart contract extending a ligo library
  • a frontend written in React

Install tooling

  • [ ] (Required) git : to clone the repo
  • [ ] (Required) npm: front-end is a typescript React client app
  • [ ] (Recommended) yarn: to build and run the front-end (see this article for more details about differences between npm and yarn)
  • [ ] (Required) Docker: needed for taqueria
  • [ ] (Required) jq: extract taqueria JSON data
  • [ ] (Required) taqueria : Tezos Dapp project tooling (version >= 0.24.2)
  • [ ] (Recommended) Temple wallet: an easy to use Tezos wallet in your browser (Or any other one with ghostnet support)

Install dependencies

This installs dependencies for taqueria, React libs and ligo package

cd solution
npm i
cd ./app
yarn install
cd ..
TAQ_LIGO_IMAGE=ligolang/ligo:0.57.0 taq ligo --command "install @ligo/fa"

Build

Compile ligo

TAQ_LIGO_IMAGE=ligolang/ligo:0.57.0 taq compile nft.jsligo

Your Michelson files are located on ./artifects folder

Deploy to ghostnet

taq deploy nft.tz -e "testing"
┌──────────┬──────────────────────────────────────┬───────┬──────────────────┬────────────────────────────────┐
│ Contract │ Address                              │ Alias │ Balance In Mutez │ Destination                    │
├──────────┼──────────────────────────────────────┼───────┼──────────────────┼────────────────────────────────┤
│ nft.tz   │ KT1ExUVXDmRSk42vJDi37fQdKCDEPS9m2DoB │ nft   │ 0                │ https://ghostnet.ecadinfra.com │
└──────────┴──────────────────────────────────────┴───────┴──────────────────┴────────────────────────────────┘

Run the frontend

cd ./app
yarn run start

You can see the app running on localhost

(Optional) Deploy to mainnet

Later if you need to go to production, you can swap the taqueria environment to point to mainnet. Go back to the root folder ./solution and run :

taq deploy nft.tz -e "production"

Re-run the frontend to pick the mainnet contract address

cd ./app
yarn run start

Note : we are currently set with the Lima protocol on Taqueria (file .taq/config.json). Later, you would have to change to the last the protocol

"mainnet": {
      "label": "mainnet",
      "rpcUrl": "https://mainnet.api.tez.ie",
      "protocol": "PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",

Let's play

  1. Connect with your wallet an choose alice account (or one of the administrators set on initial storage here ./contracts/nft.storageList.jsligo). You are redirected to the Administration /mint page as there is no nft minted yet
  2. Enter these values on the form for example :
  • name : Saint Emilion - Franc la Rose
  • symbol : SEMIL
  • description : Grand cru 2007
  • quantity : 1000
  1. Click on Upload an image an select a bottle picture on your computer
  2. Click on Mint button

minting.png

Your picture will be pushed to IPFS and will display, then you are asked to sign the mint operation

  • Confirm operation
  • Wait less than 1 minutes until you get the confirmation notification, the page will refresh automatically

minted.png

Now you can see the Trading menu and the Sell bottles sub menu

Click on the sub-menu entry

You are owner of this bottle so you can make an offer on it

  • Enter a quantity
  • Enter a price offer
  • Click on SELL button
  • Wait a bit for the confirmation, then it refreshes and you have an offer attached to your NFT

sell.png

For buying,

  • Disconnect from your user and connect with another account (who has enough XTZ to buy at least 1 bottle)
  • The logged buyer can see that alice is selling some bottles from the unique collection
  • Buy some bottles while clicking on BUY button
  • Wait for the confirmation, then the offer is updated on the market (depending how many bottle you bought)
  • Click on bottle offers sub menu
  • You are now the owner of some bottles, you can resell a part of it at your own price, etc ...

buy.png

For adding more collections, go to the Mint page and repeat the process

Conclusion

You are able to play with an any NFT template from the ligo library.

Congratulations !

You can freely modify this example to fit your need