Coder Social home page Coder Social logo

hg-subgraph's Introduction

Hg Subgraph

Subgraph for Gnosis Conditional Tokens


Testing Quickstart

  1. Clone this repo.
  2. docker-compose up -d
  3. npm test

hg-subgraph's People

Contributors

cag avatar davidalbela avatar dependabot[bot] avatar v1rtuouscycle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hg-subgraph's Issues

Add some improvements related to search

We need some fields to be of type string to be able to use the suffix _contains and improve the search in thegraph

Entity: Condition
Fields:

  • conditionId
  • questionId
  • oracle
  • creator

Entity: Position
Fields

  • positionId
  • collateralToken (address)
  • wrappedToken (address)
  • conditionIds (is an array, mmm I don't know if we add a new field like conditionIdsString and be an array of string, we can search by this array a conditionId using some suffix for an array of string)

The question is not being indexed

We can take a look at the images ...
Screenshot_20201203_163306

Screenshot_20201203_163459

Query used

{
  conditions(first: 1000, where:{title_not:null}, orderBy: title, orderDirection: asc ) {
    id
    question {
      id
      title
    }
    title
  }
}

Add questionText

I wonder if is possible to add the question Text from realitio to the condition entity, as a field (maybe questionText ?)
Would be great to search by this field

Check for oracle before indexing a condition as an omen condition

This condition has a lot of outcomes, and a questionId from reality, then outcomes are filled with that information as an Omen Condition when is not.

{
  condition(id: "0x49e7b05dcd1d5f873f6f37dfea9a33eeb278502112383eda8dbe603f8af339be") {
    outcomeSlotCount
    outcomes
  }
}

This can be checked in the frontend, but maybe having a field isOmenCondition can be a good idea.

Deploy and document

Should have some description of fields and stuff somewhere, along with official deployment.

Test exotic splits and redeems

Example position on Rinkeby: 0xf09f91994f9c742cf1159d08545fa888639e3b886091c15aef443ac92fb7d792

I think this position is okay though, but it'd still be nice to have some tests for more exotic positions.

Add total value locked

I wonder if is possible to add a property to the condition entity, total value locked. We need to take into account the user will need to sort about this property. Other things to consider, if the value is expresed using decimals, we need to consider that tokens have different decimals (the values ​​would not be normalized), I don't know how we can solve this.

Initial request from here gnosis/conditional-tokens-explorer#340

Space in the middle of conditionIdsStr

I tried to use this query

{
  positions(first: 1000, where:{conditionIdsStr_contains: " "}) {
    id
    conditionIdsStr
  }
}

In the playground https://thegraph.com/explorer/subgraph/cag/hg-rinkeby?selected=playground

And I detect that some conditionIds have an space in the middle, and others don't

I also checked this in the panel, and corroborated this problem, I wonder if there is something that I need to know ?
Is possible to remove this space and join all the conditions without a separator ?

Peek 30-10-2020 18-32

Thanks in advance

Slow performance on Condition query with positions relationship

The following query with 100 elements:

{
  conditions(first: 100) {
    id
  }
}

takes 305 ms.

Adding the positions relationship:

{
  conditions(first: 100) {
    id
    positions {
      id
    }
  }
}

takes 16577 ms.

time curl 'https://api.thegraph.com/subgraphs/name/cag/hg-rinkeby' -H 'Content-Type: application/json' -d '{"query":"{\n  conditions(first: 100) {\n    id\n  }\n}\n","variables":null}'

subgraph-query-conditions-time

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.