Giter Club home page Giter Club logo

fracada's Introduction

Fracada V1 (deprecated - see V2 link below)

Plutus dApp which enables users to fractionalize their NFTs.

license

This repository is deperecated and replaced by Fracada V2

Disclaimer

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!.

Protocol

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:

  1. Locking the NFT: The NFT is paid to the contract
  2. Mint tokens: Fraction tokens are minted (must be run by the same person who performed step 1).
  3. Return the NFT: Burning all the fraction tokens will allow the user to redeem the NFT back.

Testing On Plutus Playground

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 ).

Building

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

Testing

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 Transactions

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

Deployable Scripts

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.

fracada's People

Contributors

ilap avatar leadplutusdev avatar nicarq avatar robkorn avatar sebastiengllmt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fracada's Issues

Script-dump

Has this bit been released yet? Can't see it

$ cabal run script-dump "a" "not" "yet" 4
cabal: Cannot run the package script-dump, it is not in this project (either
directly or indirectly). If you want to add it to the project then edit the
cabal.project file.

Problem building with Cabal

I have trouble compiling with cabal build.

The Plutus (https://github.com/input-output-hk/plutus) tag I'm on is plutus-pab/v0.0.1. I can start a nix-shell from within the Plutus repo checkout, no problem.

I've attached the build log for your review.
build.log

Platform I'm on:
OS: OSX Monterey.
GHC: 8.10.7
Cabal: 3.6.2.0
Plutus checkout: plutus-pab/v0.0.1 (also tried plutus-pab/v0.0.2, same thing)

Can you offer me some insight how I can make this work?

Fracada.hs doesn't compile on Plutus Playground

According to the docs, the code in Fracada.hs should work in Plutus Playground, but compilation actually fails with this error:

Compilation Error, Line 252, Column 9 (jump)
 error:
    Not in scope: type constructor or class `IO'
    Perhaps you want to add `IO' to one of these import lists:
      `Prelude' (/tmp/web-ghc-work-a675a8e8e3ea3ef3/Main.hs:16:1-61)
      `Playground.Contract' (/tmp/web-ghc-work-a675a8e8e3ea3ef3/Main.hs:30:1-120)
    |
252 | main :: IO ()
    |         ^^

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.