elsinaDistribution of total NFTs count bought by users of each blockchain
    Updated 2022-12-16
    with flow_price as (
    select
    date_trunc('day', timestamp) as day,
    avg(price_usd) as flow_price
    from flow.core.fact_prices
    where token_contract = 'A.1654653399040a61.FlowToken'
    group by 1
    ), revv_price as (
    select
    date_trunc('day', timestamp) as day,
    avg(price_usd) as revv_price
    from flow.core.fact_prices
    where token_contract = 'A.d01e482eb680ec9f.REVV'
    group by 1
    ),
    flow_usd as (
    select
    case
    when currency = 'A.d01e482eb680ec9f.REVV' then price * revv_price
    when currency in ('A.ead892083b3e2c6c.FlowUtilityToken', 'A.1654653399040a61.FlowToken') then price * flow_price
    when currency in ('A.3c5959b568896393.FUSD', 'A.ead892083b3e2c6c.DapperUtilityCoin', 'A.b19436aae4d94622.FiatToken') then price
    else null
    end as volume_usd, *
    from flow.core.ez_nft_sales join flow_price f on block_timestamp::date = f.day join revv_price r on block_timestamp::date = r.day
    where tx_succeeded = true and volume_usd is not null
    ),
    TX AS (
    SELECT
    blocK_timestamp,
    tx_hash,
    tx:receipt as receipt,
    tx:public_key as public_key,
    tx:signer_id as signer_id,
    tx:receiver_id as receiver_id
    FROM near.core.fact_transactions
    where block_timestamp::date < CURRENT_DATE
    Run a query to Download Data