Afonso_DiazGrouping transactions
    Updated 2025-01-20
    with

    main as (
    select
    tx_hash,
    block_timestamp,
    'Burrow' as platform,
    symbol,
    sender_id as user,
    amount_usd
    from
    near.defi.ez_lending
    where
    platform = 'burrow'
    and symbol ilike any ('USDt', 'USDC', 'FRAX')
    and actions in ('deposit', 'increase_collateral')
    )

    select
    case
    when amount_usd < 10 then 'Plankton (Less than $10)'
    when amount_usd <= 50 then 'Shrimp ($10 - $50)'
    when amount_usd <= 100 then 'Crab ($50 - $100)'
    when amount_usd <= 500 then 'Octopus ($100 - $500)'
    when amount_usd <= 1000 then 'Fish ($500 - $1,000)'
    when amount_usd <= 5000 then 'Dolphin ($1,000 - $5,000)'
    when amount_usd <= 10000 then 'Shark ($5,000 - $10,000)'
    when amount_usd <= 100000 then 'Whale ($10,000 - $100,000)'
    else 'Giant Squid (More than $100,000)'
    end as type,
    count(distinct tx_hash) as transactions,
    count (distinct user) as users
    from
    main
    where
    block_timestamp >= '2024-12-01'
    QueryRunArchived: QueryRun has been archived