Specterthorchain refund reason
    Updated 2025-03-19
    -- forked from thorchain refund @ https://flipsidecrypto.xyz/studio/queries/c6cf7660-a123-43ae-9812-714f97f724aa

    SELECT DATE_TRUNC('week', block_timestamp) AS date,
    CASE
    WHEN LOWER(Reason) LIKE 'fail swap%' THEN 'fail swap'
    WHEN LOWER(Reason) LIKE 'fail to process withdraw request%' THEN 'fail to process withdraw request'
    WHEN LOWER(Reason) LIKE 'fail to add outbound tx%' THEN 'fail to add outbound tx'
    WHEN LOWER(Reason) LIKE 'emit asset%' THEN 'emit asset'
    WHEN LOWER(Reason) LIKE 'zero emit asset%' THEN 'zero emit asset'
    WHEN LOWER(Reason) LIKE '2 errors occurred%' THEN '2 errors occurred'
    WHEN LOWER(Reason) LIKE 'memo%' THEN 'memo'
    WHEN LOWER(Reason) LIKE 'unable to withdraw%' THEN 'unable to withdraw'
    WHEN LOWER(Reason) LIKE 'observed inbound tx%' THEN 'observed inbound tx'
    WHEN LOWER(Reason) LIKE 'output rune%' THEN 'output rune'
    WHEN LOWER(Reason) LIKE 'insufficient synth capacity%' THEN 'insufficient synth capacity'
    WHEN LOWER(Reason) LIKE 'trading is halted%' THEN 'trading is halted'
    WHEN LOWER(Reason) LIKE 'invalid tx type%' THEN 'invalid tx type'
    ELSE Lower(Reason)
    END AS simplified_reason,
    COUNT(DISTINCT tx_id) AS refund_count
    FROM thorchain.defi.fact_refund_events
    WHERE block_timestamp >= '2024-01-01'
    GROUP BY date, simplified_reason
    ORDER BY refund_count DESC

    Last run: about 1 month ago
    DATE
    SIMPLIFIED_REASON
    REFUND_COUNT
    1
    2025-02-24 00:00:00.000emit asset213123
    2
    2024-11-11 00:00:00.000emit asset153726
    3
    2025-01-20 00:00:00.000emit asset150826
    4
    2025-01-27 00:00:00.000emit asset149146
    5
    2024-12-02 00:00:00.000emit asset133671
    6
    2025-01-13 00:00:00.000emit asset132126
    7
    2025-03-03 00:00:00.000emit asset125079
    8
    2024-11-18 00:00:00.000emit asset118962
    9
    2024-11-04 00:00:00.000emit asset104408
    10
    2024-12-16 00:00:00.000emit asset101923
    11
    2025-02-17 00:00:00.000emit asset101405
    12
    2024-11-25 00:00:00.000emit asset97891
    13
    2025-02-03 00:00:00.000emit asset96733
    14
    2025-03-10 00:00:00.000emit asset96071
    15
    2025-01-06 00:00:00.000emit asset95198
    16
    2024-03-11 00:00:00.000emit asset87502
    17
    2024-12-09 00:00:00.000emit asset86845
    18
    2024-03-04 00:00:00.000emit asset80133
    19
    2024-08-05 00:00:00.000emit asset77888
    20
    2024-03-18 00:00:00.000emit asset73463
    ...
    937
    67KB
    2s