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

# lighter_v2_polygon

> Tables in tt-contracts.lighter_v2_polygon

## Tables

### Factory\_OrderBookCreated\_event

Order book initialization events from Lighter V2 decentralized exchange factory contract on Polygon. Records new trading pair deployments with configuration parameters including token addresses, price/size tick increments, and minimum order amounts for market structure analysis.

<Accordion title="Columns">
  | Column                   | Type        | Description                                                                                                                                                                                                                                         |
  | ------------------------ | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `block_timestamp`        | `TIMESTAMP` | Timestamp when the block was produced. UTC timezone, millisecond precision.                                                                                                                                                                         |
  | `block_number`           | `INT64`     | Sequential identifier for the block in which the event or transaction was recorded. Integer value indicating the block's position in the blockchain.                                                                                                |
  | `transaction_hash`       | `STRING`    | Unique identifier for the transaction. 66-character hex string including 0x prefix.                                                                                                                                                                 |
  | `log_index`              | `INT64`     | Position of the event within the block's transaction logs. Zero-indexed integer representing the sequential order of log emission.                                                                                                                  |
  | `address`                | `STRING`    | Contract address that emitted the event. Hex-encoded, 0x-prefixed, 42-character string.                                                                                                                                                             |
  | `removed`                | `BOOL`      | Boolean flag indicating whether the event log was removed from the blockchain due to a chain reorganization.                                                                                                                                        |
  | `in_orderBookAddress`    | `STRING`    | Contract address of the newly created order book on Polygon for the specified token pair. Hex-encoded, 0x-prefixed 40-character string representing the deployed order book smart contract.                                                         |
  | `in_orderBookId`         | `INT64`     | Sequential identifier assigned to each newly created order book in the Lighter V2 protocol. Increments with each new order book deployment, starting from 0.                                                                                        |
  | `in_token0`              | `STRING`    | Contract address of the first token in the trading pair. Hex-encoded, 0x-prefixed, 42-character string.                                                                                                                                             |
  | `in_token1`              | `STRING`    | Contract address of the second token in the trading pair. Hex-encoded, 0x-prefixed, 42-character string.                                                                                                                                            |
  | `in_logSizeTick`         | `INT64`     | Logarithmic size tick parameter defining the granularity of order size increments for this order book. Lower values allow smaller size steps between orders, while higher values enforce larger minimum size increments.                            |
  | `in_logPriceTick`        | `INT64`     | Logarithmic price tick parameter defining the granularity of price levels for the created order book. Smaller values (like 0, 2, 4, or 5) indicate finer price increments between tradeable levels.                                                 |
  | `in_minToken0BaseAmount` | `STRING`    | Minimum order size required for token0 in the order book, denominated in the token's base units (smallest indivisible unit). Values typically range from thousands to tens of thousands, enforcing a minimum trade threshold for this trading pair. |
  | `in_minToken1BaseAmount` | `STRING`    | Minimum order size denominated in token1 (the quote token) required for trades in this order book. Specified in base units (smallest token denomination) to enforce a minimum trade threshold.                                                      |
</Accordion>

<Accordion title="Sample Data">
  | address                                    | removed | in\_token0                                 | in\_token1                                 | log\_index | block\_number | in\_logSizeTick | in\_orderBookId | block\_timestamp         | in\_logPriceTick | transaction\_hash                                                  | in\_orderBookAddress                       | in\_minToken0BaseAmount | in\_minToken1BaseAmount |
  | ------------------------------------------ | ------- | ------------------------------------------ | ------------------------------------------ | ---------- | ------------- | --------------- | --------------- | ------------------------ | ---------------- | ------------------------------------------------------------------ | ------------------------------------------ | ----------------------- | ----------------------- |
  | 0xdad36b6acd05c0807c6e7ba7197bc1b23c4dc06c | false   | 0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6 | 0x2791bca1f2de4661ed88a30c99a7a9449aa84174 | 931        | 49989550      | 1               | 4               | 2023-11-15T22:13:32.000Z | 5                | 0x90e04af000a25b29895d6773efecf7d59864c3c9af3f230db0cab8c4971713a4 | 0xc54f8d2d2edb0cc0bca221de262132792c832553 | 3000                    | 1000000000              |
  | 0xdad36b6acd05c0807c6e7ba7197bc1b23c4dc06c | false   | 0x7ceb23fd6bc0add59e62ac25578270cff1b9f619 | 0x3c499c542cef5e3811e1192ce70d8cc03d5c3359 | 935        | 49989550      | 12              | 6               | 2023-11-15T22:13:32.000Z | 4                | 0x90e04af000a25b29895d6773efecf7d59864c3c9af3f230db0cab8c4971713a4 | 0x69fefd6fa4a65fe63cc65bbcf89717b7bdc7bcf4 | 5000                    | 1000000000              |
  | 0xdad36b6acd05c0807c6e7ba7197bc1b23c4dc06c | false   | 0x7ceb23fd6bc0add59e62ac25578270cff1b9f619 | 0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6 | 933        | 49989550      | 12              | 5               | 2023-11-15T22:13:32.000Z | 2                | 0x90e04af000a25b29895d6773efecf7d59864c3c9af3f230db0cab8c4971713a4 | 0x38f0fcbbc92e0f26b2ba95ad01f272768e0d9dc6 | 5000                    | 300000000               |
