Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gql and get info from Omen graph #2

Closed
davizalpe opened this issue Aug 21, 2020 · 0 comments · Fixed by #6
Closed

Add gql and get info from Omen graph #2

davizalpe opened this issue Aug 21, 2020 · 0 comments · Fixed by #6
Assignees
Labels
enhancement New feature or request

Comments

@davizalpe
Copy link
Contributor

davizalpe commented Aug 21, 2020

Add a gql library to query from the retrieved events and obtain the related data. Data can be obtained from thegraph Omen endpoints with the given questionId by the events.

e.g:

# https://thegraph.com/explorer/subgraph/cag/hg
HASH_ID=`curl -s 'https://api.thegraph.com/subgraphs/name/cag/hg' \
 -H 'content-type: application/json' \
 --data-binary '{"query":"{ conditions(where : { id: \"'${CONDITION_ID}'\"}) { id oracle questionId }}"}' | jq '.data["conditions"][].questionId' | cut -d'"' -f 2`

# https://thegraph.com/explorer/subgraph/protofire/omen
echo "questionID: $HASH_ID"
curl 'https://api.thegraph.com/subgraphs/name/protofire/omen' \
  -H 'content-type: application/json' \
  -d '{"query":"{  questions(  where: {    id: \"'${HASH_ID}'\"  }  ) {    id    templateId    data    title  }}"}'
@davizalpe davizalpe added the enhancement New feature or request label Aug 21, 2020
@davizalpe davizalpe self-assigned this Aug 21, 2020
@davizalpe davizalpe added this to To do in Conditional Tokens via automation Aug 21, 2020
davizalpe added a commit that referenced this issue Aug 27, 2020
  * Add `getQuestion` service to get Question entity from
    from thegraph by a given questionId.
  * Add `getCondition` service to get Condition entity from thegrap by a
    given conditionId.
  * Add env variables `THE_GRAPH_GET_OMEN_CONDITIONS` and
    `THE_GRAPH_GET_OMEN_QUESTIONS`.
  * Add questions and outcomes strings from GraphQL services into `ConditionPreparation`event.

Closes #2
Conditional Tokens automation moved this from To do to Done Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

1 participant