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

Uniswap Guide Added #415

Merged
merged 9 commits into from
Sep 21, 2023
Merged

Uniswap Guide Added #415

merged 9 commits into from
Sep 21, 2023

Conversation

bgodlin
Copy link
Contributor

@bgodlin bgodlin commented Sep 12, 2023

No description provided.


## 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.
Copy link
Collaborator

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.

docs/quickstart/quickstart_chains/ethereum-uniswap.md Outdated Show resolved Hide resolved
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)
Copy link
Collaborator

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.

Copy link
Contributor Author

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?

Copy link
Collaborator

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)...?

docs/quickstart/quickstart_chains/ethereum-uniswap.md Outdated Show resolved Hide resolved

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.
Copy link
Collaborator

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

Copy link
Collaborator

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.
Copy link
Collaborator

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
Copy link
Collaborator

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

@deverka deverka self-requested a review September 13, 2023 03:51
docs/quickstart/quickstart_chains/ethereum-uniswap.md Outdated Show resolved Hide resolved
docs/quickstart/quickstart_chains/ethereum-uniswap.md Outdated Show resolved Hide resolved
docs/.vuepress/config.ts Outdated Show resolved Hide resolved
docs/quickstart/quickstart_chains/ethereum-uniswap.md Outdated Show resolved Hide resolved

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
Copy link
Collaborator

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

Copy link
Contributor Author

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

docs/quickstart/quickstart_chains/ethereum-uniswap.md Outdated Show resolved Hide resolved

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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bgodlin

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?

Copy link
Contributor Author

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
Copy link
Collaborator

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

Copy link
Contributor Author

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

fixed as part of 4d14525

@bgodlin bgodlin self-assigned this Sep 20, 2023
Copy link
Collaborator

@deverka deverka left a 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?

@jamesbayly jamesbayly merged commit 05d26b7 into master Sep 21, 2023
2 checks passed
@jamesbayly jamesbayly deleted the adding-uniswap-v3-example branch September 21, 2023 10:38
bgodlin added a commit that referenced this pull request Sep 25, 2023
- Should have been done as part of #415
jamesbayly pushed a commit that referenced this pull request Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants