CryptoIcicleSushi-104.Celsius and Sushi - Swaps
    Updated 2022-07-12
    -- Celsius and Sushi
    -- Payout 66.372 SUSHI
    -- Grand Prize 199.12 SUSHI
    -- Level Intermediate

    -- Q104. Find out what Celsius platform has done on sushi (swaps, lending, LP'ing, farming).
    -- Make sure to use cross-chain tables as much as possible to capture data on all chains.
    -- currently, we have swaps, lending, and borrowing data cross-chain.
    -- Hint: you can find all addresses belonging to Celsius network by querying this table: flipside_prod_db.crosschain.address_labels
    -- NOTE: This bounty will be paid on the ETH network. Please give your Sushiswap address on ETH when submitting


    with wallets as (
    select address
    from crosschain.address_labels
    where address_name = 'celsius wallet'
    )

    select
    date_trunc('month',block_timestamp) as date,
    concat(symbol_in,'-->',symbol_out) as pair,
    sum(amount_in_usd) as swap_volume,
    count(distinct tx_hash) as n_swaps
    from ethereum.core.ez_dex_swaps s
    join wallets w on s.origin_from_address = w.address
    where platform = 'sushiswap'
    group by 1,2



    Run a query to Download Data