Giter VIP home page Giter VIP logo

sigmao's Introduction

Sigma'O

  • The goal of the project is to provide a smart contract allowing to issue tokens behaving like an option.
  • The option type can be CALL or PUT with European or American style.
  • The contract is permission less and fully hedged
  • A configurable fee for the UI provider is available

A presentation of the project is available at https://medium.com/@Haileypdll/sigmao-options-on-ergo-tokens-18adaa098416

The UI can be tested at: https://www.sigmao.cc

Sigma'O global diagram

Option Contract

Option Emission parameters

- Style: European (exercible during 24h after expiration) or American (exercible up to expiration)
- Underlying token (for example SigUSD)
- Option amount: number of option created
- Share size: number of token per option
- Strike price: underlying token strike price (nanoerg per token)
- Maturity date: expiration date of the option, minimum 24h maximum 3 years

Mint option token

- The option emission smart contrat allows to create tokens that behaves like an option as they grant to exercise the option from the token stored in the the reserve by the issuer.
- Once delivered to the issuer, the option tokens are freely tradeable
- The tokens stored in the reserve are not available for the issuer until the option expiration and the end of the execise period.

Priced sell option contract

The underlying token needs an Oracle that provides the current price of the token in nanoERG.

Option pricing

The option price at the money (ATM) is computed with the Black-Scholes approximation formula: http://www.espenhaug.com/black_scholes.html

- Strike price: Sp (nanoErg per SigUSD)
- Share Size: Ss (SigUSD per option)
- Maturity date: D (milliseconds)
- Remaining time: T (year)
- Underlying price: P (nanoErg per SigUSD)
- σ : volatility
- K1: price spead factor 
- K2: american factor

Option price = intrinsic price + time value
Call intrinsic price = max(0, (P - Sp) * Ss)
Put intrinsic price = max(0, (Sp - P) * Ss)
European option time value = 0.4 * σ * Ss * Sp * SQRT(T) * (1 - K1 * (ABS(P - Sp) / (Sp * SQRT(T)))² )
American option time value = European option time value * (1 + K2 * SQRT(T))

Option price behavior

- At the money Call price = Put Price all parameters equals
- The time value is maximal at the money and decrease when the underlying price spread from the strike price
- American option have a price > to the European option with same parameter
- Max call price = underlying asset price
- Max put price = strike price
- Min option price: 0.001 ERG (1000000 nanoergs)
- Frozen period (cannot be sold anymore)

Open buy order contract

An open buy order allows to buy an amount of any EIP-4 token at a fixed price, if a seller match the request.

An open buy order makes the box spendable by someone providing the right amount of the requested token to the issuer in the OUTPUTS(1) of the transaction.

A buy order is also refundable at any time for the issuer.

It does not support partial buy and the exact required token amount needs to be provided.

It can be used by any smart contract to sell an amount of token (EIP-4) to the buy order issuer.

SigmaO uses them to match both fixed price sell or priced option sell orders.

Parameters:
- total amount of ERG for the purchase
- buyer address
- token id to purchase
- amount of token to provide (raw amount inclusing decimals)

Open sell order contract

An open sell order allows to put an amount of token (EIP-4) on sale at a fixed price per token.

An open sell order makes the box spendable by someone providing the right amount of ERG to the issuer in the OUTPUTS(2) of the transaction.

A sell order is also refundable at any time for the issuer.

It supports partial sell.

A configurable dApp UI Fee and the transaction miner fee are configurable in the contract parameters.

It can be used by any smart contract to buy an amount of token (EIP-4) to the sell order issuer.

Parameters:
- amount of tokens to sell
- seller address
- token price (nanoerg per smallest unit of token)
- dApp UI fee
- dApp UI address
- transaction miner fee

Project structure

- contract: build the contracts for SigmaO and generates a "script_constants.js" file for the bot and the front-end
- front-end: React app to interact with the contracts
- sigmao-bot: off-chain bot to process the off-chain transactions

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.