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
Key Points
Each
PandaPoolhas exactly twoTokenentities (base and Panda)PriceSnapshotentities are created for specific timeframesHolderentities track token ownershipPandaPoolSwapentities are immutable records
Best Practices
Querying Efficiently
Use Specific Fields
Pagination
Field Selection
Request only needed fields
Use fragments for common field sets
Consider query complexity
Error Handling
Entity Not Found
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?
Check Known Issues
Join our Developer Discord
Last updated