Code Monkey home page Code Monkey logo

maker-protocol-subgraph's People

Contributors

juanmardefago avatar sistemico avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

maker-protocol-subgraph's Issues

Discrepencies on totalDebt for collateralTypes

The following query gives different results than other sources

{
  collateralTypes(orderBy: addedAt) {
    name: id
    totalDebt
  }
}

At the time of filling this issue, the values returned on https://thegraph.com/explorer/subgraph/protofire/maker-protocol were:

  "data": {
    "collateralTypes": [
      {
        "name": "ETH-A",
        "totalDebt": "364898242.801629105898606962"
      },
      {
        "name": "BAT-A",
        "totalDebt": "5373983.650627872702620174"
      },
      {
        "name": "SAI",
        "totalDebt": "0.000000000000000001"
      },
      {
        "name": "USDC-A",
        "totalDebt": "352543109.939278021699858807"
      },
      {
        "name": "WBTC-A",
        "totalDebt": "78257566.817053440381777096"
      },
      {
        "name": "TUSD-A",
        "totalDebt": "49585297.504413172168311809"
      },
      {
        "name": "USDC-B",
        "totalDebt": "4677.941008186658382782"
      },
      {
        "name": "KNC-A",
        "totalDebt": "119916.430758190210298992"
      },
      {
        "name": "ZRX-A",
        "totalDebt": "101599.949839629402333544"
      },
      {
        "name": "MANA-A",
        "totalDebt": "321086.536853803333052897"
      },
      {
        "name": "PAXUSD-A",
        "totalDebt": "25858469.758024382179973675"
      },
      {
        "name": "USDT-A",
        "totalDebt": "672.146772615927059167"
      },
      {
        "name": "COMP-A",
        "totalDebt": "456.864572887551384519"
      },
      {
        "name": "LINK-A",
        "totalDebt": "114156.715971373186136054"
      },
      {
        "name": "LRC-A",
        "totalDebt": "495480.992001671410576892"
      }
    ]
  }
}

Comparing to an on-chain source yields different results:

ETH-A 351,065,161.72 
BAT-A 4,038,823.37
USDC-A 360,618,648.86
WBTC-A 78,668,636.49
USDC-B 5,316.21
TUSD-A 49,647,513.68
KNC-A 58,500.13
ZRX-A 89,755.85
MANA-A 325,264.54
PAX-A 25,904,539.3 
USDT-A 427.89
COMP-A 350.02
LRC-A 495,464.75 
LINK-A 114,066.4

sources: daistats.com and https://oasis.app/borrow/markets (for the later, substract max supply from "Dai Available")

thegraph.com reports being synced on that subgraph.

Incorrect value for vault debt

Hi,

I'd like to use your subgraph to get specific Maker Vault collateral and debt values. I'm using cdpId 19417 for testing, of which I know the current debt (Tue 19 Jan 16:35 CET) is 9202.90 DAI (see https://defiexplore.com/cdp/19417).

However, querying the subgraph returns a debt of 8963.24.

Might this be related to pull request #6? Thanks!

Exact query:

{
  vaults(where:{ cdpId: 19417 }) {
    collateralType {
      id
    }
    collateral
    debt
  }
}

Response:

{
  "data": {
    "vaults": [
      {
        "collateral": "25",
        "collateralType": {
          "id": "ETH-A"
        },
        "debt": "8963.246306891334844794"
      }
    ]
  }
}

Add `totalCollateral` to CollateralType

totalCollateral would be the total amount of the collateral type sitting in vaults

It's very useful to know how much collateral is backing the total debt underwritten by a collateral type for leverage and market size stats, looks to me like this would be relatively easy to add?

How do we get liquidation event/time information?

Hello,
I'm using this query to retrieve collateral/debt values -

{
  user(id:"0x0005ccfc729f11a55d4b4a30659a17c613d227f1"){
    id,
    vaults{
      id,
      collateralType {
        id,        
      },
      collateral,
      debt,
      logs(orderBy:timestamp){
        __typename,
        ...on VaultDebtChangeLog {
          id, 
          debtDiff
        }
        ...on VaultTransferChangeLog {
          id,
          timestamp,
        }
        ...on VaultCollateralChangeLog {
          id,
          collateralDiff
        }
      }
    }
  }
}

After reading the maker docs, my understanding is vaultTransferLog represents liquidation events, when value is transferred. Is that correct? Or do we have to use collateralAuction to retrieve liquidation values per wallet. Would appreciate any tips or examples, thanks!

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.