messariSei - Daily Volume and Transactions
    Updated 2024-07-09
    -- forked from hess / Daily Volume and Transactions @ https://flipsidecrypto.xyz/hess/q/rLyYAN1t2ycp/daily-volume-and-transactions

    with pallet as ( select block_timestamp::date as date,
    tx_id,
    seller_address as seller,
    buyer_address as buyer,
    amount as price,
    amount_usd as price_usd,
    nft_address as collection_address ,
    project_name,
    token_id
    from sei.nft.ez_nft_sales
    where tx_succeeded = 'TRUE'
    and platform_name ilike '%pallet%')
    ,
    price_usd as (select date(recorded_hour) as date,
    avg(price) as avg_price
    from osmosis.price.ez_prices
    where symbol = 'SEI'
    group by 1
    )
    ,
    mrkt as ( select DISTINCT tx_id
    from sei.core.fact_msg_attributes
    where attribute_value = 'sei1dkp90y3jpp2dres2ssp5rak2k6mc7l4nsxz58nktxjsxqp88fcasmrr672'
    and tx_succeeded = 'true'
    and attribute_key = '_contract_address'
    and msg_type = 'wasm'
    and block_timestamp::date >= '2024-02-22')
    ,
    mrkt_collection as ( select date(block_timestamp) as date, tx_id, MSG_GROUP, attribute_value as collection_address
    from sei.core.fact_msg_attributes
    where ATTRIBUTE_KEY = 'cw721_address'
    and msg_type = 'wasm'
    and block_timestamp::Date >= '2024-02-22'
    and tx_id in (select tx_id from mrkt))
    QueryRunArchived: QueryRun has been archived