0-MIDper boorroowwwweeerrr
    Updated 2023-05-09
    with tab1 as (
    select --BLOCK_TIMESTAMP::date as date
    DECODED_LOG:from as lender
    ,DECODED_LOG:to as borrower
    ,DECODED_LOG:amount as loan_amount
    ,TX_HASH
    from ethereum.core.ez_decoded_event_logs
    where ORIGIN_TO_ADDRESS='0x29469395eaf6f95920e59f858042f0e28d98a20b'
    and ORIGIN_FUNCTION_SIGNATURE='0xe263967e'
    and CONTRACT_ADDRESS='0x0000000000a39bb272e79075ade125fd351887ac'),
    tab2 as (
    select BLOCK_TIMESTAMP::date as date
    ,PROJECT_NAME
    ,TX_HASH
    from ethereum.core.ez_nft_transfers),
    tab3 as (
    select borrower
    ,count(distinct lender) as lenders
    ,count(distinct borrower) as borrowers
    ,count(distinct TX_HASH)as loans
    ,sum(loan_amount/1e18) as volume
    from tab1
    group by 1)
    select
    'Blend Protocol' as type
    ,avg(lenders) as "Avg Lenders"
    ,avg(borrowers) as "Avg Borrowers"
    ,avg(loans) as "Avg Loans"
    ,avg(volume) as "Avg Volume"
    from tab3
    group by 1




    Run a query to Download Data