jackguyAAVE_SNX_1 copy copy
    Updated 2023-03-09
    -- forked from 9c98ac03-cee7-41f3-a912-f6624d06067c

    -- forked from 7a0ff81c-fc6a-487d-b75e-3c2dc2a7e80b

    SELECT
    CASE when borrow_volume_usd < 10 then 'a Below 10 USD Borrow'
    when borrow_volume_usd < 100 then 'b 10 - 100 USD Borrow'
    when borrow_volume_usd < 1000 then 'c 100 - 1,000 USD Borrow'
    when borrow_volume_usd < 10000 then 'd 1,000 - 10,000 USD Borrow'
    when borrow_volume_usd < 100000 then 'e 10,000 - 100,000 USD Borrow'
    when borrow_volume_usd < 1000000 then 'f 100,000 - 1,000,000 USD Borrow'
    else 'g Over 1,000,000 Borrow' end as user_group,
    count(*) borrower

    FROM (
    SELECT
    borrower_address,
    -- symbol,
    sum(BORROWED_USD) as borrow_volume_usd,
    count(DISTINCT tx_hash) as borrow_events,
    min(block_timestamp) as first_borrow_time

    FROM ethereum.aave.ez_borrows
    --WHERE symbol in ('SNX', 'UNI', 'MKR')
    WHERE symbol like 'MKR'
    AND aave_version LIKE 'Aave V2'
    GROUP BY 1
    ORDER BY borrow_volume_usd DESC
    ) GROUP BY 1



    Run a query to Download Data