Hg Subgraph
Subgraph for Gnosis Conditional Tokens
Testing Quickstart
- Clone this repo.
docker-compose up -d
npm test
This repository contains the subgraph for Gnosis Prediction Markets 2.0
License: GNU Lesser General Public License v3.0
Subgraph for Gnosis Conditional Tokens
docker-compose up -d
npm test
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:
Entity: Position
Fields
Add positionIdsStr: String! to the condition entity (pretty much the same as conditionIdsStr: String! for the position entity) so we can search by positionId
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
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.
TheGraph returns at most 1000 elements, the best way would be to have a positions counter in the subgraph and to use that counter to create multiples queries to get the complete set of positions
And example of this can be found here https://github.com/protofire/maker-governance-subgraph/blob/master/src/helpers.ts#L62
Also, can this be made for the position and condition entities ?
Thanks
Should have some description of fields and stuff somewhere, along with official deployment.
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.
Track the wrapped conditional token properties, which is based on the following contract: https://github.com/gnosis/1155-to-20
Just to order like this orderBy: createTimestamp, orderDirection: desc
in a query
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
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 ?
Thanks in advance
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}'
I wonder if is possible to add the creator address to the position entity
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.