Code Monkey home page Code Monkey logo

OMGSwap-subgraph

OMGSwap is a decentralized protocol for automated token exchange on Ethereum.

This Subgraph dynamically tracks any exchange created by the uniswap factory. Any exchange, any user of the protocol, and any transaction of the protocol can be queried.

Running Locally

Make sure to update package.json settings to point to your own graph account.

Important Info

  • USD values are based on the Compound Finance DAI oracle, which gets its prices from the Maker oracle.
  • You can find the profit of a liquidity provider with the following information:
    • Find the ratio of total tokens owned by the user out of all tokens:
      • (liquidityTokensMinted - liquidityTokensBurned) / totalLiquidityTokens = ratio
    • With that ratio, figure out how much ETH and token could be withdrawn. You must take the tokens and convert to ETH for total ETH they could withdraw:
      • ratio * ethBalance = ethWithdrawable
      • ratio * tokenBalance * tokenPrice = tokenWithdrawableInEth
      • ethWithdrawable + tokenWithdrawable = totalWithdrawable
    • Now take ethDeposited - ethWithdrawn = totalEth
    • And (tokenDeposited - tokenWithdrawn) * tokenPrice = totalTokensInEth
    • Current Liquidity profit is:
      • profit = totalWithdrawable - totalEth - totalTokensInEth

Queries

Below are a few ways to show how to query the uniswap-subgraph for data. The queries show most of the information that is queryable, but there are many other filtering options that can be used, just check out the querying api. These queries can be used locally or in The Graph Explorer playground.

Ǒmega Protocol Ltd.'s Projects

defi-pulse-adapters icon defi-pulse-adapters

DeFi Pulse Adapters - Official Repository so DeFi projects can keep their metrics up to date on DeFi Pulse

ghost icon ghost

👻 The #1 headless Node.js CMS for professional publishing

o-dex icon o-dex

O-DEX | Decentralize Exchange for All

omegaex icon omegaex

Omega Protocol Decentralized Exchange

omg-site icon omg-site

Ǒmega is Decentralized Financial Protocol

omgswap-sdk icon omgswap-sdk

Development kits for dapps developer, on top of Omega Protocol.

opensea-js icon opensea-js

JavaScript SDK for the OpenSea marketplace. Let your users buy or sell cryptogoods on your own site!

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.