Giter VIP home page Giter VIP logo

mortys's Introduction

Mortys

Introduction

An implementation of Mortys, an NFT primitive by @_Dave__White_. Mortys are a mechanism that allows fractionalization without the need for buyouts or oracles by relying on a martingale settlement process.

Implementation Notes

A few notes on the current implementation:

Long Variance & Virtual Mortys

The main implementation challenge with the Mortys mechanism comes from what the original paper describes as "long variance". After every coin flip, the morty balance of every member in the buy pool must be adjusted, as they collectively win or lose a morty. If you directly represent Mortys as an ERC20, this becomes difficult to do efficiently. The original paper presents a clever trick of using "auto-cancelling" flips to eliminate long variance: form pairs of vaults at random, flip a single coin, and assign each vault a different outcome based on the flip. Unfortunatelly the trick does not work in the case of a single vault.

A solution to this problem is to use "virtual mortys". Instead of having each ERC20 directly represent a Morty, each token instead represents an equal share of the buy pool. Each vault and the buy pool have an internal balance of "virtual mortys", and the martingale settlement works on these virtual balances.

When Alice withdraws mortys from her vault, these mortys go directly into the buy pool, and Alice instead receives an equivalent share of the pool, which she can proceed to sell. This representation means we we only need to transfer ERC20 during minting and redemption.

Martingale Randomness

We use Chainlink VRF as a provably-fair source of randomness for the Martingale settlement

How to run

# Install dependencies
npm install

# test contracts with hardhat
npx hardhat test

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.