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

# Uniswap

> Uniswap Schema Description and Methodology

This schema contains comprehensive datasets for tracking Uniswap fundamental data across multiple metrics categories, including trading activity, fees, revenue distribution, liquidity, treasury, and market data.

## Available Tables

Uniswap data is available in several tables:

* **ez\_metrics**: Main aggregated metrics for the entire Uniswap protocol
* **ez\_metrics\_by\_chain**: Metrics broken down by blockchain (Ethereum, Arbitrum, Optimism, etc.)
* **ez\_metrics\_by\_pool**: Metrics broken down by individual liquidity pools
* **ez\_metrics\_by\_token**: Metrics broken down by token

## Table Schema

### Trading and Activity Metrics

| Table Name  | Column Name  | Description                                               |
| ----------- | ------------ | --------------------------------------------------------- |
| ez\_metrics | spot\_volume | The total trading volume on Uniswap v2 and v3             |
| ez\_metrics | spot\_dau    | The number of daily active traders on Uniswap v2 and v3   |
| ez\_metrics | spot\_txns   | The number of daily trades on Uniswap v2 and v3           |
| ez\_metrics | tvl          | The total value locked across all Uniswap liquidity pools |
| ez\_metrics | dau          | Legacy naming for spot\_dau                               |
| ez\_metrics | txns         | Legacy naming for spot\_txns                              |

### Fee and Revenue Metrics

| Table Name  | Column Name                    | Description                                                                 |
| ----------- | ------------------------------ | --------------------------------------------------------------------------- |
| ez\_metrics | fees                           | The total USD value generated through trading fees across Uniswap v2 and v3 |
| ez\_metrics | spot\_fees                     | The trading fees generated from swaps (same as fees)                        |
| ez\_metrics | service\_fee\_allocation       | The share of protocol revenue accrued to liquidity providers                |
| ez\_metrics | trading\_fees                  | Legacy naming for fees                                                      |
| ez\_metrics | fees                           | Legacy naming for fees                                                      |
| ez\_metrics | primary\_supply\_side\_revenue | Legacy naming for service\_fee\_allocation                                  |
| ez\_metrics | total\_supply\_side\_revenue   | Legacy naming for service\_fee\_allocation                                  |

### Token Incentives and Expenses

| Table Name  | Column Name        | Description                                                |
| ----------- | ------------------ | ---------------------------------------------------------- |
| ez\_metrics | token\_incentives  | The USD value of UNI tokens distributed as incentives      |
| ez\_metrics | total\_expenses    | The sum of token incentives and operating expenses         |
| ez\_metrics | protocol\_earnings | The difference between protocol revenue and total expenses |

### Treasury Metrics

| Table Name  | Column Name             | Description                                                       |
| ----------- | ----------------------- | ----------------------------------------------------------------- |
| ez\_metrics | treasury                | The USD value in the Uniswap protocol treasury                    |
| ez\_metrics | own\_token\_treasury    | The USD value of UNI tokens in the protocol treasury              |
| ez\_metrics | net\_treasury           | The USD value in the treasury excluding the protocol's own tokens |
| ez\_metrics | treausry\_value         | Legacy naming for treasury                                        |
| ez\_metrics | treasury\_native\_value | Legacy naming for treasury shown in native token amounts          |
| ez\_metrics | net\_treasury\_value    | Legacy naming for net\_treasury                                   |

### Market and Token Metrics

| Table Name  | Column Name                  | Description                                          |
| ----------- | ---------------------------- | ---------------------------------------------------- |
| ez\_metrics | price                        | The price of UNI token in USD                        |
| ez\_metrics | market\_cap                  | The market cap of UNI token in USD                   |
| ez\_metrics | fdmc                         | The fully diluted market cap of UNI token in USD     |
| ez\_metrics | token\_volume                | The trading volume of UNI token in USD               |
| ez\_metrics | token\_turnover\_circulating | The turnover of UNI based on circulating supply      |
| ez\_metrics | token\_turnover\_fdv         | The turnover of UNI based on fully diluted valuation |
| ez\_metrics | token\_holder\_count         | The number of unique UNI token holders               |

### Metrics by Chain

The `ez_metrics_by_chain` table provides a breakdown of Uniswap's performance across the various blockchains where the protocol is deployed. Based on the SQL file, here are the actual columns in this table:

