drone-mostafamaker dep
    Updated 2023-05-09
    with price as (SELECT
    date_trunc ('WEEK',HOUR) as tIME,SYMBOL,
    avg (price) as Price
    FROM crosschain.core.ez_hourly_prices
    WHERE symbol like '%ETH%'
    GROUP BY 1,2)


    SELECT
    date_trunc ('week',BLOCK_TIMESTAMP) as date,
    count (DISTINCT TX_HASH) as TXN,
    count (DISTINCT DEPOSITOR) as Users,
    sum (AMOUNT_DEPOSITED * price) as USD,

    CASE
    when (AMOUNT_DEPOSITED * price) < 100 then 'Less than 100 USD'
    when (AMOUNT_DEPOSITED * price) BETWEEN 100 and 500 then 'Between 100 and 500 USD'
    when (AMOUNT_DEPOSITED * price) BETWEEN 500 and 1000 then 'Between 500 and 1K USD'
    when (AMOUNT_DEPOSITED * price) BETWEEN 1000 and 10000 then 'Between 1K and 10K USD'
    when (AMOUNT_DEPOSITED * price) BETWEEN 10000 and 100000 then 'Between 10K and 100K USD'
    when (AMOUNT_DEPOSITED * price) BETWEEN 100000 and 1000000 then 'Between 100K and 1M USD'
    else 'More than 1M USD' end as type

    FROM ethereum.maker.ez_deposits d
    LEFT JOIN price P on (tIME = date_trunc ('WEEK',BLOCK_TIMESTAMP) and d.SYMBOL = p.SYMBOL)
    WHERE TX_STATUS = 'SUCCESS'
    AND d.SYMBOL like '%ETH%'
    GROUP BY 1,type

    Run a query to Download Data