> ## 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.

# mux_v2_optimism

> Tables in tt-contracts.mux_v2_optimism

## Tables

### LiquidityPool\_AddAsset\_event

Event log recording the addition of a new asset to a MUX Protocol v2 liquidity pool, including asset identifier, token addresses, decimal precision, symbol, and stablecoin classification. Used for tracking pool composition changes and supported asset configurations.

<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_id`              | `INT64`     | Unique identifier for the position, record, or entity within the protocol. Numeric string representation.                                            |
  | `in_symbol`          | `STRING`    | Symbol of the token involved in the transaction or event.                                                                                            |
  | `in_decimals`        | `INT64`     | Number of decimal places for the token. Integer value defining precision for token amount representations.                                           |
  | `in_isStable`        | `BOOL`      | Boolean flag indicating whether the asset is classified as a stablecoin.                                                                             |
  | `in_tokenAddress`    | `STRING`    | Token contract address for the asset involved in the operation. Hex-encoded, 0x-prefixed, 42-character string.                                       |
  | `in_muxTokenAddress` | `STRING`    | Contract address of the MUX protocol's liquidity pool token for the asset. Hex-encoded, 0x-prefixed, 42-character string.                            |
</Accordion>

<Accordion title="Sample Data">
  | in\_id | address                                    | removed | in\_symbol                                                         | log\_index | in\_decimals | in\_isStable | block\_number | block\_timestamp         | in\_tokenAddress                           | transaction\_hash                                                  | in\_muxTokenAddress                        |
  | ------ | ------------------------------------------ | ------- | ------------------------------------------------------------------ | ---------- | ------------ | ------------ | ------------- | ------------------------ | ------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------ |
  | 8      | 0xc6bd76fa1e9e789345e003b361e4a0037dfb7260 | false   | 0x4f50000000000000000000000000000000000000000000000000000000000000 | 0          | 18           | false        | 56074978      | 2022-12-27T12:39:45.000Z | 0x4200000000000000000000000000000000000042 | 0x50e7f99ca4cec230687b0889f4ea0b127acbc94a9abfa76a5ffb708cd0c5fb4e | 0x69663eb604c7d534e9149fa855d89d9104e75363 |
  | 5      | 0xc6bd76fa1e9e789345e003b361e4a0037dfb7260 | false   | 0x4156415800000000000000000000000000000000000000000000000000000000 | 0          | 18           | false        | 56074858      | 2022-12-27T12:39:30.000Z | 0x0000000000000000000000000000000000000000 | 0xdc8cd51a1c562e1110481f7bfb68686507ec47bb21a6adb354672043084d7de1 | 0x50ec9b92b3bd46969b1ae5e10543ca6fb49fba4f |
  | 6      | 0xc6bd76fa1e9e789345e003b361e4a0037dfb7260 | false   | 0x424e420000000000000000000000000000000000000000000000000000000000 | 0          | 18           | false        | 56074912      | 2022-12-27T12:39:30.000Z | 0x0000000000000000000000000000000000000000 | 0x76b83eaa87beb73a0a7a70d6da7bd49bc66ee07a8931769b4a5163063cda9da6 | 0x253be9f0e2a8749df6ac7466d096b264788745e0 |
</Accordion>

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

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

***

### LiquidityPool\_ClosePosition\_event

Position closure events from MUX Protocol liquidity pools containing trader address, position size, asset prices, profit/loss, fees, and remaining balances. Used for tracking leverage trading activity and calculating realized PnL across perpetual futures positions.

<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_trader`        | `STRING`                                                                                                                                                                                                                                                             | Address that initiated or executed the trade transaction. Hex-encoded, 0x-prefixed, 42-character string.                                             |
  | `in_assetId`       | `INT64`                                                                                                                                                                                                                                                              | Unique identifier for the asset or token involved in the operation. Hex-encoded, 0x-prefixed, 66-character string.                                   |
  | `in_args`          | `STRUCT<subAccountId STRING, collateralId INT64, profitAssetId INT64, isLong BOOL, amount STRING, assetPrice STRING, collateralPrice STRING, profitAssetPrice STRING, feeUsd STRING, hasProfit BOOL, pnlUsd STRING, remainPosition STRING, remainCollateral STRING>` | Structured input arguments passed to the contract function that triggered the event. Contains nested data specific to the operation being performed. |
</Accordion>

