GithubHelp home page GithubHelp logo

takertao2 / opium-contracts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from opiumprotocol/opium-contracts

0.0 1.0 0.0 5.81 MB

Smart contracts of Opium Protocol

Home Page: https://opium.network

License: Other

JavaScript 34.87% Solidity 28.35% TypeScript 36.79%

opium-contracts's Introduction

Opium contracts

Opium Protocol consist of Opium Main Smart Contracts set introduced in this repository alongside with Opium token standard smart contracts

Documentation

Protocol documentation can be found here https://docs.opium.network/

Generated documentation for code can be found here

Audit

Protocol was audited by:

Opium protocol is deployed on following addresses

Mainnet

Rinkeby

High-level flow description of user behavior

  1. Users approve their ERC20 tokens to TokenSpender
  2. Users choose orders on relayer frontend, sign them and pass it to relayer
  3. Relayer settles matched orders by sending them to Match or SwaprateMatch contracts depending on Order type
  4. Matching contracts validate whether all conditions for orders are met, collect margin from buyer and seller, send it to Core with position creations command
  5. Core validates derivative according to syntheticId logic, collects margin from Matching contracts and mints position tokens with TokenMinter
  6. At execution time (maturity) users call core to burn their position tokens and receive payout from derivative
  • All smart contracts get each others addresses using Registry contract
  • Contracts in contracts/test folder are mocks and helpers for testing
  • TokenMinter implements ERC721O

opiumFlow

Documentation and tests status of Opium contracts (would be updated with additional documentation and tests)

docsAndTestsStatus

Tests

Tests are running against ganache-cli

    npm run test

Because timeTravel is used in tests, each run should be running on new ganache-cli instance

Copyright © 2020 Blockeys BV. All rights reserved.

opium-contracts's People

Contributors

alirun avatar evgenynasretdinov avatar riccardobiosas avatar

Watchers

James Cloos avatar

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.