Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions factoryNftRoyalites/src/cameligo/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
ligo_compiler=docker run --rm -v "$$PWD":"$$PWD" -w "$$PWD" ligolang/ligo:0.40.0
# ligo_compiler=../../../ligo
PROJECTROOT_OPT=--project-root .
PROTOCOL_OPT=--protocol ithaca
JSON_OPT=--michelson-format json

help:
@echo 'Usage:'
@echo ' all - Remove generated Michelson files, recompile smart contracts and lauch all tests'
@echo ' clean - Remove generated Michelson files'
@echo ' compile - Compiles smart contract Factory'
@echo ' test - Run integration tests (written in Ligo)'
@echo ' deploy - Deploy smart contracts advisor & indice (typescript using Taquito)'
@echo ''

all: clean compile test

compile: fa2_nft.tz factory marketplace_nft.tz

factory: factory.tz factory.json

factory.tz: contracts/main.mligo
@echo "Compiling smart contract to Michelson"
@$(ligo_compiler) compile contract $^ -e main $(PROTOCOL_OPT) $(PROJECTROOT_OPT) > compiled/$@

factory.json: contracts/main.mligo
@echo "Compiling smart contract to Michelson in JSON format"
@$(ligo_compiler) compile contract $^ $(JSON_OPT) -e main $(PROTOCOL_OPT) $(PROJECTROOT_OPT) > compiled/$@

fa2_nft.tz: contracts/generic_fa2/core/instance/NFT.mligo
@echo "Compiling smart contract FA2 to Michelson"
@$(ligo_compiler) compile contract $^ -e main $(PROTOCOL_OPT) $(PROJECTROOT_OPT) > contracts/generic_fa2/compiled/$@

marketplace_nft.tz: contracts/marketplace/main.mligo
@echo "Compiling smart contract Marketplace to Michelson"
@$(ligo_compiler) compile contract $^ -e main $(PROTOCOL_OPT) $(PROJECTROOT_OPT) > contracts/marketplace/compiled/$@

clean: clean_contracts clean_fa2 clean_marketplace

clean_contracts:
@echo "Removing Michelson files"
@rm -f compiled/*.tz compiled/*.json

clean_fa2:
@echo "Removing FA2 Michelson file"
@rm -f contracts/generic_fa2/compiled/*.tz

clean_marketplace:
@echo "Removing Marketplace Michelson file"
@rm -f contracts/marketplace/compiled/*.tz


test: test_ligo test_marketplace

test_ligo: test/test.mligo
@echo "Running integration tests"
@$(ligo_compiler) run test $^ $(PROTOCOL_OPT) $(PROJECTROOT_OPT)

test_marketplace: test/test_marketplace.mligo
@echo "Running integration tests (marketplace)"
@$(ligo_compiler) run test $^ $(PROTOCOL_OPT) $(PROJECTROOT_OPT)

deploy: deploy_node_modules deploy.js
@echo "Deploying contract"
@node deploy/deploy.js

deploy.js:
@cd deploy && tsc deploy.ts --resolveJsonModule -esModuleInterop

deploy_node_modules:
@echo "Install node modules"
@cd deploy && npm install
43 changes: 43 additions & 0 deletions factoryNftRoyalites/src/cameligo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## Contract Super Wine

This contract implements a factory of FA2 NFT which handles royalties on the FA2 level (on primary market). Each FA2 contract represents a collection of poems. Poems are represented by tokens inside a FA2 contract as non fungible tokens.
When originating a collection of poems,
- the creator must specify a collection name and a QR code for poem (the QR code is the hash of the poem) and an author.
- the creator owns all minted poems of the collection

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

A bottle owner can transfer one or more bottle to someone else (with the *Transfer* entrypoint) and must specify a tez amount for sending royalties to the author.


A collection of poems 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 specialized Transfer entrypoint which handles transfer of the Nft and the royalties.


### Compilation

A makefile is provided to compile the "Factory" smart contract, and to launch tests.
```
cd src/cameligo/
make compile
make test
```

### Tests

A makefile is provided to launch tests.
```
cd src/cameligo/
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.

```
cd src/cameligo
make deploy
```
1,560 changes: 1,560 additions & 0 deletions factoryNftRoyalites/src/cameligo/compiled/factory.json

Large diffs are not rendered by default.

Loading