https://github.com/protofire/ray-subgraph
Subgraph for Robo-Advisor for Yield (RAY)
https://github.com/protofire/ray-subgraph
ethereum ray staked subgraph thegraphprotocol
Last synced: 6 months ago
JSON representation
Subgraph for Robo-Advisor for Yield (RAY)
- Host: GitHub
- URL: https://github.com/protofire/ray-subgraph
- Owner: protofire
- Created: 2020-01-24T19:43:46.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-10T17:17:07.000Z (about 3 years ago)
- Last Synced: 2023-04-10T04:54:33.775Z (almost 3 years ago)
- Topics: ethereum, ray, staked, subgraph, thegraphprotocol
- Language: TypeScript
- Homepage: https://thegraph.com/explorer/subgraph/protofire/ray
- Size: 603 KB
- Stars: 2
- Watchers: 5
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Robo-Advisor for Yield Subgraph
The subgraph generated by this code can be found at the [protofire/ray](https://thegraph.com/explorer/subgraph/protofire/ray) subgraph in the TheGraph explorer.
The [schema](schema.graphql) defines all entities to be exposed in the subgraph, as well as any relations between the data entities, and all entity fields that can be queried on the subgraph.
#### Query examples
We can query anything in the same way we would query a GraphQL backend, for more documentation on that visit the [official GraphQL docs](https://graphql.org/learn/queries/). Below are some of queries we might be interested in using.
###### Assets
Get all supported assets with its' name, address, symbol and decimals
```graphql
assets {
name
address
symbol
decimals
}
```
###### Users
Get all end users with its' respective address, and the value and status of their tokens
```graphql
users {
id
address
token {
value
isActive
}
}
```
###### Opportunities
Get all opportunities, with its' related portfolio and token
```graphql
opportunities {
id
address
portfolio {
id
asset {
address
name
}
}
token {
id
}
}
```
###### Portfolios
Get all portfolios with its' asset, opportunities and associated raytokens
```graphql
portfolios {
asset {
symbol
name
}
opportunities {
id
address
token {
id
}
}
raytokens {
id
}
}
```
###### RAYTokens
Get all RAYTokens with its' corresponding owner address, portfolio, asset, value and all its' events.
```graphql
raytokens {
owner {
address
}
portfolio {
asset {
address
name
}
}
value
events {
__typename
value
}
}
```
###### Token Events
Get all events with basically all of their data. Here we can use inline fragments to query more effectively the different types of events.
```graphql
raytokenEvents {
token {
id
}
value
timestamp
block
transaction
__typename
... on MintEvent {
minter
}
... on DepositEvent {
sender
tokenValueBefore
tokenValueAfter
}
... on WithdrawEvent {
tokenValueBefore
tokenValueAfter
}
}
```