| Table Name             | Column Name                      | Description                                                                                  |
| ---------------------- | -------------------------------- | -------------------------------------------------------------------------------------------- |
| ez\_metrics\_by\_chain | date                             | The date of the recorded metrics                                                             |
| ez\_metrics\_by\_chain | app                              | Always "uniswap" for consistency with other datasets                                         |
| ez\_metrics\_by\_chain | category                         | Always "DeFi" for categorization purposes                                                    |
| ez\_metrics\_by\_chain | chain                            | The specific blockchain (Ethereum, Arbitrum, Optimism, Avalanche, Polygon, Base, BSC, Blast) |
| ez\_metrics\_by\_chain | trading\_fees                    | The total USD value of fees generated on this chain                                          |
| ez\_metrics\_by\_chain | fees                             | Same as trading\_fees (legacy naming)                                                        |
| ez\_metrics\_by\_chain | primary\_supply\_side\_revenue   | The fees accrued to liquidity providers on this chain                                        |
| ez\_metrics\_by\_chain | total\_supply\_side\_revenue     | Same as primary\_supply\_side\_revenue                                                       |
| ez\_metrics\_by\_chain | secondary\_supply\_side\_revenue | Always 0 for Uniswap                                                                         |
| ez\_metrics\_by\_chain | protocol\_revenue                | Always 0 for Uniswap (all fees go to LPs)                                                    |
| ez\_metrics\_by\_chain | operating\_expenses              | Always 0 in this table                                                                       |
| ez\_metrics\_by\_chain | token\_incentives                | The USD value of token incentives on this chain                                              |
| ez\_metrics\_by\_chain | protocol\_earnings               | The negative of token\_incentives                                                            |
| ez\_metrics\_by\_chain | tvl                              | The total value locked in Uniswap on this specific chain                                     |
| ez\_metrics\_by\_chain | treasury\_value                  | The USD value in Uniswap's treasury for this chain                                           |
| ez\_metrics\_by\_chain | treasury\_native\_value          | The amount of native chain tokens in treasury                                                |
| ez\_metrics\_by\_chain | net\_treasury\_value             | The treasury value excluding UNI tokens                                                      |
| ez\_metrics\_by\_chain | net\_deposits                    | Same as TVL for this chain                                                                   |
| ez\_metrics\_by\_chain | trading\_volume                  | The total USD value of all swaps on this chain                                               |
| ez\_metrics\_by\_chain | unique\_traders                  | The number of unique addresses that made swaps                                               |
| ez\_metrics\_by\_chain | gas\_cost\_usd                   | The USD value of gas fees paid by users to the underlying blockchain                         |
| ez\_metrics\_by\_chain | spot\_dau                        | The number of daily active traders (same as unique\_traders)                                 |
| ez\_metrics\_by\_chain | spot\_volume                     | The trading volume (same as trading\_volume)                                                 |
| ez\_metrics\_by\_chain | fees                             | The total fees generated (same as trading\_fees)                                             |
| ez\_metrics\_by\_chain | service\_fee\_allocation         | Fees that go to liquidity providers                                                          |
| ez\_metrics\_by\_chain | treasury                         | Same as treasury\_value                                                                      |
| ez\_metrics\_by\_chain | own\_token\_treasury             | The USD value of UNI tokens in the treasury                                                  |
| ez\_metrics\_by\_chain | net\_treasury                    | Same as net\_treasury\_value                                                                 |
| ez\_metrics\_by\_chain | gas\_cost                        | Same as gas\_cost\_usd                                                                       |
| ez\_metrics\_by\_chain | gas\_cost\_native                | The amount of native tokens spent on gas fees                                                |

It's important to note that gas costs represent the fees paid by users to the underlying blockchain networks (like Ethereum, Arbitrum, etc.) for transaction execution, not fees paid to Uniswap itself. These gas costs vary significantly across chains and can impact user behavior.

This table is valuable for comparing Uniswap's adoption, trading volume, and TVL across different blockchains, and for understanding how different ecosystem factors (like gas costs) affect the protocol's performance on each chain.

### Metrics by Pool

The `ez_metrics_by_pool` table provides detailed metrics for each individual liquidity pool in the Uniswap ecosystem. This table is particularly valuable for analyzing the performance of specific token pairs across different Uniswap versions and blockchains.

