Entities

Overview

This sections briefs about all the available entities within Bunicorn Stable Subgraph. Entities define the schema of the subgraph, and represent the data that can be queried. Each entity has a set of fields that store relevant information about the entity. To see an interactive sandbox of all entities see the Graph Explorer.

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.

BuniCornFactory

The BuniCornFactory entity stores aggregate information across all Stable pools. It can be used to view stats about total liquidity, volume, amount of pools and more.

Token

Stores aggregated information for a specific token across all pools that token is included in.

pair

Includes information about token pairs, volume information, liquidity information, and more.

pool

Information about a pool. Includes information about to each token within the pool like minimum/maximum price per token, liquidity burn, mint and swaps, virtual reserves, amplification factor and more. The pool entity mirrors the pool smart contract, and also contains aggregated information about use.

User

A user entity is created for any address that provides liquidity to a pool on one of the Bunicorn Stable Pools. This entity can be used to track open positions for users. LiquidityPosition entities can be referenced to get specific data about each position.

LiquidityPosition

This entity is used to store data about a user's liquidity position. This information, along with information from the pool itself can be used to provide position sizes, token deposits, and more.

LiquidityPositionSnapshot

This entity provides snapshot or a gist of the users liquidity position, like token price, total supply, etc.

Transaction

Transaction entities are created for each BSC transaction done through the Stable contracts. This subgraph tracks Mint, Burn, and Swap events on the Stable core contracts. Each transaction contains 3 arrays, and at least one of these arrays has a length = 1.

Mint

Mint entities are created for every emitted Mint event on the Stable 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 pools.

Burn

Burn entities are created for every emitted Burn event on the Stable 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 pools.

Swap

Swap entities are created for each token swap within a pool. 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.

Historical Entities

Since, tracking historic data on-chain is a tiresome job, and is expensive for grouped data, 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.

BuniCornDayData

Tracks data across all pools aggregated into a daily bucket.

Pair Hour Data

Tracks pair data across each hour.

Pair Day Data

Tracks pair data across each Day.

pool Hour Data

Tracks pool data across each Hour.

pool Day Data

Tracks pool data across each day.

Token Day Data

Tracks token data aggregated across all pools that include token.

Last updated