bitereumTrades 24h
    Updated 2024-11-14
    with trades as (select
    BLOCK_TIMESTAMP as time,
    EVENT_NAME as deal_type,
    case
    when EVENT_NAME = 'Buy' then DECODED_LOG:buyer::string
    when EVENT_NAME = 'Sell' then DECODED_LOG:buyOrder:trader::string
    else null end as buyer,
    case
    when EVENT_NAME = 'Buy' then DECODED_LOG:sell:trader::string
    when EVENT_NAME = 'Sell' then DECODED_LOG:seller::string
    else null end as seller,
    --DECODED_LOG:buyer::string as buyer,
    --DECODED_LOG:seller::string as seller,
    case
    when EVENT_NAME = 'Buy' then DECODED_LOG:sell:tokenId::integer
    when EVENT_NAME = 'Sell' then DECODED_LOG:tokenId::integer
    else null end as tokenId,
    -- case -- All in 1 collection
    -- when EVENT_NAME = 'Buy' then DECODED_LOG:sell:collection::string
    -- when EVENT_NAME = 'Sell' then DECODED_LOG:buyOrder:collection::string
    -- else null end as collection,
    case
    when EVENT_NAME = 'Buy' then DECODED_LOG:sell:price::integer / pow(10,18)
    when EVENT_NAME = 'Sell' then DECODED_LOG:buyOrder:price::integer / pow(10,18)
    else null end as price,
    case
    when EVENT_NAME = 'Buy' then DECODED_LOG:sellOrderHash::string
    when EVENT_NAME = 'Sell' then DECODED_LOG:buyOrderHash::string
    else DECODED_LOG:orderHash::string end as orderHash,
    DECODED_LOG as log,
    --TX_HASH
    *
    from blast.core.ez_decoded_event_logs
    where CONTRACT_ADDRESS = '0x5b8c52f4ebdb7c1eb01405a6e03916bba2a974c9'
    and TX_STATUS = 'SUCCESS'
    and EVENT_NAME <> 'CancelOrder'
    QueryRunArchived: QueryRun has been archived