<Accordion title="Sample Data">
  | address                                    | in\_args                                                                                                                                                                                                                                                                                                                                                                                                                                        | removed | in\_trader                                 | log\_index | in\_assetId | block\_number | block\_timestamp         | transaction\_hash                                                  |
  | ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ------------------------------------------ | ---------- | ----------- | ------------- | ------------------------ | ------------------------------------------------------------------ |
  | 0xc6bd76fa1e9e789345e003b361e4a0037dfb7260 | \{"amount":"59170000000000000","feeUsd":"986841401900000000","isLong":false,"pnlUsd":"7928780000000000000","hasProfit":false,"assetPrice":"26901000000000000000000","collateralId":0,"subAccountId":"0xcb11673592cc6c4b9584f33bbba6c6cf07dde3f7000400000000000000000000","profitAssetId":0,"remainPosition":"0","collateralPrice":"1000000000000000000","profitAssetPrice":"1000000000000000000","remainCollateral":"73616605012100000000"}     | false   | 0xcb11673592cc6c4b9584f33bbba6c6cf07dde3f7 | 1          | 4           | 110824661     | 2023-10-14T01:48:19.000Z | 0x7f119cb82cbce39c347a10dbbaf099c4d299a36d0fbe005297e5315d81ac157a |
  | 0xc6bd76fa1e9e789345e003b361e4a0037dfb7260 | \{"amount":"1081400000000000000","feeUsd":"1006934796000000000","isLong":false,"pnlUsd":"1081400000000000000","hasProfit":true,"assetPrice":"1551900000000000000000","collateralId":0,"subAccountId":"0xcb11673592cc6c4b9584f33bbba6c6cf07dde3f7000300000000000000000000","profitAssetId":0,"remainPosition":"0","collateralPrice":"1000000000000000000","profitAssetPrice":"1000000000000000000","remainCollateral":"23992416364000000000"}    | false   | 0xcb11673592cc6c4b9584f33bbba6c6cf07dde3f7 | 7          | 3           | 110824517     | 2023-10-14T01:43:31.000Z | 0x96efd32be1f542eec6cd45a40b8bb7c7241c2b4ebd7838a3e2a6655181acbd4c |
  | 0xc6bd76fa1e9e789345e003b361e4a0037dfb7260 | \{"amount":"9233330000000000000000","feeUsd":"7064897001228080000","isLong":false,"pnlUsd":"36108968297600000000","hasProfit":false,"assetPrice":"1214755960000000000","collateralId":0,"subAccountId":"0x45ceeda2ccdc679c1df920e72e03e1cd8a8b6efb000800000000000000000000","profitAssetId":0,"remainPosition":"0","collateralPrice":"1000000000000000000","profitAssetPrice":"1000000000000000000","remainCollateral":"104118054493262400000"} | false   | 0x45ceeda2ccdc679c1df920e72e03e1cd8a8b6efb | 5          | 8           | 110824676     | 2023-10-14T01:48:49.000Z | 0xefac1d8978b27d734851f559b93cc3ec18e748f00a541e0462e6445fe0846da5 |
</Accordion>

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

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

***

### LiquidityPool\_Liquidate\_event

Position liquidation events from MUX Protocol perpetual futures contracts containing trader and liquidator addresses, position details, collateral amounts, profit/loss calculations, and penalty distributions to liquidity pools.

<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_trader`        | `STRING`                                                                                                                                                                                                                                      | Address that initiated or executed the trade transaction. Hex-encoded, 0x-prefixed, 42-character string.                                             |
  | `in_assetId`       | `INT64`                                                                                                                                                                                                                                       | Unique identifier for the asset or token involved in the operation. Hex-encoded, 0x-prefixed, 66-character string.                                   |
  | `in_args`          | `STRUCT<subAccountId STRING, collateralId INT64, profitAssetId INT64, isLong BOOL, amount STRING, assetPrice STRING, collateralPrice STRING, profitAssetPrice STRING, feeUsd STRING, hasProfit BOOL, pnlUsd STRING, remainCollateral STRING>` | Structured input arguments passed to the contract function that triggered the event. Contains nested data specific to the operation being performed. |
</Accordion>

<Accordion title="Sample Data">
  | address                                    | in\_args                                                                                                                                                                                                                                                                                                                                                                                                                  | removed | in\_trader                                 | log\_index | in\_assetId | block\_number | block\_timestamp         | transaction\_hash                                                  |
  | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ------------------------------------------ | ---------- | ----------- | ------------- | ------------------------ | ------------------------------------------------------------------ |
  | 0xc6bd76fa1e9e789345e003b361e4a0037dfb7260 | \{"amount":"222900000000000000","feeUsd":"460425026249999999","isLong":true,"pnlUsd":"3499530000000000000","hasProfit":false,"assetPrice":"1935000000000000000000","collateralId":8,"subAccountId":"0xffd3003a187d9951e49bda206f32a6e765360427080301000000000000000000","profitAssetId":3,"collateralPrice":"2446300000000000000","profitAssetPrice":"1935000000000000000000","remainCollateral":"673746655541302295"}    | false   | 0xffd3003a187d9951e49bda206f32a6e765360427 | 1          | 3           | 92604604      | 2023-04-20T16:02:59.000Z | 0x8337ea57a573dcc5fc5cd044158ab62bf4832b2082e53fceeffe4e9d8299036c |
  | 0xc6bd76fa1e9e789345e003b361e4a0037dfb7260 | \{"amount":"349400000000000000","feeUsd":"716615119850000000","isLong":true,"pnlUsd":"10447060000000000000","hasProfit":false,"assetPrice":"1921300000000000000000","collateralId":3,"subAccountId":"0x8231df717e2cec9f4ae2ba8ecc46efd7769eda8e030301000000000000000000","profitAssetId":3,"collateralPrice":"1921300000000000000000","profitAssetPrice":"1921300000000000000000","remainCollateral":"910000054208089"}   | false   | 0x8231df717e2cec9f4ae2ba8ecc46efd7769eda8e | 1          | 3           | 92604918      | 2023-04-20T16:03:29.000Z | 0xea3df8ef722de9a630b323bcecbe9bc81b2ad7947833ba668905827fb156e0f2 |
  | 0xc6bd76fa1e9e789345e003b361e4a0037dfb7260 | \{"amount":"313000000000000000","feeUsd":"1044254388000000000","isLong":true,"pnlUsd":"17903600000000000000","hasProfit":false,"assetPrice":"1917400000000000000000","collateralId":3,"subAccountId":"0xb50eee16704dedcd22681499ea9c78bcc9561648030301000000000000000000","profitAssetId":3,"collateralPrice":"1917400000000000000000","profitAssetPrice":"1917400000000000000000","remainCollateral":"1297543888599145"} | false   | 0xb50eee16704dedcd22681499ea9c78bcc9561648 | 1          | 3           | 92643448      | 2023-04-20T19:28:35.000Z | 0x920c65f823088cbcfc5a86190f70d97b64a1a27cfea168ff43266f2eca9ecc34 |
</Accordion>

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

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

***

### LiquidityPool\_OpenPosition\_event

Perpetual futures position opening events from MUX Protocol liquidity pools containing trader address, asset and collateral identifiers, position size, entry price, leverage direction (long/short), fees charged, and remaining collateral balances. Used for tracking perpetual contract position entries and margin requirements.

<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_trader`        | `STRING`                                                                                                                                                                                                      | Address that initiated or executed the trade transaction. Hex-encoded, 0x-prefixed, 42-character string.                                             |
  | `in_assetId`       | `INT64`                                                                                                                                                                                                       | Unique identifier for the asset or token involved in the operation. Hex-encoded, 0x-prefixed, 66-character string.                                   |
  | `in_args`          | `STRUCT<subAccountId STRING, collateralId INT64, isLong BOOL, amount STRING, assetPrice STRING, collateralPrice STRING, newEntryPrice STRING, feeUsd STRING, remainPosition STRING, remainCollateral STRING>` | Structured input arguments passed to the contract function that triggered the event. Contains nested data specific to the operation being performed. |
