granadohoTop 5 Polygon Borrow Market for Highest Fee Since the 7th of June 2022
    Updated 2022-07-12
    with poly_borrow_repay as (
    select
    lending_pool,
    sum(amount_usd) as repayment_usd
    from flipside_prod_db.crosschain.ez_borrowing
    where platform = 'sushi' and blockchain = 'polygon'
    and action = 'Repay' and block_timestamp >= '2022-06-07'
    and amount_usd is not null
    group by 1
    ), poly_borrow_borrow as (
    select
    lending_pool,
    sum(amount_usd) as borrow_usd
    from flipside_prod_db.crosschain.ez_borrowing
    where platform = 'sushi' and blockchain = 'polygon'
    and action = 'Borrow' and block_timestamp >= '2022-06-07'
    and amount_usd is not null
    group by 1
    )
    select
    a.lending_pool,
    (a.repayment_usd - b.borrow_usd) as borrow_fee
    from poly_borrow_repay a
    left outer join poly_borrow_borrow b
    on a.lending_pool = b.lending_pool
    where borrow_fee is not null
    order by 2 desc limit 5
    Run a query to Download Data