Plutus dApp which enables users to fractionalize their NFTs.
This repository is deperecated and replaced by Fracada V2
The code on this repository has not been audited. We don't recommend it using in production without a full security audit. Use it at your own risk!.
This contract locks an NFT and mints a number of tokens representing fractions of it. To get the NFT back, the fraction tokens are burned.
The protocol has three steps:
- Locking the NFT: The NFT is paid to the contract
- Mint tokens: Fraction tokens are minted (must be run by the same person who performed step 1).
- Return the NFT: Burning all the fraction tokens will allow the user to redeem the NFT back.
The Fracada.hs
content can be pasted on the Plutus Playground and executed directly in the simulator ( tested and compiled against Plutus release tag plutus-pab/v0.0.2
).
To build the project execute cabal build
at the project root.
(NOTE: To build, the easiest way is for now, to clone Plutus do nix-shell
on the root of it and then cd
to this repo)
To build:
$ cabal configure --enable-tests --enable-executable-dynamic -f -external-libsodium-vrf
$ cabal build
To run use-case test execute the following commands at the project root.
$ cabal run -- fracada-test # or cabal test
Up to date
use cases
fracada
Expose '1-fractionNFT' and '2-returnNFT' endpoints: OK (0.12s)
Can lock NFT and mint fractionalize tokens: OK
All 2 tests passed (0.14s)
Dumping transaction for debug purpose ran the following command at the project root:
$ cabal run fracada-scripts -- ./tmp transactions -p scripts/protocol-parameters.json
...
Writing transactions to: ./tmp
Writing partial transaction JSON: ./tmp/fracada-success-1.json
To generate the scripts to deploy on-chain simply run:
cabal run script-dump <NFT currency symbol> <NFT token name> <Fraction token name> <number of fractions>
This will create validator.plutus
and minting.plutus
with the cbor dump of the scripts ready to be submitted in a transaction.