Overview
- Dataset ID:
0402 - Tables:
blockdb0402_token_to_token_prices_l2_v1_snapshots— Level-2 impact grid (0..+radius bps fortoken_in → token_out). Insert the reverse token order to capture the opposite direction.blockdb0402_token_to_token_l2_v1_points— Per-grid-point executable size and realized price at each basis-point offset from mid.
Default grid_step_bps is 10 bps and grid_radius_bps is 1000 bps (±10%) which produces 101 grid points. If you need even more granularity, you can check Token-to-Token Prices L3.
Snapshot Table Columns (blockdb0402_token_to_token_prices_l2_v1_snapshots)
| Column | Type | Description |
|---|---|---|
snapshot_id | BIGINT | Identity column for the price snapshot at this impact layer. |
pool_uid | BIGINT | Foreign key referencing blockdb0203_liquidity_pools_v1.uid for the pool in question. |
block_number | BIGINT | Canonical block height within the originating chain. |
block_time | TIMESTAMPTZ | UTC timestamp for the block that produced this record. |
tx_index | INTEGER | Zero-based transaction index within the block, used for deterministic ordering. |
log_index | INTEGER | Zero-based log index within the transaction, uniquely identifying the emitted event. |
token_in | BYTEA | Address of the token treated as the input leg for this measurement. |
token_out | BYTEA | Address of the token treated as the output leg for this measurement. |
current_price | NUMERIC(78,18) | Normalized mid price at snapshot time (token_out per 1 token_in). |
grid_step_bps | SMALLINT | Basis-point gap between adjacent grid points in the impact curve. |
grid_radius_bps | INTEGER | Total extent of the impact grid from mid price, expressed in basis points. |
grid_points | SMALLINT | Serialized list of price/size tuples representing the impact grid. |
_tracing_id | BYTEA | BlockDB lineage identifier that links this record to lineage APIs. |
_genesis_tracing_ids | BYTEA[] | Tracing identifiers for the raw artifacts (blocks, logs, proofs) that seeded this record. |
_parent_tracing_ids | BYTEA[] | Tracing identifiers for upstream derived records referenced during computation. |
_created_at | TIMESTAMPTZ | Record creation timestamp. |
_updated_at | TIMESTAMPTZ | Record last update timestamp. |
Constraints & Indexes: Address lengths (token_in,token_out) are enforced at 20 bytes, whilegrid_step_bps,grid_radius_bps, andgrid_pointsmust satisfy the normalized SKU formula(grid_radius_bps / grid_step_bps) + 1. Uniqueness over(pool_uid, token_in, token_out, grid_step_bps, grid_radius_bps, block_number, tx_index, log_index)ensures one snapshot per event/pair/grid. Hot indexes include(pool_uid, block_number DESC, tx_index DESC, log_index DESC),(token_in, token_out), and(block_number, tx_index, log_index)for fast filtering.
Grid Points Table Columns (blockdb0402_token_to_token_l2_v1_points)
| Column | Type | Description |
|---|---|---|
snapshot_id | BIGINT | Foreign key to blockdb0402_token_to_token_prices_l2_v1_snapshots.snapshot_id; cascades on delete. |
point_index | SMALLINT | Zero-based index (0 … grid_points - 1). Serves as part of the primary key. |
offset_bps_abs | INTEGER | Absolute basis-point offset from mid price (e.g., 0, 10, 20 … 1000). |
size_in | NUMERIC(78,18) | Gross input size (excludes fees) required to reach this point. |
size_out | NUMERIC(78,18) | Token out received at this point (excludes fees). |
price_at_point | NUMERIC(78,18) | Average realized price (token_out per 1 token_in) including fee + impact. |
Constraints & Indexes: Primary key(snapshot_id, point_index)plus a FK back to the snapshot guarantees idempotency. Checks enforce non-negative offsets, and indexes on(snapshot_id, offset_bps_abs)support monotonic scans across the grid.
Use Cases
- Depth & impact modeling for execution algorithms
- Market-making simulation and slippage profiling
- MEV and arbitrage detection at grid resolution
- Feature engineering for price impact models
- Real-time liquidity monitoring and alerting