Hessishkintsu - pass 2
    Updated 2025-05-21
    with trfs_direct as (SELECT
    BLOCK_TIMESTAMP as TIMEx,
    ORIGIN_FROM_ADDRESS as buyer,
    '0x'||SUBSTRING( TOPICS[2], 27) as seller,
    CAST(ethereum.public.udf_hex_to_int( data) AS NUMERIC) AS traded_nfts,
    tx_hash as tx
    from monad.testnet.fact_event_logs
    where --Tx_hash = '0xa63d2c298430b4210fcc207919d92087935f5767f5a2ab7c31677cf3d1550521' and
    CONTRACT_ADDRESS = '0x51e6da0e284609cd96e3134b12e94b4c4f0ca241' and
    TOPICS[0] = '0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62'
    and TOPICS[1] = '0x000000000000000000000000fbf166299d3c012de9efec0240d12756c1f4c0fc'),


    trfs_offers as (SELECT
    BLOCK_TIMESTAMP as timex,
    '0x'||SUBSTRING( TOPICS[3], 27) as buyer,
    TOPICS[3] as buyer_raw,
    '0x'||SUBSTRING( TOPICS[2], 27) as seller,
    CAST(ethereum.public.udf_hex_to_int( data) AS NUMERIC) AS traded_nfts,
    tx_hash as tx
    from monad.testnet.fact_event_logs
    where --Tx_hash = '0x4d0a70e1cbcd782624479fb99ba9b8fcda8ca95fb3dff7d99a2a5e88a146adef' and
    CONTRACT_ADDRESS = '0x51e6da0e284609cd96e3134b12e94b4c4f0ca241' and
    TOPICS[0] = '0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62'
    and TOPICS[1] = '0x0000000000000000000000000000000000000068f116a894984e2db1123eb395'),

    trades as (select value as volume,
    buyer,
    tx,
    sum(traded_nfts) as nfts,
    TIMEx
    from trfs_direct
    join monad.testnet.fact_traces
    on tx_hash = tx and buyer = FROM_ADDRESS
    and TO_ADDRESS = '0x0000000000000068f116a894984e2db1123eb395'
    QueryRunArchived: QueryRun has been archived