In Uniswap, a pool represents a trading pair where users can swap one token for another. The pool contains liquidity for both tokens, allowing for these exchanges to occur. Users typically swap token\_0 to obtain token\_1, or vice versa.

| Table Name            | Column Name              | Description                                                                                  |
| --------------------- | ------------------------ | -------------------------------------------------------------------------------------------- |
| ez\_metrics\_by\_pool | pool                     | The unique address of the liquidity pool                                                     |
| ez\_metrics\_by\_pool | version                  | The Uniswap version (v2 or v3) - v3 introduced concentrated liquidity and multiple fee tiers |
| ez\_metrics\_by\_pool | chain                    | The blockchain network where the pool exists (Ethereum, Arbitrum, etc.)                      |
| ez\_metrics\_by\_pool | token\_0                 | The contract address of the first token in the pair                                          |
| ez\_metrics\_by\_pool | token\_1                 | The contract address of the second token in the pair                                         |
| ez\_metrics\_by\_pool | token\_0\_symbol         | The symbol of the first token (e.g., "WETH", "USDC")                                         |
| ez\_metrics\_by\_pool | token\_1\_symbol         | The symbol of the second token (e.g., "USDC", "WBTC")                                        |
| ez\_metrics\_by\_pool | trading\_volume          | Total USD value of all swaps in this specific pool                                           |
| ez\_metrics\_by\_pool | trading\_fees            | The total USD value of fees generated by this pool                                           |
| ez\_metrics\_by\_pool | unique\_traders          | The number of unique addresses that made swaps in this pool                                  |
| ez\_metrics\_by\_pool | gas\_cost\_usd           | The total USD value of gas spent on transactions in this pool                                |
| ez\_metrics\_by\_pool | gas\_cost\_native        | The amount of native tokens (ETH, MATIC, etc.) spent on gas                                  |
| ez\_metrics\_by\_pool | spot\_dau                | The number of daily active traders in this pool (same as unique\_traders)                    |
| ez\_metrics\_by\_pool | spot\_volume             | The trading volume in this pool (same as trading\_volume)                                    |
| ez\_metrics\_by\_pool | tvl                      | The total value locked in this specific liquidity pool                                       |
| ez\_metrics\_by\_pool | fees                     | The total fees generated by this pool (same as trading\_fees)                                |
| ez\_metrics\_by\_pool | service\_fee\_allocation | The portion of fees that goes to liquidity providers for this pool                           |

Uniswap v3 introduced the concept of concentrated liquidity, which allows liquidity providers to specify price ranges for their capital. This makes individual pool performance analysis even more important, as capital efficiency and fee generation can vary significantly between pools, even for the same token pair but with different fee tiers.

### Metrics by Token

The `ez_metrics_by_token` table provides detailed metrics for each token traded on Uniswap across different blockchains. This allows for analyzing how individual tokens perform within the Uniswap ecosystem, including their contribution to fees, treasury holdings, and trading volumes.

| Table Name             | Column Name               | Description                                                            |
| ---------------------- | ------------------------- | ---------------------------------------------------------------------- |
| ez\_metrics\_by\_token | date                      | The date of the recorded metrics                                       |
| ez\_metrics\_by\_token | token                     | The token symbol (e.g., "WETH", "USDC", "UNI")                         |
| ez\_metrics\_by\_token | chain                     | The blockchain network where the token is traded                       |
| ez\_metrics\_by\_token | trading\_fees             | The total USD value of fees generated from trades involving this token |
| ez\_metrics\_by\_token | fees\_native              | The amount of fees generated in native token units                     |
| ez\_metrics\_by\_token | treasury\_value           | The USD value of this token held in Uniswap's treasury                 |
| ez\_metrics\_by\_token | treasury\_native\_value   | The amount of this token held in the treasury in native units          |
| ez\_metrics\_by\_token | net\_treasury\_value      | The USD value of this token in treasury (excluding UNI tokens)         |
| ez\_metrics\_by\_token | tvl                       | The total value locked in Uniswap pools containing this token          |
| ez\_metrics\_by\_token | spot\_fees                | The trading fees in USD (same as trading\_fees)                        |
| ez\_metrics\_by\_token | fees                      | The total fees generated from this token in USD                        |
| ez\_metrics\_by\_token | spot\_fees\_native        | The trading fees in the token's native units                           |
| ez\_metrics\_by\_token | fees\_native              | The total fees in the token's native units                             |
| ez\_metrics\_by\_token | token\_incentives\_native | The amount of token incentives distributed in native units             |
| ez\_metrics\_by\_token | token\_incentives         | The USD value of token incentives distributed                          |
| ez\_metrics\_by\_token | treasury                  | The USD value in treasury (same as treasury\_value)                    |
| ez\_metrics\_by\_token | net\_treasury             | The USD value in treasury excluding UNI (same as net\_treasury\_value) |
| ez\_metrics\_by\_token | own\_token\_treasury      | The USD value of UNI tokens in the treasury (only for UNI token)       |

