Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to 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:

Goldsky

NetworkGraphQL Endpoint
Mainnethttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-mainnet/latest/gn
Basehttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-base/latest/gn
Swellhttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-swell/latest/gn
Sonichttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-sonic/latest/gn
BOBhttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-bob/latest/gn
Berachainhttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-berachain/latest/gn
Avalanchehttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-avalanche/latest/gn
Arbitrumhttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-arbitrum/latest/gn
Unichainhttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-unichain/latest/gn
Inkhttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-ink/latest/gn
BSChttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-bsc/latest/gn
HyperEVMhttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-hyperevm/latest/gn
Optimismhttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-optimism/latest/gn
Gnosishttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-gnosis/latest/gn
Worldchainhttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-worldchain/latest/gn
TAChttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-tac/latest/gn
Plasmahttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-plasma/latest/gn
Mantlehttps://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-v2-mantle/latest/gn

You can also find subgraphs hosted on The Graph's hosted service. For a full list, visit the The Graph Explorer but keep in mind that The Graph subgraphs may not be up-to-date.

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.

How to get information about the vaults

EulerVaults

With that query, you get all the vault information.

query Vaults {
  eulerVaults{
      id
      evc
      evault
      name
      borrowCap
      supplyCap
      dToken
      decimals
      permit2Address
      perspectives
      interestRateModel    
      collaterals # It's a list of vault addresses
      governonAdmin
      feeReceiver
      asset
      oracle
      creator
      symbol
      unitOfAccount
      interestFee
      state{
            vault
            totalShares
            totalBorrows
            accumulatedFees
            cash
            interestAccumulator
            interestRate
            supplyApy
            borrowApy
            timestamp
      }
  }  
}
  • The state parameter will be updated with the vaultState events, and you can check the historical data directly from the raw event.
query VaultStateHistory($address: ID!) {
  vaultStatuses(where:{vault:$address$}){
    vault
    totalShares
    totalBorrows
    accumulatedFees
    cash
    interestAccumulator
    interestRate
    supplyApy
    borrowApy
    timestamp
  }
}

EulerEarn

query EulerEarnVaults {
  eulerEarnVaults {
    id
    name
    owner
    asset
    creator
    curator
    evc
    feeReceiver
    guardian
    pendingGuardian
    pendingGuardianValidAt
    pendingTimelock
    pendingTimelockValidAt
    performanceFee
    perspectives 
    supplyQueue
    symbol
    timelock
    totalAllocated
    totalAssets
    totalLostAssets
    totalShares
    totalSupply
    transactionHash
    strategies {
      id
      allocatedAssets
      availableAssets
      currentAllocationCap
      pendingAllocationCapValidAt
      pendingAllocationCap
      pendingAllocationCapValidAt
      removableAt
      strategy # eulerVault
    }
    blockNumber
    blockTimestamp
    
  }
}

EulerSwapPools

With that query you can get the current pools created

query EulerSwapPools {
  eulerSwapPools {
    active
    asset0
    asset1
    blockNumber
    blockTimestamp
    concentrationX
    concentrationY
    currReserve0
    currReserve1
    equilibriumReserve0
    equilibriumReserve1
    eulerAccount
    fee
    id
    pool
    priceX
    priceY
    protocolFee
    protocolFeeRecipient
    transactionHash
    vault0
    vault1
  }
}

Now we can show the history of the swaps

query EulerSwapSwaps {
  eulerSwaps {
    amount0In
    amount0Out
    amount1In
    amount1Out
    blockNumber
    blockTimestamp
    from
    id
    pool
    reserve0
    reserve1
    sender
    to
    transactionHash
  }
}

search by pool

query EulerSwapSwapsByPool($pool: Bytes!) {
  eulerSwaps(where:{pool: $pool }) {
    amount0In
    amount0Out
    amount1In
    amount1Out
    blockNumber
    blockTimestamp
    from
    id
    pool
    reserve0
    reserve1
    sender
    to
    transactionHash
  }
}