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

# Trades Enriched

The `dex.trades_enriched` table contains every row of `dex.trades`, with the same columns, plus `usd_amount_adjusted`, `is_flagged` and `flagged_details` from `dex.trades_flagged`. Nothing is removed: flagged trades keep their original `usd_amount`, and `usd_amount_adjusted` is null on them, so `sum(usd_amount_adjusted)` gives volume without wash and other inorganic trades.

### Flagged Trades

`is_flagged` is true when the trade is in [`dex.trades_flagged`](/historical-data/supported-blockchains/evm/core-schemas/dex/trades-flagged). A trade is flagged by the flag registry, or by rules that find bad tokens (`supply_shock_v1`, `self_issued_v1`) and same-pool round trips (`same_pool_roundtrip_v1`). For how each rule works, with examples, see [How Trades Are Flagged](/historical-data/supported-blockchains/evm/core-schemas/dex/trades-flagged/methodology).

* Volume without flagged trades: `sum(usd_amount_adjusted)`.
* Flagged volume: `sum(usd_amount) - sum(usd_amount_adjusted)`.
* One rule only: `array_contains('same_pool_roundtrip_v1'::variant, flagged_details:reasons)`.

### Table Columns

`_str` columns are numeric fields cast to `varchar` to retain precision.

Unique Key: `transaction_hash`, `unique_id`

| Column Name | Data Type | Description |
| - | - | - |
| project | VARCHAR | The project (decentralized exchange) of the liquidity pool that the swap occurred from. |
| protocol | VARCHAR | DEX protocol (& version, if applicable) of the contract address facilitating the swap. |
| liquidity\_pool\_address | VARCHAR | Contract address of the liquidity pool holding the asset. For protocol without the concept of LP such as airswap, this will be null. |
| sender\_address | VARCHAR | The address of the sender emitted on the swap event logs. This can be a router or pool address. |
| to\_address | VARCHAR | Address of the recipient emitted on the swap event logs. For example, recipient\_address from the uniswap v3 swap event log. |
| token\_sold\_address | VARCHAR | Token address of the token sold. |
| token\_sold\_name | VARCHAR | Name of the token sold. |
| token\_sold\_symbol | VARCHAR | Symbol of the token sold. |
| token\_sold\_decimals | BIGINT | Token decimals of the token sold. |
| token\_sold\_amount\_raw\_str | VARCHAR | Raw amount of tokens sold (unnormalized) in string. |
| token\_sold\_amount\_raw | FLOAT | Raw amount of tokens sold (unnormalized). |
| token\_sold\_amount\_str | VARCHAR | Amount of tokens sold in string. |
| token\_sold\_amount | FLOAT | Amount of tokens sold. |
| usd\_sold\_amount | FLOAT | Amount of token sold in USD value. |
| token\_bought\_address | VARCHAR | Token address of the token bought, i.e. the asset acquired from the trade. |
| token\_bought\_name | VARCHAR | Name of the token bought. |
| token\_bought\_symbol | VARCHAR | Symbol of the token bought. |
| token\_bought\_decimals | BIGINT | Token decimals of the token bought. |
| token\_bought\_amount\_raw\_str | VARCHAR | Raw amount of tokens bought (unnormalized) in string. |
| token\_bought\_amount\_raw | FLOAT | Raw amount of tokens bought (unnormalized). |
| token\_bought\_amount\_str | VARCHAR | Amount of tokens bought in string. |
| token\_bought\_amount | FLOAT | Amount of tokens bought. |
| usd\_bought\_amount | FLOAT | Amount of token bought in USD value. |
| usd\_amount | FLOAT | USD value of the swap. This field preferentially selects the USD value of ETH and Stablecoin (USDT/USDC) tokens, as spam token prices may conflate the true swap value. |
| usd\_amount\_adjusted | FLOAT | `usd_amount`, or null when `is_flagged` is true, so `sum(usd_amount_adjusted)` gives adjusted volume. `usd_amount` is left as is; `sum(usd_amount) - sum(usd_amount_adjusted)` is the flagged amount. |
| is\_flagged | BOOLEAN | True if the trade is in `dex.trades_flagged` (see `flagged_details`). Filter `where not is_flagged` to exclude flagged trades such as round-trip wash. |
| flagged\_details | VARIANT | Why the trade is flagged, as one object. `reason`: the highest-priority match. `source`: what matched it, a registry key (`transaction_hash`, `transaction_from_address`, `transaction_to_address`) or `heuristic`. `flagged_at`: the registry entry's date, or the date a heuristic first flagged the trade; it is not the date the change reached production. `reasons`: every match, in priority order. Each reason key holds a list of its matches, each with its own `flagged_at`. `supply_shock_v1` / `self_issued_v1` = the trade touches a flagged token: `token_address`, `token_flagged_at`, `flagged_value` (units over pre-shock supply, or the creator's share of legs). `same_pool_roundtrip_v1` = the transaction trades one pool both ways and its flow cancels out: `pool_key`, `score` (1 = perfect round trip), `has_liquidity_event`. `roundtrip_wash` (registry): `source`, `value`. Examples: `flagged_details:reason::varchar`; one rule: `array_contains('same_pool_roundtrip_v1'::variant, flagged_details:reasons)`. |
| extra\_fields | VARIANT | This field contains all the extra columns emitted from the event/function call that were not part of the convetional DEX trades columns. |
| swap\_count | BIGINT | Swap count within the transaction. |
| transaction\_fees | VARCHAR | Fees paid at the transaction level. Varchar to retain precision. |
| transaction\_fees\_usd | FLOAT | Fees paid in USD. |
| fee\_details | VARIANT | Additional fee details of the transaction, including max priority fee, gas price and gas used for the transaction. |
| transaction\_from\_address | VARCHAR | Transaction sender address. I.e. the address of the transaction initiator. (from\_address in the raw\.transactions field for the transaction\_hash of this swap). |
| transaction\_to\_address | VARCHAR | Transaction receiver. (to\_address in the raw\.transactions field for the transaction\_hash of this swap). |
| transaction\_hash | VARCHAR | Transaction hash that this swap belongs to. |
| transaction\_index | BIGINT | The position of this transaction in the block that it belongs to. The first transaction has index 0. |
| selector | VARCHAR | 4byte selector of the transaction. |
| log\_index | BIGINT | The position of the swap event log in the transaction. |
| block\_timestamp | TIMESTAMP\_NTZ(9) | Block timestamp of the swap event. |
| block\_number | BIGINT | Block number of the swap event. |
| block\_hash | VARCHAR | Block hash of the swap event. |
| unique\_id | VARCHAR | Unique ID of each trade. |
