To deploy a Uni V3 Subgraph to the Subgraph Studio, you need to follow these steps:
- Create a new subgraph in the Subgraph Studio. Documentation can be found here.
- Then, you need to change the following fields in the
subgraph.yaml
file to deploy a subgraph with the correct configuration:network
- the network where the subgraph will be deployed (e.g.,mainnet
,sepolia
,polygon
, etc.). This must be changed in two places.address
- the address of the Uniswap V3 Factory contract deployed on the desired network mentioned in the previous step.startBlock
- the block number from which the subgraph will start indexing. It is recommended to set it to the block number when the Uniswap V3 Factory contract was deployed.
- Refer to this documentation to deploy the subgraph to the Subgraph Studio.
- Note that
graph
commands can be run from the root of the repository as follows:npx graph init --studio <SUBGRAPH_SLUG> graph auth --studio <DEPLOY KEY>
- Note that
- After all the steps are done, you can deploy the subgraph to the Subgraph Studio by running the following command:
npx graph deploy --studio <SUBGRAPH_SLUG>
- The subgraph will be deployed to the Subgraph Studio, and you can find it in the Subgraph Studio.
- To query the subgraph, you can use the following development query endpoint, e.g.:
https://api.studio.thegraph.com/query/<uuid>/<SUBGRAPH_SLUG>/version/latest
- Install Docker if you don't have it already
- Install postgres:
brew install postgresql
yarn run build:docker
yarn run test