maybeyonassushi_weekly_fees
    Updated 2021-11-20
    with
    swaps as (
    select
    block_timestamp,
    pool_name,
    tx_id,
    amount_usd as swap_vol,
    0.25*amount_usd/100 as lp_fee,
    0.05*amount_usd/100 as stake_fee
    from ethereum.dex_swaps
    where platform = 'sushiswap'
    and amount_usd < pow(10,8)
    and amount_usd > 0
    )
    select
    last_day(block_timestamp,'week') weekend,
    -- pool_name,
    count(tx_id) swaps,
    sum(swap_vol) as swap_vol,
    sum(lp_fee) as lp_fee,
    sum(stake_fee) as stake_fee,
    sum(lp_fee)*1000/count(tx_id) as fee_per_1000_swaps
    from swaps
    -- where platform = 'sushiswap'
    -- and amount_usd < pow(10,8)
    -- and amount_usd > 0
    group by 1--,2

    Run a query to Download Data