MoDeFinear burrow pools - txs and volume feed
    Updated 2025-03-16
    with
    succeeded_txs as (
    select tx_hash as tx, TRANSACTION_FEE/1e24 as fee
    from near.core.fact_transactions
    where TX_SUCCEEDED=true and BLOCK_TIMESTAMP::date>'2023-05-09'
    ),

    panicked_txs as (
    select tx_hash
    from near.core.fact_receipts
    where STATUS_VALUE:Failure is not null
    and RECEIVER_ID='contract.main.burrow.near'
    and BLOCK_TIMESTAMP::date>'2023-05-09'
    group by 1),


    liquidated_txs as (
    select *
    from $query('c981addb-e92e-4898-86dc-d68f5ffbf610')),
    ---------------------------------------------------Burrow Platform---------------------------------------------------
    burrow_txs as (
    with burrow_events as (
    select BLOCK_TIMESTAMP, RECEIVER_ID, TRY_PARSE_JSON(CLEAN_LOG) AS event_json,
    a.tx_hash
    from near.core.fact_logs a
    left join panicked_txs c
    on a.tx_hash=c.tx_hash
    where event_json:standard='burrow'
    and BLOCK_TIMESTAMP::date>'2023-05-10'
    and RECEIVER_ID='contract.main.burrow.near'
    and c.tx_hash is null
    and event_json:event in ('deposit','withdraw_succeeded','deposit_to_reserve','repay','borrow'))


    select BLOCK_TIMESTAMP, event, 'Burrow' as platform,
    sender, receiver, token_id, symbol, amount, tx_hash, fee, raw_event
    QueryRunArchived: QueryRun has been archived