MasiUntitled Query
    Updated 2022-09-18
    with uniswap_date as ( select trunc(block_timestamp,'day') as day ,
    LIQUIDITY_PROVIDER as user ,
    tx_hash,
    AMOUNT0_ADJUSTED as amount
    from ethereum.uniswapv3.ez_lp_actions
    where TOKEN0_SYMBOL = 'WETH' and ACTION = 'DECREASE_LIQUIDITY'
    UNION
    select trunc(block_timestamp,'day') as day ,
    LIQUIDITY_PROVIDER as user ,
    tx_hash,
    AMOUNT1_ADJUSTED as amount
    from ethereum.uniswapv3.ez_lp_actions
    where TOKEN1_SYMBOL = 'WETH' and ACTION = 'DECREASE_LIQUIDITY' )


    select 'Uniswap' as platform,
    count(DISTINCT user) as total_users,
    count(DISTINCT tx_hash) as total_tx,
    sum(amount)*-1 as total_amount,
    total_amount/total_users as eth_per_user,
    avg(amount) as avg_amount,
    min(amount) as min_amount,
    max(amount) as max_amount,
    median(amount) as median_amoutn
    from uniswap_date
    where day >= CURRENT_DATE - 14
    group by 1
    UNION
    select 'AAVE' as platform,
    count(DISTINCT DEPOSITOR_ADDRESS) as total_users,
    count(DISTINCT tx_hash) as total_tx,
    sum(WITHDRAWN_TOKENS)*-1 as total_amount,
    total_amount/total_users as eth_per_user,
    avg(WITHDRAWN_TOKENS) as avg_amount,
    min(WITHDRAWN_TOKENS) as min_amount,
    max(WITHDRAWN_TOKENS) as max_amount,
    Run a query to Download Data