Entities
Last updated
Last updated
Entities define the schema of the subgraph, and represent the data that can be queried. Within each entity are sets of fields that store useful information related to the entity. Below is a list of the available entities within the EmberSwap Subgraph, and descriptions for the available fields.
Each entity is defined with a value type, which will always be a base AssemblyScript type, or a custom type provided by The Graph's custom TypeScript library. For more information on value types see here.
The EmberSwap Factory entity is responsible for storing aggregate information across all EmberSwap pairs. It can be used to view stats about total liquidity, volume, amount of pairs and more. There is only one EmberSwapFactory entity in the subgraph.
Field Name | Value Type | Description |
---|---|---|
Stores aggregated information for a specific token across all pairs that token is included in.
Field Name | Value Type | Description |
---|---|---|
Information about a pair. Includes references to each token within the pair, volume information, liquidity information, and more. The pair entity mirrors the pair smart contract, and also contains aggregated information about use.
A user entity is created for any address that provides liquidity to a pool on EmberSwap. This entity can be used to track open positions for users. LiquidityPosition entities can be referenced to get specific data about each position.
This entity is used to store data about a user's liquidity position. This information, along with information from the pair itself can be used to provide position sizes, token deposits, and more.
Transaction entities are created for each smartBCH transaction that contains an interaction within EmberSwap contracts. This subgraph tracks Mint, Burn, and Swap events on the EmberSwap core contracts. Each transaction contains 3 arrays, and at least one of these arrays has a length of 1.
Mint entities are created for every emitted Mint event on the EmberSwap core contracts. The Mint entity stores key data about the event like token amounts, who sent the transaction, who received the liquidity, and more. This entity can be used to track liquidity provisions on pairs.
Burn entities are created for every emitted Burn event on the EmberSwap core contracts. The Burn entity stores key data about the event like token amounts, who burned LP tokens, who received tokens, and more. This entity can be used to track liquidity removals on pairs.
Swap entities are created for each token swap within a pair. The Swap entity can be used to get things like swap size (in tokens and USD), sender, recipient and more. See the Swap overview page for more information on amounts.
The Bundle is used as a global store of derived BCH price in USD. Because there is no guaranteed common base token across pairs, a global reference of USD price is useful for deriving other USD values. The Bundle entity stores an updated weighted average of BCH<->Stablecoin pair prices. This provides a strong estimate for the USD price of BCH that can be used in other places in the subgraph.
The subgraph tracks aggregated information grouped by days to provide insights to daily activity on EmberSwap. While time travel queries can be used for direct comparison against values in the past, it is much more expensive to query grouped data. For this reason the subgraph tracks information grouped in daily buckets, using timestamps provided by contract events. These entities can be used to query things like total volume on a given day, price of a token on a given day, etc.
For each DayData type, a new entity is created each day.
Tracks data across all pairs aggregated into a daily bucket.
Tracks pair data across each day.
Tracks token data aggregated across all pairs that include token.
Field Name | Value Type | Description |
---|---|---|
Field Name | Value Type | Description |
---|---|---|
Field Name | Value Type | Description |
---|---|---|
Field Name | Value Type | Description |
---|---|---|
Field Name | Value Type | Description |
---|---|---|
Field Name | Value Type | Description |
---|---|---|
Field Name | Value Type | Description |
---|---|---|
Field Name | Value Type | Description |
---|---|---|
Field Name | Value Type | Description |
---|---|---|
Field Name | Value Type | Description |
---|---|---|
Field Name | Value Type | Description |
---|---|---|