Moeglazglaz
    Updated 2022-12-06
    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 >= '2022-01-01'
    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 >= '2022-01-01'
    and nft_collection = 'A.87ca73a41bb50ad5.Golazos'
    and TX_SUCCEEDED = 'TRUE'
    ),
    Flow_nft_sales_table_2 as (
    select
    block_timestamp,
    tx_id as tx_hash,