GithubHelp home page GithubHelp logo

compound-v2-subgraph's Introduction

Compound-V2-subgraph

Compound is an open-source protocol for algorithmic, efficient Money Markets on the Ethereum blockchain. This Subgraph ingests the V2 contracts of the protocol. See here for the V1 subgraph.

Networks and Performance

This subgraph can be found on The Graph Hosted Service at https://thegraph.com/explorer/subgraph/compound-finance/compound.

You can also run this subgraph locally, if you wish. Instructions for that can be found in The Graph Documentation.

Contract Upgrades

The subgraph will be kept in sync with the development of Compound-V2 until the official mainnet launch. The Hosted service will always be updated with the most recent subgraph.

After that, the only changes to V2 should be new assets added, which the subgraph will stay up to date with. This may be possible to do so dynamically, without subgraph updates. To be concluded.

Contracts not tracked at all

These contracts were left out:

  • Comptroller.sol - May be tracked in the future, but we are waiting until it is audited before considering it for the subgraph
  • PriceOracle.sol - For the testnet this is just a simple price oracle, it will be updated to a real one on mainnet, and likely included in the subgraph
  • StableCoinInterestRateModel.sol - No data was chosen to be sourced from here
  • StandardInterestRateModel.sol - No data was chosen to be sourced from here

Getting started with querying

Below are a few ways to show how to query the Compound V2 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.

Querying All Markets

{
  markets{
    id
    symbol
    accrualBlockNumber
    totalSupply
    exchangeRate
    totalReserves
    totalCash
    totalDeposits
    totalBorrows
    perBlockBorrowInterest
    perBlockSupplyInterest
    borrowIndex
    tokenPerEthRatio
    tokenPerUSDRatio
  }
}

Querying All Users, and all their CToken balances

Commented out values are temporarily not being used.

{
  users{
    id
    countLiquidated
    countLiquidator
#    accountLiquidity
#    availableToBorrowEth
#    totalSupplyInEth
#    totalBorrowInEth
    cTokens{
      id
      user
      accrualBlockNumber
      transactionTimes
      transactionHashes
      cTokenBalance
      underlyingSupplied
      underlyingRedeemed
#      underlyingBalance
#      interestEarned
      totalBorrowed
      totalRepaid
#      borrowBalance
#      borrowInterest
    }
  }
}

compound-v2-subgraph's People

Contributors

davekaj avatar

Watchers

Nuno Edgar Nunes Fernandes avatar  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.