-
Notifications
You must be signed in to change notification settings - Fork 50
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
Uniswap Guide Added #415
Uniswap Guide Added #415
Conversation
|
||
## Goals | ||
|
||
This project serves as an excellent foundation for initiating your Ethereum SubQuery project. It meticulously indexes various Uniswap entities, including Swaps, Pool operations, Price ticks, Positions, and additionally computes statistical metrics. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor thing. I'm not sure if this is the best opening line and if this project is actually this great foundation to initialise eth SQ project. I think I would rather start with what the project indexes, what are the goals.
We suggest starting with the [Ethereum Gravatar example](./ethereum-gravatar). The Uniswap project is a lot more complicated and introduces some more advanced concepts. | ||
::: | ||
|
||
Now, let's move forward and fork the example code for this project from [here](https://github.com/subquery/ethereum-subql-starter/tree/main/Ethereum/ethereum-uniswap-v3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bgodlin Why not to use the approach of initialising a boilerplate project and then updating all the files step by step? And only sharing the final code here not asking to fork final version of the project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I contemplated starting a boilerplate project and creating a step-by-step guide for updating files, but I ultimately chose not to proceed with it. My decision was based on the desire to maintain consistency with the format used in all other published quickstart guides. Now, the question is whether we should introduce a new format for this specific page and subsequently update the format for all other guides, or should we stick with the proposed structure for this article and then implement a new format for all quickstart guides in a single comprehensive pull request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But other published starter guides follow exactly this approach (starter boilerplate + changes to the project with a step by step guide)...?
|
||
The `schema.graphql` file determines the shape of your data from SubQuery due to the mechanism of the GraphQL query language. Hence, updating the GraphQL Schema file is the perfect place to start. It allows you to define your end goal right at the start. | ||
|
||
Within this project, you will observe the presence of 22 GraphQL entities, each interconnected through numerous foreign key relationships. Consider, for instance, the relationship between the `Pool` and `Token` entities. Importantly, these relationships encompass not only one-to-many connections but also extend to encompass many-to-many associations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would show Pool and Token entities in the graphql shell
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also we can consider adding a link to Hero Course part dedicated to relationships https://academy.subquery.network/academy/herocourse/module3.html#lesson-1-one-to-many-entities
|
||
Mapping functions define how chain data is transformed into the optimised GraphQL entities that we previously defined in the `schema.graphql` file. | ||
|
||
They function in a manner akin to SubGraphs, and you can observe in this Uniswap project that they are distributed across three distinct files, along with the inclusion of various utility files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't explain how mapping functions work only by referencing to Subgraphs
|
||
Check out the [GraphQL Schema](../../build/graphql.md) documentation to get in-depth information on `schema.graphql` file. | ||
|
||
## 3. Add a Mapping Function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are not adding anything to the file, we should change headers
|
||
Try the following queries to understand how it works for your new SubQuery starter project. Don’t forget to learn more about the [GraphQL Query language](../../run_publish/query.md). | ||
|
||
### Pools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps use the expand markdown component for each example request + response combination to save space here ::: detail xxx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added as part of a83c0df
Co-authored-by: James Bayly <[email protected]>
|
||
The objective of this article is to offer a detailed, step-by-step guide on setting up a SubQuery indexer for Uniswap data indexing. We will comprehensively cover the necessary configurations and delve into the intricacies of the underlying logic. | ||
|
||
Previously, in the [1. Create a New Project](../quickstart.md) section, you must have noted [3 key files](../quickstart.md#_3-make-changes-to-your-project). Let's begin updating them one by one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like all the changes. I have just one question related with the guide dependencies, previous steps reader needs to take to follow it. Shall we mention which project should this person initialise via SQ CLI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added as part of b200099
To gain a deeper understanding of how these core mechanisms work, you can refer to the official [Uniswap documentation](https://docs.uniswap.org/contracts/v3/reference/deployments). | ||
|
||
::: warning | ||
We suggest starting with the [Ethereum Gravatar example](./ethereum-gravatar). The ENS project is a lot more complicated and introduces some more advanced concepts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean - The Ethereum Uniswap project is more complicated? @bgodlin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: James Bayly <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me. Thanks for all the changes @bgodlin
@jamesbayly Do you want to have another look?
- Should have been done as part of #415
- Should have been done as part of #415
No description provided.