saeedmzn[EarlyFans] -- daily purachsed post transactions
    Updated 2024-08-26
    with txns as (
    select BLOCK_TIMESTAMP::date date ,
    ORIGIN_FROM_ADDRESS user ,
    EVENT_NAME ,
    tx_hash
    from blast.core.ez_decoded_event_logs
    where CONTRACT_ADDRESS ='0x4b17a9318238403ddac8e3a790c3b06d18132bf4'
    -- and ORIGIN_FROM_ADDRESS =lower('0x8512cCBDb968282a32Ec91008eAB2D982F0B60eb')
    -- and EVENT_NAME ='PostListed'
    and event_name in ('PostPurchased','PostPurchasedWithValue')--PostPurchased --PostPurchasedWithValue
    ),
    transfers as (
    select tx_hash ,
    symbol ,
    amount ,
    iff(amount_usd is not NULL,amount_usd,amount * 0.02554098355)amount_usd ,
    FROM_ADDRESS,
    TO_ADDRESS,
    ORIGIN_FROM_ADDRESS,
    ORIGIN_TO_ADDRESS
    from blast.core.ez_token_transfers join txns using(tx_hash)
    UNION
    select tx_hash ,
    'ETH' symbol ,
    amount ,
    amount_usd,
    FROM_ADDRESS,
    TO_ADDRESS,
    ORIGIN_FROM_ADDRESS,
    ORIGIN_TO_ADDRESS
    from blast.core.ez_native_transfers join txns using(tx_hash)
    )
    select date ,
    count (DISTINCT user) num_purchasers ,
    count (DISTINCT tx_hash ) txns_,
    sum (amount_usd) purchased_amount ,
    QueryRunArchived: QueryRun has been archived