> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blockdb.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Liquidity Pool Swap Fees

> Per-swap fee accounting with LP, protocol & extra-destination splits. Historical & real-time across 10 EVM chains.

## Overview

* **Dataset ID:** `0303`
* **Table:** `blockdb_evm.b0303_liquidity_pools_swap_fees_v1`
* **Description:** Per-swap fee accounting: executed swap sizes plus computed fee amounts using the pool's fee terms (`blockdb_evm.b0212_liquidity_pools_fee_terms_v1`).
* **Primary key:** `(pool_uid, token_in, token_out, block_number, tx_index, log_index)`
* **API:** [POST /evm/swaps/fees](/api-reference/evm/swaps/swap-fees)
* **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Swap-Fees-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0303_liquidity_pools_swap_fees_v1.csv?download=true)
* **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Swap-Fees-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0303_liquidity_pools_swap_fees_v1.json?download=true)

## Sample Viewer

<Frame>
  <iframe src="https://huggingface.co/datasets/BlockDB/Swap-Fees-Ethereum-And-EVM-Cryptocurrency-Data/embed/viewer/default/train" frameborder="0" width="100%" height="600px" />
</Frame>

## Columns

| Column                | Type            | Description                                                                               |
| --------------------- | --------------- | ----------------------------------------------------------------------------------------- |
| `pool_uid`            | `BYTEA`         | Pool identifier (internal). Join to pool metadata and fee terms.                          |
| `exchange_id`         | `INTEGER`       | Exchange/DEX identifier.                                                                  |
| `type_id`             | `INTEGER`       | Pool type identifier (FK to liquidity\_pool\_types).                                      |
| `block_number`        | `BIGINT`        | Block height where the swap was observed.                                                 |
| `block_time`          | `TIMESTAMPTZ`   | UTC timestamp of the block containing the swap event.                                     |
| `tx_index`            | `INTEGER`       | Transaction index within the block.                                                       |
| `log_index`           | `INTEGER`       | Log index within the transaction.                                                         |
| `token_in`            | `BYTEA`         | 20-byte address of the input token (direction of swap).                                   |
| `token_out`           | `BYTEA`         | 20-byte address of the output token (direction of swap).                                  |
| `fee_token`           | `BYTEA`         | 20-byte token address the fee is denominated in (must equal `token_in` or `token_out`).   |
| `amount_in`           | `NUMERIC(78,0)` | Executed input amount (raw token units).                                                  |
| `amount_out`          | `NUMERIC(78,0)` | Executed output amount (raw token units).                                                 |
| `fee_amount_total`    | `NUMERIC(78,0)` | Total fee amount in `fee_token` units (raw).                                              |
| `fee_amount_user`     | `NUMERIC(78,0)` | User/LP share of fees in `fee_token` units (nullable).                                    |
| `fee_amount_protocol` | `NUMERIC(78,0)` | Protocol share of fees in `fee_token` units (nullable).                                   |
| `fee_amount_extra`    | `NUMERIC(78,0)` | Extra destination share of fees in `fee_token` units (nullable).                          |
| `_tracing_id`         | `BYTEA`         | Deterministic BlockDB lineage identifier for the swap-fee record.                         |
| `_parent_tracing_ids` | `BYTEA[]`       | Tracing IDs for upstream derived records referenced during computation (e.g., fee terms). |
| `_created_at`         | `TIMESTAMPTZ`   | Record creation timestamp.                                                                |
| `_updated_at`         | `TIMESTAMPTZ`   | Record update timestamp.                                                                  |

## Use Cases

* Pool revenue attribution (LP vs protocol vs extra destinations)
* Backtesting fee-sensitive execution and routing strategies
* Inputs to pool yield/ROI modeling (feeds `blockdb_evm.b0411_liquidity_pools_yields_v1`)
* Monitoring fee regime changes and their downstream impacts

## Related Datasets

<CardGroup cols={3}>
  <Card title="Liquidity Pools" icon="water" href="/data-catalog/evm/entities/liquidity-pools">
    Pool registry for the fee-generating venues.
  </Card>

  <Card title="Liquidity Pools Yields" icon="chart-line" href="/data-catalog/evm/yields/liquidity-pools-yields">
    Yield windows computed from these swap fees.
  </Card>

  <Card title="Swap Prints" icon="arrows-left-right" href="/data-catalog/evm/prices/token-to-token-prices-swap-prints">
    Per-swap price observations from the same events.
  </Card>
</CardGroup>