</Accordion>

<Accordion title="Sample Data">
  | address                                    | in\_args                                                                                                                                                                                                                                                                                                                                                                                     | removed | in\_trader                                 | log\_index | in\_assetId | block\_number | block\_timestamp         | transaction\_hash                                                  |
  | ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ------------------------------------------ | ---------- | ----------- | ------------- | ------------------------ | ------------------------------------------------------------------ |
  | 0xc6bd76fa1e9e789345e003b361e4a0037dfb7260 | \{"amount":"1753700000000000000","feeUsd":"2571064496000000000","isLong":false,"assetPrice":"1832600000000000000000","collateralId":0,"subAccountId":"0x3d5d2ac4fecf16bb1651a445d5b17f977a823546000300000000000000000000","newEntryPrice":"1832600000000000000000","remainPosition":"1753700000000000000","collateralPrice":"1000000000000000000","remainCollateral":"32138935504000000000"} | false   | 0x3d5d2ac4fecf16bb1651a445d5b17f977a823546 | 42         | 3           | 107936721     | 2023-08-08T05:23:39.000Z | 0xbf31397b9dabd7d92232300bb041346b33b55df49b4c61add2d2e77b1d0f4cfe |
  | 0xc6bd76fa1e9e789345e003b361e4a0037dfb7260 | \{"amount":"967600000000000000","feeUsd":"1415405280000000000","isLong":false,"assetPrice":"1828500000000000000000","collateralId":0,"subAccountId":"0x3d5d2ac4fecf16bb1651a445d5b17f977a823546000300000000000000000000","newEntryPrice":"1828500000000000000000","remainPosition":"967600000000000000","collateralPrice":"1000000000000000000","remainCollateral":"34694594720000000000"}   | false   | 0x3d5d2ac4fecf16bb1651a445d5b17f977a823546 | 53         | 3           | 107944442     | 2023-08-08T09:41:01.000Z | 0xf01ac9170414d9ee3c7250958953524907b4339dde58c7148b6f619cb50b3075 |
  | 0xc6bd76fa1e9e789345e003b361e4a0037dfb7260 | \{"amount":"183100000000000000","feeUsd":"496524414100000000","isLong":true,"assetPrice":"1831700000000000000000","collateralId":0,"subAccountId":"0x3d5d2ac4fecf16bb1651a445d5b17f977a823546000301000000000000000000","newEntryPrice":"1821743689732548972041","remainPosition":"1648900000000000000","collateralPrice":"1000000000000000000","remainCollateral":"30038684465900000000"}    | false   | 0x3d5d2ac4fecf16bb1651a445d5b17f977a823546 | 63         | 3           | 107928753     | 2023-08-08T00:58:03.000Z | 0x70048262057544ef667b9141de76e9a4748636559ba2a7057e2d6d5604e0e10a |
</Accordion>

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

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

***
