Skip to main content
Schema: near.defi Table: ez_intents Type: View

What

Description

This table provides an enhanced view of all intent-based transactions on the NEAR Protocol blockchain, combining raw intent data with token metadata, pricing information, and cross-chain mapping details. The table includes both NEP-245 and DIP-4 standard intents with decimal adjustments, USD values, and comprehensive token context. CRITICAL: Each intent consists of multiple transaction steps (rows) representing the complete transfer flow: input (user → solver), output (solver → user), fees, and optional routing. Each unique intent is identified by tx_hash + log_index. Summing all amount_usd values will overcount volume by 2-3x because it counts input + output + fees separately.

How to Use This Table

Use MAX per intent to avoid 2-3x overcounting:
WITH intent_volumes AS (
    SELECT
        tx_hash,
        log_index,
        MAX(amount_usd) as intent_volume
    FROM near.defi.ez_intents
    WHERE amount_usd > 0.01  -- Exclude dust/fees
    GROUP BY tx_hash, log_index  -- BOTH fields required
)
SELECT SUM(intent_volume) as total_volume
FROM intent_volumes;
Why MAX works: Input ≈ output amounts (differ only by small fees). MAX captures the true swap size while ignoring dust.

Common Query Patterns

Daily volume by token:
WITH intent_volumes AS (
    SELECT
        DATE_TRUNC('day', block_timestamp) as date,
        tx_hash, log_index, symbol,
        MAX(amount_usd) as volume
    FROM near.defi.ez_intents
    WHERE amount_usd > 0.01
    GROUP BY date, tx_hash, log_index, symbol
)
SELECT date, symbol, SUM(volume) as daily_volume
FROM intent_volumes
GROUP BY date, symbol;
Cross-chain flows:
WITH flows AS (
    SELECT
        tx_hash, log_index,
        MIN(blockchain) as source_chain,
        MAX(blockchain) as dest_chain,
        MAX(amount_usd) as volume
    FROM near.defi.ez_intents
    WHERE amount_usd > 0.01
    GROUP BY tx_hash, log_index
)
SELECT source_chain, dest_chain, SUM(volume) as total_volume
FROM flows
GROUP BY source_chain, dest_chain;
Top users:
WITH users AS (
    SELECT
        old_owner_id as user,
        tx_hash, log_index,
        MAX(amount_usd) as volume
    FROM near.defi.ez_intents
    WHERE amount_usd > 0.01
    GROUP BY user, tx_hash, log_index
)
SELECT user, SUM(volume) as total_volume
FROM users
GROUP BY user;

Validation

Check if you’re calculating correctly:
SELECT
    AVG(SUM(amount_usd) / NULLIF(MAX(amount_usd), 0)) as avg_ratio
FROM near.defi.ez_intents
WHERE amount_usd > 0.01
GROUP BY tx_hash, log_index;
Expected: ~1.5-2.0. If higher, you’re likely overcounting.

Key Use Cases

  • Intent-based trading volume analysis with accurate calculations
  • Cross-chain swap tracking and flow analysis
  • User behavior analysis in intent-driven protocols
  • Referral program effectiveness measurement
  • Intent fulfillment rate analysis (use receipt_succeeded)
  • MEV protection mechanism evaluation

Important Relationships

  • Enhances defi.fact_intents with pricing and metadata from price.ez_prices_hourly
  • Combines token metadata from core.dim_ft_contract_metadata for complete token context
  • Enables analysis in stats.ez_core_metrics_hourly for intent metrics
  • Provides foundation for all intent-based analytics and reporting
  • Powers cross-protocol analysis with other DeFi activities

