Afonso_Diazgrouping txns
    Updated 2024-12-14
    with

    main as (
    select
    distinct iff(direction = 'inbound', destination_address, source_address) as user
    from near.defi.ez_bridge_activity
    where platform = 'rainbow'
    and receipt_succeeded = 1
    and block_timestamp between '{{ start_date }}' and '{{ end_date }}'
    ),

    txns as (
    select
    tx_hash,
    block_timestamp,
    nft_address,
    platform_name,
    seller_address,
    buyer_address,
    price_usd
    from near.nft.ez_nft_sales
    where buyer_address in (select user from main)
    and block_timestamp >= '2024-01-01'
    )

    select
    case
    when price_usd < 10 then 'a. Less than 10 $'
    when price_usd <= 50 then 'b. 10 - 50 $'
    when price_usd <= 100 then 'c. 50 - 100 $'
    when price_usd <= 500 then 'd. 100 - 500 $'
    when price_usd <= 1000 then 'e. 500 - 1000 $'
    when price_usd <= 5000 then 'f. 1000 - 5000 $'
    when price_usd <= 10000 then 'g. 5000 - 10,000 $'
    when price_usd <= 100000 then 'h. 10,000 - 100,000 $'
    else 'i. More than 100,000 $'
    QueryRunArchived: QueryRun has been archived