leo-lZzln2Untitled Query
    Updated 2022-10-26
    with tab0 as (
    SELECT
    date_trunc('day', TIMESTAMP) as day1,
    avg(PRICE_USD) as near_price
    FROM near.core.fact_prices
    WHERE SYMBOL ilike 'wNEAR'
    GROUP BY 1 ),
    near AS (
    SELECT
    TX_RECEIVER,
    count(distinct TX_SIGNER) as "signer",
    count(distinct tx_hash) as "Txn count",
    SUM(tx:actions[0]:FunctionCall:deposit*near_price / POW(10, 24)) as "NEAR VOLUME",
    COUNT(DISTINCT TRY_PARSE_JSON(REPLACE(tx:receipt[0]:outcome:logs[0], 'EVENT_JSON:')):data[0]:token_ids[0]) AS "Total Number of NFT"
    from near.core.fact_transactions LEFT outer JOIN tab0 ON day1 = date_trunc('day', block_timestamp)
    where block_timestamp::date >= current_date - 90
    AND tx:actions[0]:FunctionCall:method_name = 'nft_buy'
    GROUP by 1
    ),
    near_nft as (
    select
    block_timestamp::date as "block day",
    TX_RECEIVER
    from near.core.ez_nft_mints
    )
    SELECT
    *
    FROM near
    order by 3 desc
    limit 10
    Run a query to Download Data