samTop Uniswap v3 LP by fees, fees/tvl in the past 7 days
    Updated 2021-10-06
    with a_swapfees as (SELECT
    pool_address,
    sum(abs(amount0_usd)) as total_swaps,
    0.0005*total_swaps as fees
    from uniswapv3.swaps
    where pool_address in (
    select
    pool_address
    from uniswapv3.pools
    where fee_percent = '0.05')
    and block_timestamp > CURRENT_DATE - 8
    group by 1),

    b_swapfees as (SELECT
    pool_address,
    sum(abs(amount0_usd)) as total_swaps,
    0.003*total_swaps as fees
    from uniswapv3.swaps
    where pool_address in (
    select
    pool_address
    from uniswapv3.pools
    where fee_percent = '0.3')
    and block_timestamp > CURRENT_DATE - 8
    group by 1),

    c_swapfees as (SELECT
    pool_address,
    sum(abs(amount0_usd)) as total_swaps,
    0.01*total_swaps as fees
    from uniswapv3.swaps
    where pool_address in (
    select
    pool_address
    from uniswapv3.pools
    where fee_percent = '1')
    Run a query to Download Data