near.defi Table: fact_dex_swaps Type: Base Table
Description
This table contains all decentralized exchange (DEX) swap transactions on the NEAR Protocol blockchain, capturing token swaps across various DEX protocols including Ref Finance, Orderly Network, and other automated market makers. The data includes swap details such as input/output tokens, amounts, prices, and protocol-specific metadata. This table provides the foundation for DeFi analytics, trading volume analysis, and liquidity pool performance tracking across the NEAR ecosystem.Key Use Cases
- DEX trading volume analysis and market activity monitoring
- Token pair liquidity analysis and trading pattern identification
- Price impact analysis and slippage calculation
- DEX protocol comparison and performance benchmarking
- Arbitrage opportunity detection and analysis
- Trading bot activity monitoring and pattern recognition
- DeFi protocol integration analysis and cross-protocol flows
Important Relationships
- Links to
core.fact_transactionsthrough tx_hash for transaction context - Connects to
core.fact_blocksthrough block_id for temporal context - Provides swap data for
defi.ez_dex_swapswith enhanced metadata and pricing - Supports
defi.ez_intentswith swap execution analysis - Enables analysis in
stats.ez_core_metrics_hourlyfor DeFi metrics - Powers cross-protocol analysis with other DeFi activities
Commonly-used Fields
tx_hash: Essential for linking to transaction details and verificationblock_timestamp: Primary field for time-series analysis and trend detectiontoken_inandtoken_out: Critical for token pair analysis and trading patternsamount_in_rawandamount_out_raw: Important for swap size analysis and volume calculationsreceiver_idandsigner_id: Essential for user behavior analysis and trader identificationswap_index: Important for multi-swap transaction analysisswap_input_data: Useful for detailed swap parameter analysis
Columns
| Column Name | Data Type | Description |
|---|---|---|
| TX_HASH | TEXT | Unique identifier (hash) of this transaction. |
| RECEIPT_ID | TEXT | |
| BLOCK_ID | NUMBER | The height of the chain this block corresponds with. |
| BLOCK_TIMESTAMP | TIMESTAMP_NTZ | The date and time at which the block began. |
| RECEIVER_ID | TEXT | Account reacting to the receipt from predecessor_id, can be relay, a contract, or a user of a relay, etc. This field identifies the account that is processing the receipt and executing the associated action. In most cases, this is a smart contract that is being called, but it can also be a user account in relay transactions or the system account for certain operations. This differs from tx_receiver and is specific to the receipt being processed. |
| SIGNER_ID | TEXT | Signer of the receipt, often same as tx_signer, sometimes system in the case of systemic gas refunds. This field identifies the account that has the authority to execute the receipt. In most cases, this is the same as the transaction signer, but in system operations like gas refunds, this may be the system account. The signer is the account that originally signed the transaction that began the blockchain activity, which may or may not include cross-contract calls. |
| SWAP_INDEX | NUMBER | The positon index for the record in question, if it was stored in a particular order. |
| AMOUNT_OUT_RAW | NUMBER | Amount out, in a swap or transfer, in adjusted form. |
| TOKEN_OUT | TEXT | The address of the token being swapped to. |
| AMOUNT_IN_RAW | NUMBER | Amount in, in a swap or transfer, in adjusted form. |
| TOKEN_IN | TEXT | The address of the token sent for swap. |
| SWAP_INPUT_DATA | VARIANT | JSON of input data for the swap, taken from the FunctionCall JSON. |
| Note, directional keys such as in and out are determined by the pool. | ||
| LOG | TEXT | The logs linked to the transaction. |
| FACT_DEX_SWAPS_ID | TEXT | A unique identifier for the record. |
| INSERTED_TIMESTAMP | TIMESTAMP_NTZ | The timestamp at which the record was initially created and inserted into this table. |
| MODIFIED_TIMESTAMP | TIMESTAMP_NTZ | The timestamp at which this record was last modified by an internal process. |