# Entities

* [`Pool`](#pool)
* [`DailyPoolStatus`](#dailypoolstatus)
* [`HourlyPoolStatus`](#hourlypoolstatus)
* [`Token`](#token)
* [`Swap`](#swap)
* [`Pair`](#pair)
* [`TransactionSource`](#transactionsource)
* [`User`](#user)
* [`Deposit`](#deposit)
* [`CoveDeposit`](#covedeposit)
* [`Withdrawal`](#withdrawal)
* [`CoveWithdrawal`](#covewithdrawal)
* [`AllCoveStatus`](#allcovestatus)
* [`AllCoveHistoricStatus`](#allcovehistoricstatus)
* [`Cove`](#cove)
* [`HistoricCoveStatus`](#historiccovestatus)
* [`UserCoveStake`](#usercovestake)

## Pool

Description: get specific details of the pool

| Field            | Type                                                                                                                                          | Description                                                                         |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| id               | ID!                                                                                                                                           | pool address                                                                        |
| volumeUSD        | BigDecimal!                                                                                                                                   | all time USD swapped                                                                |
| avgTrade         | BigDecimal!                                                                                                                                   | Average trade amount of all time in USD                                             |
| txCount          | BigInt!                                                                                                                                       | all time number of transactions                                                     |
| feeUSD           | BigDecimal!                                                                                                                                   | all time fee collected in USD                                                       |
| avgTradeFee      | BigDecimal                                                                                                                                    | Average trade fee of all time in USD                                                |
| avgFeeInBps      | BigDecimal!                                                                                                                                   | average fee in basis points                                                         |
| depositCount     | BigInt!                                                                                                                                       | all time deposits count                                                             |
| avgDeposit       | BigDecimal!                                                                                                                                   | Average deposit amount of all time in USD                                           |
| depositedUSD     | BigDecimal!                                                                                                                                   | all time deposited amount in USD                                                    |
| withdrawalCount  | BigInt!                                                                                                                                       | all time withdrawals count                                                          |
| avgWithdraw      | BigDecimal!                                                                                                                                   | Average withdrawal amount of all time in USD                                        |
| withdrewUSD      | BigDecimal!                                                                                                                                   | all time withdrew amount in USD                                                     |
| uniqueUsers      | BigInt!                                                                                                                                       | number of all time unique users                                                     |
| poolTokensSupply | BigInt!                                                                                                                                       | number of pool tokens supplied by the smart contract (used for time-travel queries) |
| dailyHistory     | [DailyPoolStatus](#dailypoolstatus) !                                                                                                         | time snapshots of pool data                                                         |
| hourlyHistory    | [HourlyPoolStatus](#hourlypoolstatus)[`!`](https://docs.clipper.exchange/disclaimers-and-technical/smart-contracts/subgraph/broken-reference) | time snapshots of pool data                                                         |

## DailyPoolStatus

Description: get specific details of the daily pool status

| Field            | Type        | Description                                                      |
| ---------------- | ----------- | ---------------------------------------------------------------- |
| id               | ID!         | {pool address}-{fromTimestamp}-{toTimestamp}                     |
| from             | BigInt!     | assets pool changed from                                         |
| to               | BigInt!     | assets pool changed to                                           |
| pool             | Pool!       | pointer to the pool                                              |
| poolTokensSupply | BigInt!     | snapshot of number of pool tokens supplied by the smart contract |
| txCount          | BigInt!     | number of transactions during period                             |
| volumeUSD        | BigDecimal! | volume in USD                                                    |
| avgTrade         | BigDecimal! | Average trade amount in USD                                      |
| feeUSD           | BigDecimal! | fee collected in USD                                             |
| avgTradeFee      | BigDecimal  | Average trade fee in USD                                         |
| avgFeeInBps      | BigDecimal! | average fee in basis points                                      |
| depositCount     | BigInt!     | number of deposits during daily period                           |
| depositedUSD     | BigDecimal! | deposited amount during daily period                             |
| avgDeposit       | BigDecimal! | Average deposited amount of USD during daily period              |
| withdrawalCount  | BigInt!     | number of withdrawals during daily period                        |
| withdrewUSD      | BigDecimal! | withdrew amount during daily period                              |
| avgWithdraw      | BigDecimal! | Average withdrawal amount of USD during daily period             |
| poolValue        | BigDecimal! | # pool liquidity value at the beginning of the day               |

## HourlyPoolStatus

Description: get specific details of the hourly pool status

| Field           | Type        | Description                                           |
| --------------- | ----------- | ----------------------------------------------------- |
| id              | ID!         | {pool address}-{fromTimestamp}-{toTimestamp}          |
| from            | BigInt!     | assets pool changed from                              |
| to              | BigInt!     | assets pool changed to                                |
| pool            | Pool!       | pointer to the pool                                   |
| txCount         | BigInt!     | number of transactions during daily period            |
| volumeUSD       | BigDecimal! | volume in USD                                         |
| avgTrade        | BigDecimal! | Average trade amount of USD during hourly period      |
| feeUSD          | BigDecimal! | fee collected in USD                                  |
| avgTradeFee     | BigDecimal  | Average trade fee in USD                              |
| avgFeeInBps     | BigDecimal! | average fee in basis points                           |
| depositCount    | BigInt!     | number of deposits during hourly period               |
| depositedUSD    | BigDecimal! | deposited amount during hourly period                 |
| avgDeposit      | BigDecimal! | Average deposited amount of USD during hourly period  |
| withdrawalCount | BigInt!     | number of withdrawals during hourly period            |
| withdrewUSD     | BigDecimal! | withdrew amount during hourly period                  |
| avgWithdraw     | BigDecimal! | Average withdrawal amount of USD during hourly period |

## Token

Description: get specific details of the token

| Field        | Type        | Description                                            |
| ------------ | ----------- | ------------------------------------------------------ |
| id           | ID!         | token address                                          |
| symbol       | String!     | token symbol                                           |
| name         | String!     | token name                                             |
| decimals     | BigInt!     | token decimals                                         |
| txCount      | BigInt!     | transactions across all pools that include this token  |
| volume       | BigDecimal! | volume in token units                                  |
| volumeUSD    | BigDecimal! | volume in derived USD                                  |
| tvl          | BigDecimal! | total value locked in pool (supports additional pools) |
| tvlUSD       | BigDecimal! | total value locked from derived usd                    |
| deposited    | BigDecimal! | total amount deposited in pool                         |
| depositedUSD | BigDecimal! | total amount in USD deposited in pool                  |
| type         | TokenType   | type of token (longtail or shorttail)                  |
| cove         | Cove        | if type is longtail, cove should be set                |

## Swap

Description: get specific details of the swap

| Field               | Type               | Description                                |
| ------------------- | ------------------ | ------------------------------------------ |
| id                  | ID!                | transaction hash + "-" + event log index   |
| pool                | Pool               | pointer to the pool                        |
| transaction         | Bytes!             | pointer to transaction                     |
| timestamp           | BigInt!            | timestamp of transaction                   |
| inToken             | Token!             | allow indexing by tokens                   |
| outToken            | Token!             | allow indexing by tokens                   |
| sender              | User!              | sender of the swap                         |
| recipient           | Bytes!             | recipient of the swap                      |
| origin              | Bytes!             | the EOA that initiated the txn# txn origin |
| amountIn            | BigDecimal!        | delta of inAsset swapped                   |
| amountOut           | BigDecimal!        | delta of outAsset swapped                  |
| amountInUSD         | BigDecimal!        | derived info                               |
| amountOutUSD        | BigDecimal!        | derived info                               |
| feeUSD              | BigDecimal!        | fee of swap in USD                         |
| pricePerInputToken  | BigDecimal!        | price of token swapped                     |
| pricePerOutputToken | BigDecimal!        | price of toeken received                   |
| transactionSource   | TransactionSource! | origin of the transaction                  |
| logIndex            | BigInt             | order within the txn                       |
| pair                | Pair               | pair traded (not required for cove swaps)  |
| swapType            | SwapType           | cove asset or core asset                   |
| cove                | Cove               | if type is longtail, cove should be set    |

## Pair

Description: get specific details of the Pair

| Field     | Type                                                                                                                  | Description                            |
| --------- | --------------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
| id        | ID!                                                                                                                   | asset 1 + asset 2 address              |
| asset0    | Token!                                                                                                                | asset 0 of the pair                    |
| asset1    | Token!                                                                                                                | asset 1 of the pair                    |
| txCount   | BigInt!                                                                                                               | all time transaction on this pair      |
| volumeUSD | BigDecimal!                                                                                                           | volume of all time transactions in USD |
| swaps     | [Swap](#swap)[`!`](https://docs.clipper.exchange/disclaimers-and-technical/smart-contracts/subgraph/broken-reference) | swaps data                             |

## TransactionSource

Description: get specific details of the transaction source

| Field   | Type                                                                                                                  | Description                               |
| ------- | --------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- |
| id      | ID!                                                                                                                   | origin name                               |
| txCount | BigInt!                                                                                                               | number of all time transactions by source |
| swaps   | [Swap](#swap)[`!`](https://docs.clipper.exchange/disclaimers-and-technical/smart-contracts/subgraph/broken-reference) | derived swaps                             |

## User

Description: get specific details of the user

| Field            | Type                                                                                                                  | Description                             |
| ---------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------- |
| id               | ID!                                                                                                                   | wallet address                          |
| txCount          | BigInt!                                                                                                               | number of all time transactions by user |
| firstTxTimestamp | BigInt!                                                                                                               | timestamp of first transaction          |
| lastTxTimestamp  | BigInt!                                                                                                               | timestamp of last transaction           |
| volumeUSD        | BigDecimal!                                                                                                           | total volume trade by user              |
| swaps            | [Swap](#swap)[`!`](https://docs.clipper.exchange/disclaimers-and-technical/smart-contracts/subgraph/broken-reference) | list of trades made by the user         |

## Deposit

Description: get specific details of the deposit

| Field      | Type        | Description                                                          |
| ---------- | ----------- | -------------------------------------------------------------------- |
| id         | ID!         | transaction hash                                                     |
| timestamp  | BigInt!     | timestamp of transaction                                             |
| pool       | Pool!       | pool deposited to                                                    |
| poolTokens | BigDecimal! | pool tokens received by the deposit                                  |
| amountUsd  | BigDecimal! | The equivalent usd value of received pool tokens at the moment of tx |
| depositor  | Bytes!      | sender of the transaction                                            |

## CoveDeposit

Description: get specific details of the cove deposit

| Field     | Type        | Description                                                   |
| --------- | ----------- | ------------------------------------------------------------- |
| id        | ID!         | transaction hash                                              |
| timestamp | BigInt!     | time stamp of deposit                                         |
| cove      | Cove!       | coves are made up of separate user-generating liquidity pools |
| amountUsd | BigDecimal! | captured usd value at the moment of transaction               |
| depositor | Bytes!      | address of depositor                                          |

## Withdrawal

Description: get specific details of the withdrawal

| Field      | Type        | Description                                     |
| ---------- | ----------- | ----------------------------------------------- |
| id         | ID!         | transaction hash                                |
| timestamp  | BigInt!     | timestamp of withdrawal                         |
| pool       | Pool!       | pool to where the whitdrawal was done           |
| poolTokens | BigDecimal! | Pool tokens burned to withdraw                  |
| amountUsd  | BigDecimal! | captured usd value at the moment of transaction |
| withdrawer | Bytes!      | withdrawer of the transaction                   |

## CoveWithdrawal

Description: get specific details of the cove withdrawal

| Field      | Type        | Description                                                   |
| ---------- | ----------- | ------------------------------------------------------------- |
| id         | ID!         | transaction hash                                              |
| timestamp  | BigInt!     | timestamp of withdrawal                                       |
| cove       | Cove!       | coves are made up of separate user-generating liquidity pools |
| amountUsd  | BigDecimal! | captured usd value at the moment of transaction               |
| withdrawer | Bytes!      | withdrawer of the transaction                                 |

## AllCoveStatus

Description: get specific details of all cove status

| Field           | Type        | Description                            |
| --------------- | ----------- | -------------------------------------- |
| id              | ID!         | Id of smart contract                   |
| volumeUSD       | BigDecimal! | volume of all time transactions in USD |
| txCount         | Int!        | total transactons of coves             |
| depositCount    | Int!        | total deposits of coves                |
| withdrawalCount | Int!        | total withdrawal of coves              |

## AllCoveHistoricStatus

Description: get specific details of all cove historic status

| Field           | Type                | Description                |
| --------------- | ------------------- | -------------------------- |
| id              | ID!                 | Id of smart contract       |
| from            | BigInt!             | assets pool changed from   |
| to              | BigInt!             | assets pool changed to     |
| volumeUSD       | BigDecimal!         | historic volume            |
| txCount         | Int!                | historic transaction count |
| depositCount    | Int!                | historic deposit count     |
| withdrawalCount | Int!                | historic withdrawal count  |
| statusType      | StatusHistoricType! | historic status            |

## Cove

Description: get specific details of cove

| Field               | Type        | Description                                                 |
| ------------------- | ----------- | ----------------------------------------------------------- |
| id                  | ID!         | cove token address                                          |
| longtailAsset       | Token!      | pointer to CoveAsset                                        |
| coveAssetName       | String!     | duplicate of longtailAsset for easy filtering               |
| coveAssetSymbol     | String!     | the asset symbol of cove                                    |
| volumeUSD           | BigDecimal! | all time USD swapped                                        |
| swapCount           | BigInt!     | all time number of swaps using this cove                    |
| poolTokenAmount     | BigDecimal! | tvl of pool token and long tail currently held by the cove. |
| longtailTokenAmount | BigDecimal! | tvl of longtail tokens                                      |
| tvlUSD              | BigDecimal! | poolTokenAmount times the price of pool token times two     |
| createdAt           | BigInt!     | timestamp to when the cove was opened                       |
| transaction         | Bytes!      | transaction that initialized the cove.                      |
| depositCount        | BigInt!     | all time deposits count                                     |
| withdrawalCount     | BigInt!     | all time withdrawals count                                  |

## HistoricCoveStatus

Description: get specific details of historic cove status

| Field           | Type                | Description                                                   |
| --------------- | ------------------- | ------------------------------------------------------------- |
| id              | ID!                 | {coveId}-{fromTimestamp}-{toTimestamp}                        |
| cove            | Cove!               | coves are made up of separate user-generating liquidity pools |
| from            | BigInt!             | assets pool changed from                                      |
| to              | BigInt!             | assets pool changed to                                        |
| volumeUSD       | BigDecimal!         | historic valume in USD                                        |
| price           | BigDecimal!         | historic price                                                |
| txCount         | Int!                | historic transaction count                                    |
| depositCount    | Int!                | historic deposit count                                        |
| withdrawalCount | Int!                | historic withdrawal count                                     |
| statusType      | StatusHistoricType! | historic status                                               |

## UserCoveStake

Description: get specific details of user cove stake

| Field         | Type     | Description               |
| ------------- | -------- | ------------------------- |
| id            | ID!      | {coveId}-{wallet}         |
| cove          | Cove!    | cove user transacted with |
| user          | Bytes!   | address of user           |
| depositTokens | BigInt!  | user deposited tokens     |
| active        | Boolean! | active status of user     |
