CryptoIcicleSolana-97.Solana Protocol Feature Saber - To SOL
    Updated 2022-07-13
    -- Payout 2.771 SOL
    -- Grand Prize 8.31 SOL
    -- Level Intermediate

    -- Q97. Choose a defi protocol from the following list and create a dashboard with the new Flipside layout that can refresh
    -- once a day highlighting at least 4 metrics of your choosing that helps show the "health" of the protocol and what is happening on it.
    -- Note any noticeable trends or current events for the protocol. Highlight how liquidity is
    -- flowing in and out of the protocol and which pools are popular.

    with to_amount as (
    select
    block_timestamp::date as date,
    sum(swap_to_amount) as swapped_to_amount,
    avg(swap_to_amount) as avg_swapped_to_amount,
    count(distinct swapper) as n_swappers,
    count(distinct tx_id) as n_swaps,
    sum(swapped_to_amount) over (order by date asc rows between unbounded preceding and current row) as cum_swapped_to_amount,
    sum(n_swappers) over (order by date asc rows between unbounded preceding and current row) as cum_n_swappers,
    sum(n_swaps) over (order by date asc rows between unbounded preceding and current row) as cum_n_swaps
    from solana.core.fact_swaps
    where swap_program = 'saber'
    and block_timestamp::date >= '2022-01-01'
    and succeeded = 'TRUE'
    and swap_to_mint = 'So11111111111111111111111111111111111111112'
    and swap_to_amount > 0
    group by date
    )

    select * from to_amount
    order by date desc
    Run a query to Download Data