Commonly-used Fields

  • tx_hash + log_index: Unique intent identifier - MUST group by both for accurate volume calculations
  • amount_usd: Intent value in USD - use with MAX() per intent to avoid overcounting
  • symbol: Token symbol for token-specific analysis (USDT, NEAR, ETH, etc.)
  • blockchain: Source/destination chain (near, eth, bsc, sol, etc.) for cross-chain flow analysis
  • old_owner_id / new_owner_id: Sender/recipient addresses - use old_owner_id to identify intent initiator
  • log_event_index: Step order within intent - useful for understanding transaction flow
  • block_timestamp: Time of transaction - use for time-series analysis and filtering
  • receipt_succeeded: Transaction success status - filter to TRUE for successful intents only
  • referral: Referral address for referral program analysis
  • fee_amount_usd: Fee collected in USD - separate from main intent volume

Columns

Column NameData TypeDescription
BLOCK_TIMESTAMPTIMESTAMP_NTZThe date and time at which the block began.
BLOCK_IDNUMBERThe height of the chain this block corresponds with.
TX_HASHTEXTUnique identifier (hash) of this transaction.
RECEIPT_IDTEXTThe identifying hash for a receipt.
RECEIVER_IDTEXTAccount reacting to the receipt from predecessorid, 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 txreceiver and is specific to the receipt being processed.
PREDECESSOR_IDTEXTAccount that called the relevant receipt (often the same as tx_signer, but can be system as well). This field identifies the account that directly invoked the receipt being processed. In simple transactions, this is typically the same as the transaction signer. However, in cross-contract calls or system operations, this may be a different account or the system account. This is crucial for understanding the call chain and access control in NEAR’s execution model.
LOG_EVENTTEXTType of NEP245 event (e.g., mttransfer, mtburn, mt_mint)
TOKEN_IDVARIANTThe identifier of the token being transferred or minted.
SYMBOLTEXTToken symbol (e.g., ‘wNEAR’, ‘SWEAT’). This field contains the abbreviated identifier for the token as commonly used in trading pairs, price feeds, and user interfaces. Token symbols are typically 2-6 characters long and provide a quick way to identify tokens without using their full contract addresses. Examples include ‘NEAR’ for the native token, ‘wNEAR’ for wrapped NEAR, and ‘USDC’ for USD Coin.
AMOUNT_ADJFLOATDecimal adjusted amount of tokens (as float, rounded - use this generally). This field provides the token amount after applying the appropriate decimal precision adjustments based on the token’s decimal places. For example, if transferring 1 NEAR token, the amount_adj would be 1.0 after dividing the raw amount (1e24) by 10^24. This field is the most commonly used representation for token amounts in analytics and reporting as it provides human-readable values.
AMOUNT_USDFLOATUSD value of the token transfer (null if hourly price not available). This field provides the dollar equivalent value of the token transfer by multiplying the decimal-adjusted token amount by the token’s USD price at the time of the transfer. This field is null when price data is unavailable, which can occur for new tokens, tokens with low liquidity, or during periods when price feeds are unavailable.
OWNER_IDTEXTOwner account ID for mint/burn events
OLD_OWNER_IDTEXTSender account ID for transfer events
NEW_OWNER_IDTEXTReceiver account ID for transfer events
AMOUNT_RAWTEXTUnadjusted amount of tokens as it appears on-chain (not decimal adjusted). This is the raw token amount before any decimal precision adjustments are applied. For example, if transferring 1 NEAR token, the amount_raw would be 1000000000000000000000000 (1e24) since NEAR has 24 decimal places. This field preserves the exact on-chain representation of the token amount for precise calculations and verification.
BLOCKCHAINTEXTThe name of the blockchain.
CONTRACT_ADDRESSTEXTThe address of the deployed contract for the token, nft, or other smart contract.
IS_NATIVEBOOLEANBoolean flag indicating whether the token is the native token of a blockchain (TRUE) or a fungible token contract (FALSE).
PRICEFLOATThe asset price, in US Dollars.
DECIMALSNUMBERNumber of decimal places for the token. This field specifies the precision of the token, indicating how many decimal places should be used when converting from raw on-chain amounts to human-readable values. For example, NEAR has 24 decimals, so 1 NEAR = 1e24 raw units. Most ERC-20 tokens use 18 decimals, while some tokens may use different precision based on their design requirements.
GAS_BURNTNUMBERGas burned for the receipt action. This field represents the amount of computational resources consumed specifically for the receipt being processed. Gas burning is the mechanism by which NEAR charges for computational work, and this field tracks the exact amount burned for this particular receipt action. In raw number format with 16 decimal places, to adjust divide by POW(10,16) or multiply by 1e-16.
MEMOTEXTOptional log message within the transaction (often null). This field contains additional information or context about the transfer, such as transaction notes, reference numbers, or descriptive text. Memos are commonly used in cross-chain bridges, exchange deposits, or other scenarios where additional context is needed to identify or process the transfer. The memo field is optional and frequently null for standard transfers.
REFERRALTEXTID of the referring protocol, as extracted from the Receipt log.
FEES_COLLECTED_RAWVARIANTRaw JSON object containing fee information collected from the intent execution, as extracted from the DIP4 event log. This field contains the complete on-chain representation of fees charged by the intent protocol, formatted as a JSON object with token addresses as keys and unadjusted fee amounts as values. For example: {"nep141:wrap.near": "1232145523809524"} indicates fees collected in wrapped NEAR tokens. This field is null when no fees were collected or when fee information is not availab…
FEE_TOKENTEXTToken symbol for the fee collected (e.g., ‘NEAR’, ‘USDT’). This field identifies the specific token in which the intent execution fee was charged, extracted and labeled from the feescollectedraw JSON object. Fee tokens are typically stablecoins (like USDT, USDC) or the native protocol token (NEAR), though any supported token can be used for fees. This field is null when no fees were collected or when the fee token cannot be identified in the token metadata. Understanding fee tokens is importa…
FEE_AMOUNT_ADJFLOATDecimal-adjusted fee amount collected from the intent execution. This field provides the fee amount after applying the appropriate decimal precision adjustments based on the fee token’s decimal places. For example, if a fee of 1 USDT was collected, the feeamountadj would be 1.0 after dividing the raw amount by 10^6 (USDT has 6 decimal places). This field is the most commonly used representation for fee amounts in analytics and reporting as it provides human-readable values. This field is null…
FEE_AMOUNT_USDFLOATUSD value of the fee collected from the intent execution. This field provides the dollar equivalent value of the fee by multiplying the decimal-adjusted fee amount by the fee token’s USD price at the time of the intent execution. This standardized USD representation enables protocol revenue analysis, fee tracking across different tokens, and cost comparisons over time. The field uses ZEROIFNULL to ensure zero values when price data is unavailable rather than null, which simplifies aggregation…
DIP4_VERSIONTEXTVersion of the DIP4 standard that emitted the log for this action.
LOG_INDEXNUMBERSequential index of the log entry within the receipt
LOG_EVENT_INDEXNUMBERPosition of the event in the log_data array
AMOUNT_INDEXNUMBERPosition of the amount in the flattened amounts array from the NEP245 event
RECEIPT_SUCCEEDEDBOOLEANBoolean indicating whether the receipt was successfully processed. This field tracks the execution status of the receipt, which is crucial for understanding transaction outcomes. While most transactions succeed, individual receipts within a transaction can fail due to various reasons such as insufficient gas, contract errors, or invalid parameters. This field is essential for filtering successful operations and analyzing failure patterns.
TOKEN_IS_VERIFIEDBOOLEANBoolean flag indicating whether the token or price record is verified by Flipside’s crosschain curation process. Verified tokens are prioritized for analytics and are considered reliable for most use cases. Unverified tokens may be incomplete, deprecated, or experimental.
EZ_INTENTS_IDTEXTA unique identifier for the record.
INSERTED_TIMESTAMPTIMESTAMP_NTZThe timestamp at which the record was initially created and inserted into this table.
MODIFIED_TIMESTAMPTIMESTAMP_NTZThe timestamp at which this record was last modified by an internal process.
_INVOCATION_IDTEXTA job ID to identify the run that last modified a record.