CryptoIcicleSushi-102.Stablecoins on Kashi - Ethereum
    Updated 2022-07-10
    -- Payout 44.248 SUSHI
    -- Grand Prize 132.74 SUSHI
    -- Level Beginner

    -- Q102. Analyze the behavior of stablecoins on Kashi markets. Which ones are being deposited for lending? Which ones as collateral?
    -- Do this for both polygon and Ethereum. You can use the cross-chain sushi ez_lending and ez_borrowing.
    -- Note: Currently the polygon data is only showing the recent months. We will back-fill the data in the future.
    -- Make sure your dashboard mentions the starting date on polygon data.
    -- NOTE: This bounty will be paid on the ETH network. Please give your Sushiswap address on ETH when submitting

    with borrowing as (
    select
    date_trunc('month',block_timestamp) as date,
    'Borrow' as type,
    symbol,
    concat(type,'::',symbol) as category,
    sum(amount) as asset_amount
    from ethereum.sushi.ez_borrowing
    where symbol in ( 'DAI', 'USDC', 'USDT', 'sUSD')
    group by 1, 2, 3, 4
    ),
    lending as (
    select
    date_trunc('month',block_timestamp) as date,
    'Lending' as type,
    symbol,
    concat(type,'::',symbol) as category,
    sum(amount) as asset_amount
    from ethereum.sushi.ez_lending
    where symbol in ( 'DAI', 'USDC', 'USDT', 'sUSD')
    group by 1, 2, 3, 4
    )

    select * from borrowing
    union select * from lending
    Run a query to Download Data