KaskoazulFailed swaps
    Updated 2023-02-10

    with failed_swaps as (
    select r.tx_hash,
    case
    when regexp_substr(status_value, 'Failure') = 'Failure' then 'Failure'
    else 'Success'
    end as status
    from near.core.fact_receipts r
    left join near.core.fact_transactions t
    on r.tx_hash = t.tx_hash
    left join near.core.fact_actions_events_function_call e
    on r.tx_hash = e.tx_hash
    where t.tx_receiver = 'v2.ref-finance.near'
    and e.method_name = 'swap'
    )

    select count (distinct tx_hash)
    from failed_swaps
    where status = 'Failure'
    limit 100
    Run a query to Download Data