This table is particularly useful for:

* Tracking which tokens generate the most fees on Uniswap
* Monitoring treasury composition over time
* Analyzing which tokens have the most liquidity (TVL) on the platform
* Comparing token performance across different blockchains

## Sample Queries

### Basic Protocol Activity Query

```sql theme={null}
-- Pull fundamental activity data for the Uniswap protocol
SELECT
    date,
    spot_volume,
    spot_dau,
    spot_txns,
    tvl,
    price
FROM
    art_share.uniswap.ez_metrics
WHERE
    date >= DATEADD(month, -3, CURRENT_DATE())
ORDER BY
    date ASC
```

### Revenue and Cash Flow Analysis

```sql theme={null}
-- Analyze Uniswap revenue and fees
SELECT
    date,
    fees,
    service_fee_allocation,
    token_incentives,
    total_expenses
FROM
    art_share.uniswap.ez_metrics
WHERE
    date >= DATEADD(month, -3, CURRENT_DATE())
ORDER BY
    date ASC
```

### Treasury Analysis

```sql theme={null}
-- Track Uniswap treasury composition
SELECT
    date,
    treasury,
    own_token_treasury,
    net_treasury,
    price
FROM
    art_share.uniswap.ez_metrics
WHERE
    date >= DATEADD(month, -3, CURRENT_DATE())
ORDER BY
    date ASC
```

### Cross-Chain Comparison

```sql theme={null}
-- Compare Uniswap metrics across different blockchains
SELECT
    date,
    chain,
    spot_volume,
    spot_dau,
    tvl,
    fees
FROM
    art_share.uniswap.ez_metrics_by_chain
WHERE
    date >= DATEADD(month, -1, CURRENT_DATE())
ORDER BY
    chain, date ASC
```

### Top Pools Analysis

```sql theme={null}
-- Analyze top Uniswap pools by volume
SELECT
    date,
    chain,
    version,
    pool,
    token_0_symbol,
    token_1_symbol,
    spot_volume,
    spot_dau,
    tvl
FROM
    art_share.uniswap.ez_metrics_by_pool
WHERE
    date = DATEADD(day, -1, CURRENT_DATE())
ORDER BY
    spot_volume DESC
LIMIT 10
```

### Token-specific Analysis

```sql theme={null}
-- Analyze specific token metrics across the Uniswap protocol
SELECT
    date,
    token,
    chain,
    tvl,
    spot_fees,
    fees
FROM
    art_share.uniswap.ez_metrics_by_token
WHERE
    date >= DATEADD(month, -1, CURRENT_DATE())
    AND token IN ('USDC', 'WETH', 'WBTC')
ORDER BY
    token, date ASC
```

### Protocol Economics Analysis

```sql theme={null}
-- Analyze relationship between TVL, trading volume, and fees
SELECT
    date,
    tvl,
    spot_volume,
    fees,
    fees / spot_volume * 100 as fee_percentage,
    spot_volume / tvl as capital_efficiency
FROM
    art_share.uniswap.ez_metrics
WHERE
    date >= DATEADD(month, -3, CURRENT_DATE())
ORDER BY
    date ASC
```

### User and Holder Growth Analysis

```sql theme={null}
-- Track Uniswap user and token holder growth
SELECT
    date,
    spot_dau,
    token_holder_count,
    price,
    market_cap
FROM
    art_share.uniswap.ez_metrics
WHERE
    date >= DATEADD(month, -6, CURRENT_DATE())
ORDER BY
    date ASC
```
