freemartianAmbient Test
    Updated 2023-11-18
    with a AS (
    SELECT
    block_timestamp,
    tx_hash,
    LEFT(input,10) AS method,
    regexp_substr_all(SUBSTR(input, 11, len(input)), '.{64}') AS data,
    input,
    output,
    trace_index,
    type,
    identifier

    from ethereum.core.fact_traces
    -- WHERE tx_hash = '0xa3ade53fefb46c690261a9935e10c9deee06a8387e1cf2318c789c473bc6a631'
    WHERE (from_address = '0xaaaaaaaaa24eeeb8d57d431224f73832bc34f688' OR to_address = '0xaaaaaaaaa24eeeb8d57d431224f73832bc34f688')
    -- AND block_timestamp::date = current_date
    )

    SELECT
    block_timestamp,
    tx_hash,
    method,
    ARRAY_SIZE(data),
    data,
    CONCAT('0x', substr( data[0]:: STRING, -40, 42)) AS first_token,
    CONCAT('0x', substr( data[1]:: STRING, -40, 42)) AS second_token,
    ethereum.public.udf_hex_to_int(data[5]) AS first_token_amount,
    ethereum.public.udf_hex_to_int(data[8]) AS second_token_amount,
    input,
    output,
    trace_index,
    type,
    identifier
    from a
    -- WHERE tx_hash = '0x695df0fd945799dc56c7680d027a472e610ede2e5cb7c259fb8b80849a00c3b0'
    where tx_hash = lower('0xb5bed748dc6f2f5e2c67477ed18e075e9f2e450236cfc961cb759a2c2b56f510')
    Run a query to Download Data