Skip to main content

Subgraphs

Subgraphs are a powerful way to index and query on-chain data from Euler V2 smart contracts. They allow developers, analysts, and integrators to access protocol data efficiently using GraphQL, without needing to parse events or maintain their own indexing infrastructure.

Euler maintains multiple subgraphs, each tailored to a specific network where the protocol is deployed. These subgraphs are hosted on both Goldsky and The Graph, providing reliable and fast access to historical and real-time data.

Source Code

The source code for all Euler subgraphs is open source and available on GitHub. It includes the GraphQL schema, entity definitions, and event handling logic for all supported networks.

Available Networks and Endpoints

Each network where Euler is live has its own dedicated subgraph instance. Below are the main GraphQL endpoints hosted by Goldsky:

NetworkGraphQL Endpoint
Mainnethttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-mainnet/1.0.6/gn
Basehttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-base/1.0.8/gn
Swellhttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-swell/1.0.9/gn
Sonichttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-sonic/1.0.3/gn
BOBhttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-bob/1.0.4/gn
Berachainhttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-berachain/1.0.3/gn
Avalanchehttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-avalanche/1.0.3/gn
Arbitrumhttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-arbitrum/1.0.2/gn
Unichainhttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-unichain/1.0.2/gn
Inkhttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-ink/1.0.2/gn
BSChttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-bsc/1.0.2/gn
HyperEVMhttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-hyperevm/1.0.1/gn
Optimismhttps://app.goldsky.com/project_cm4iagnemt1wp01xn4gh1agft/dashboard/subgraphs/euler-v2-optimism/1.0.1
Gnosishttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-gnosis/1.0.1/gn
Worldchainhttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-worldchain/1.0.1/gn
TAC Turinhttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-tacturin/1.0.1/gn

You can also find subgraphs hosted on The Graph's hosted service. For a full list, visit the The Graph Explorer.

How to Get Active Positions of an Account

A common question is how to retrieve all active positions (deposits and borrows) for a given account in Euler. While a dedicated API is in development, you can already do this efficiently using the subgraph and lens contracts.

Step 1: Query the Subgraph for Active Positions

Use the trackingActiveAccount query to get all positions and their associated vaults for a given address:

query Accounts($address: ID!) {
trackingActiveAccount(id: $address) {
mainAddress
deposits
borrows
}
}

This will return lists of deposits and borrows, each entry formatted as ${position}${vault} (e.g., 0x4eda703f4D792B093cd64e452CBa7cA0ed06F6e76d671b9c618d5486814feb777552ba723f1a235c).

To parse these entries in JavaScript:

const vault = `0x${entry.substring(42)}`;
const subAccount = entry.substring(0, 42);
  • subAccount is the address of the sub-account holding the position
  • vault is the address of the vault

Step 2: Fetch Detailed Data Using Lens Contracts

Once you have the list of sub-accounts and vaults, use the lens contracts for detailed information:

  • Use AccountLens for account-level data (balances, health, rewards, etc.)
  • Use VaultLens for vault-specific details (configuration, caps, rates, etc.)

Step 3: Vault Verification with Perspectives

For the list of vaults, you can use Perspectives to check whether a vault is verified and meets your criteria. This helps filter for trusted or curated vaults.