</Accordion>

<Accordion title="Example Query">
  **Query with partition filter**

  ```sql theme={null}
  SELECT *
  FROM `tt-contracts.lighter_v2_polygon.Factory_OrderBookCreated_event`
  WHERE block_timestamp >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY)
  LIMIT 100
  ```
</Accordion>

***

### OrderBook\_Swap\_event

Swap execution events from Lighter V2 decentralized exchange order book on Polygon, matching ask and bid orders with trade amounts and participant addresses. Enables analysis of order book trading activity, liquidity patterns, and maker-taker dynamics.

<Accordion title="Columns">
  | Column             | Type        | Description                                                                                                                                                                                           |
  | ------------------ | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `block_timestamp`  | `TIMESTAMP` | Timestamp when the block was produced. UTC timezone, millisecond precision.                                                                                                                           |
  | `block_number`     | `INT64`     | Sequential identifier for the block in which the event or transaction was recorded. Integer value indicating the block's position in the blockchain.                                                  |
  | `transaction_hash` | `STRING`    | Unique identifier for the transaction. 66-character hex string including 0x prefix.                                                                                                                   |
  | `log_index`        | `INT64`     | Position of the event within the block's transaction logs. Zero-indexed integer representing the sequential order of log emission.                                                                    |
  | `address`          | `STRING`    | Contract address that emitted the event. Hex-encoded, 0x-prefixed, 42-character string.                                                                                                               |
  | `removed`          | `BOOL`      | Boolean flag indicating whether the event log was removed from the blockchain due to a chain reorganization.                                                                                          |
  | `in_askId`         | `STRING`    | Order identifier for the ask side of the swap that was matched. Numeric string representing the sell order ID in the Lighter V2 order book.                                                           |
  | `in_bidId`         | `STRING`    | Unique identifier for the bid order being matched in this swap on the Lighter V2 order book. Numeric string value, with '0' appearing frequently in samples suggesting market or instant fill orders. |
  | `in_askOwner`      | `STRING`    | Address of the account that owns the ask (sell) order being matched in this swap event. Hex-encoded, 0x-prefixed 40-character Polygon address.                                                        |
  | `in_bidOwner`      | `STRING`    | Polygon address of the account that owns the bid order being filled in this swap event. Hex-encoded, 0x-prefixed 40-character string representing the buyer in the order book transaction.            |
  | `in_amount0`       | `STRING`    | Amount of token0 involved in the liquidity pool operation. Numeric string representation of token quantity in smallest denomination.                                                                  |
  | `in_amount1`       | `STRING`    | Amount of token1 involved in the liquidity pool operation. Numeric string representation of token quantity in smallest denomination.                                                                  |
</Accordion>

<Accordion title="Sample Data">
  | address                                    | removed | in\_askId | in\_bidId | log\_index | in\_amount0 | in\_amount1 | in\_askOwner                               | in\_bidOwner                               | block\_number | block\_timestamp         | transaction\_hash                                                  |
  | ------------------------------------------ | ------- | --------- | --------- | ---------- | ----------- | ----------- | ------------------------------------------ | ------------------------------------------ | ------------- | ------------------------ | ------------------------------------------------------------------ |
  | 0xc055bb3aaf245521f92c697ac509e0ba798dec48 | false   | 38        | 0         | 102        | 254967000   | 254967254   | 0xd35138f1a59f8ddc705549a2459250eccddb7a30 | 0x4e3288c9ca110bcc82bf38f09a7b425c095d92bf | 49735482      | 2023-11-09T13:55:32.000Z | 0x3ed887a55940da8105c848b41eddbba50f0ff3e267518a3da131e2187fecfb9e |
  | 0xc055bb3aaf245521f92c697ac509e0ba798dec48 | false   | 62        | 0         | 310        | 224744000   | 224744224   | 0xd35138f1a59f8ddc705549a2459250eccddb7a30 | 0x4e3288c9ca110bcc82bf38f09a7b425c095d92bf | 49738976      | 2023-11-09T16:02:10.000Z | 0x0804a275e82b2a6ce12b63df4e55b31f940bd3bc192e203f6180f06ff518d9eb |
  | 0xc055bb3aaf245521f92c697ac509e0ba798dec48 | false   | 68        | 0         | 358        | 145855000   | 145855145   | 0xd35138f1a59f8ddc705549a2459250eccddb7a30 | 0x4e3288c9ca110bcc82bf38f09a7b425c095d92bf | 49740389      | 2023-11-09T16:53:17.000Z | 0x34a06918ecb6e3e66faf544797fd7b61712958aa9afc02ddc569267a1f37dd51 |
</Accordion>

<Accordion title="Example Query">
  **Query with partition filter**

  ```sql theme={null}
  SELECT *
  FROM `tt-contracts.lighter_v2_polygon.OrderBook_Swap_event`
  WHERE block_timestamp >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY)
  LIMIT 100
  ```
</Accordion>

***
