Moefffllllwww7
    Updated 2023-01-10
    with flow_price as (
    select
    timestamp::date as date,
    token_contract,
    avg(price_usd) as price
    from flow.core.fact_prices
    where 1=1
    and token_contract in ('A.1654653399040a61.FlowToken', 'A.d01e482eb680ec9f.REVV')
    and timestamp::date between '2022-12-01' and CURRENT_DATE -1
    group by 1, 2
    ),
    Flow_nft_sales_table_1 as ( --- stablecoin payment
    select
    block_timestamp,
    tx_id as tx_hash,
    buyer,
    CASE
    when marketplace like '%.%' then split(MARKETPLACE, '.')[2]
    else marketplace
    end as marketplace,
    nft_collection as Collection_name,
    nft_id,
    price as amount_USD
    from flow.core.ez_nft_sales
    where 1=1
    and price is not null
    and price > 0
    and currency not in ('A.d01e482eb680ec9f.REVV', 'A.1654653399040a61.FlowToken')
    and block_timestamp::date between '2022-12-01' and CURRENT_DATE -1
    and TX_SUCCEEDED = 'TRUE'
    ),
    Flow_nft_sales_table_2 as (
    select
    block_timestamp,
    tx_id as tx_hash,
    buyer,
    Run a query to Download Data