SocioAnalyticaoverview 7D copy
    Updated 2024-03-31
    -- forked from BlockTracker / overview 7D @ https://flipsidecrypto.xyz/BlockTracker/q/TLaGwp7chTvK/overview-7d

    with paras_market as (

    with buy as (
    select
    tx_hash,
    receiver_id as platform,
    block_timestamp,
    SIGNER_ID as buyer,
    args:nft_contract_id :: string as collection,
    args:token_id :: string as token_id,
    args:price :: int / pow(10, 24) as price
    from near.core.fact_actions_events_function_call
    where method_name = 'buy'
    and RECEIVER_ID = 'marketplace.paras.near'
    and RECEIPT_SUCCEEDED = 'TRUE'
    and block_timestamp :: date >= '2024-01-01'

    )
    ,
    near_price as (
    select
    date_trunc('hour', timestamp) as date,
    AVG(price_usd) as price_usd
    from near.price.fact_prices
    where symbol ilike 'wNEAR'
    group by 1
    )

    select
    a.block_timestamp,
    a.tx_hash,
    a.platform,
    a.buyer,
    a.collection,
    QueryRunArchived: QueryRun has been archived