easonASTRO Sent (reg transfers, cw20)
    Updated 2024-05-22
    select
    -- block_timestamp,
    (msg:attributes [2] :value) as sender,
    -- (msg:attributes [3] :value) as receiver,
    sum(case
    when REGEXP_LIKE((msg:attributes [4] :value), '^[0-9]+(\.[0-9]+)?$')
    then CAST((msg:attributes [4] :value) as DECIMAL) / POWER(10,6)
    else 0
    end) as amount
    from terra.core.fact_msgs
    WHERE msg_type = 'wasm'
    and tx_succeeded = 'true'
    and (msg:attributes [0] :value) = 'terra1nsuqsk6kh58ulczatwev87ttq2z6r3pusulg9r24mfj2fvtzd4uq3exn26'
    and ((msg:attributes [1] :value) = 'transfer' or (msg:attributes [1] :value) = 'send')
    and REGEXP_LIKE((msg:attributes [4] :value), '^[0-9]+(\.[0-9]+)?$')
    and block_timestamp < '2024-01-15'
    group by sender
    order by amount DESC;


    QueryRunArchived: QueryRun has been archived