Eman-RazActivity on Silo Finance
    Updated 2024-01-15
    with deposit as (select date_trunc('{{Time_Frame}}',block_timestamp) as "Date", count(distinct tx_hash) as "TXs Count",
    count(distinct depositor) as "User Count", sum(amount_usd) as "Volume (USD)", 'Deposit' as "Action"
    from arbitrum.defi.ez_lending_deposits
    where platform='Silo' and event_name='Deposit'
    group by 1),

    withdraw as (select date_trunc('{{Time_Frame}}',block_timestamp) as "Date",
    count(distinct tx_hash) as "TXs Count",
    count(distinct DEPOSITOR) as "User Count", -sum(amount_usd) as "Volume (USD)", 'Withdraw' as "Action"
    from arbitrum.defi.ez_lending_withdraws
    where platform='Silo' and event_name='Withdraw'
    group by 1),

    borrow as (select date_trunc('{{Time_Frame}}',block_timestamp) as "Date",
    count(distinct tx_hash) as "TXs Count",
    count(distinct borrower) as "User Count", -sum(amount_usd) as "Volume (USD)", 'Borrow' as "Action"
    from arbitrum.defi.ez_lending_borrows
    where platform='Silo' and event_name='Borrow'
    group by 1),

    repay as (select date_trunc('{{Time_Frame}}',block_timestamp) as "Date",
    count(distinct tx_hash) as "TXs Count",
    count(distinct BORROWER) as "User Count", sum(amount_usd) as "Volume (USD)", 'Repay' as "Action"
    from arbitrum.defi.ez_lending_repayments
    where platform='Silo' and event_name='Repay'
    group by 1
    order by 1)

    select * from deposit union all
    select * from withdraw union all
    select * from borrow union all
    select * from repay
    QueryRunArchived: QueryRun has been archived