đ°Pricing with Subgraph
Kodiak provides two distinct protocols â V2 and V3 â each with separate endpoints for their subgraphs. While the structure of the queries remains the same across both protocols, the results may differ due to the underlying differences in how liquidity and pricing are handled.
Endpoints:
Kodiak V2 Subgraph Endpoint:
Kodiak V3 Subgraph Endpoint:
Steps to Get Started:
Understand the Basics of Subgraphs:
Subgraphs index blockchain data and expose it through GraphQL endpoints.
Each subgraph has entities (e.g.,
token
,pool
,transaction
) that define the structure of the data you can query.
Read the Subgraph Documentation: Learn how subgraph works The Graph Doucmentation
Set Up a GraphQL Client:
Use tools like Postman, Insomnia, or GraphQL playgrounds to send queries.
In your application, you can use libraries like
graphql-request
or Apollo Client.
Know the Key Entities:
token
: Represents individual tokens, their metadata, and derived pricing.bundle
: Contains aggregate data like the current price of ETH in USD.
Query examples
Fetching a Specific Tokenâs Price in ETH and USD
Replace
TOKEN_ADDRESS
with the contract address of the token youâre querying.Use thie formula to calculate USD price:
Token Price (USD) = derivedETH * ethPrice
Listing All Tokens with Derived Prices
Example response:
Last updated