NFT-Factory-Cameligov1.0

example of a NFT Factory contract in CameLIGO

Built by LIGOLicense MIT

Use template

ligo init contract --template NFT-factory-cameligo [PROJECT_NAME]

Readme

Contract VIN (Vinus In Numeris)

This contract implements a factory of FA2 NFT. Each FA2 contract represents a collection of wine bottles. Wine bottles are represented by tokens inside a FA2 contract. When originating a collection of bottle,

  • the creator must specify a collection name and a QR code for each bottle.
  • the creator owns all bottles of the collection

The creator of the collection can also add new bottles to his collection anytime (with the Mint entrypoint)

A bottle owner can transfer one or more bottle to someone else (with the Transfer entrypoint)

A collection of bottles is represented by a FA2 contract. The implementation of the FA2 introduces:

  • a admin address on the storage which represents the creator of the FA2 contract
  • a Mint entrypoint that allows the creator of the FA2 to create new tokens inside the NFT contract
  • a token_usage map that count the number of transfer of a bottle
  • a token_usage view for retrieving the number of transfer of a bottle (for a given token_id)

An extra Marketplace smart contract has been provided to illustrate how to make a secondary market on these Nft. The Marketplace contract allows Nft owners to sell their wine bottles on a secondary market. The Marketplace contract allows users to accept a sell proposal. The Marketplace smart contract is not meant for production purpose.

Pre-requisites

You need to install the following tools:

How to use this template ?

Compilation

A makefile is provided to compile the "Factory" smart contract.

make compile

You can also override make parameters by running :

make compile ligo_compiler=<LIGO_EXECUTABLE> protocol_opt="--protocol <PROTOCOL>"

Tests

A makefile is provided to launch tests.

make test

Deployment

A typescript script for deployment is provided to originate the smart contrat. This deployment script relies on .env file which provides the RPC node url and the deployer public and private key. So make sure to rename deploy/.env.dist to deploy/.env and fill the required variables.

make deploy

Contract informations

generateCollection

Arguments
NameType (Michelson)
namestring
token_idslist nat
token_metasbig_map (big_map (nat, (token_id: nat, map (string, bytes))))