Entity Reference

Overview

The Panda Protocol subgraph defines several core entities that model the protocol's data. Each entity represents a specific aspect of the protocol's state and behavior.

Core Entities

PandaPool

Represents an individual Panda liquidity pool. Each pool manages a pair of tokens and tracks trading activity.

type PandaPool @entity {
    id: ID!                     # Pool contract address
    baseToken: Token!           # The base currency token
    pandaToken: Token!          # The Panda token being traded
    price: BigDecimal!         # Current token price
    volumeUSD: BigDecimal!     # Total USD volume
    marketCapBase: BigDecimal! # Market cap in base currency terms
    marketCapUSD: BigDecimal!  # Market cap in USD termes
    swapsCount: BigInt!        # Total number of swaps
    lastSwapTimestamp: BigInt! # Last swap timestamp
    graduated: Boolean!        # Graduation status
    raised: BigDecimal!       # amount of tokens raised
    tokensInPool: BigDecimal! # Total token in the pool
    pandaReserve: BigDecimal! # Panda token reserve
    baseReserve: BigDecimal!  # Base token reserve
    startPrice: BigDecimal!   # Initial token price
}

Common Queries

Token

Tracks both Panda and base tokens in the protocol.

Example Queries

PandaPoolSwap

Records individual swap transactions within pools.

Querying Swaps

PriceSnapshot

Time-based price aggregation for historical analysis.

Historical Data Queries

Entity Relationships

Primary Relationships

Drawing

Key Points

  • Each PandaPool has exactly two Token entities (base and Panda)

  • PriceSnapshot entities are created for specific timeframes

  • Holder entities track token ownership

  • PandaPoolSwap entities are immutable records

Best Practices

Querying Efficiently

  1. Use Specific Fields

  1. Pagination

  1. Field Selection

  • Request only needed fields

  • Use fragments for common field sets

  • Consider query complexity

Error Handling

  1. Entity Not Found

  1. Invalid Queries

  • Validate entity existence

  • Check field value ranges

  • Handle pagination edges

Next Steps

Continue to:

  • Queries Documentation for advanced query patterns

  • Advanced Usage for optimization techniques

Support

Need help with entities?

Last updated