Updated 2022-03-16
    with brg as(select
    block_timestamp::date date,
    tx_id ,
    MSG_SENDER,
    Amount,
    AMOUNT_USD,
    CURRENCY,
    RECIPIENT
    from terra.transfer_events
    where RECIPIENT in ('terra1v0zuhlzznmz8r5csel3dtrm0pst0dmett62j6z' --scr
    ,'terra1kq2rzz6fq2q7fsu75a9g7cpzjeanmk68wplle5' --osm
    ,'terra17nsujlwvwf4xrgawwgxqphdak2anflw5hga0zu') --- inj
    and CURRENCY in ('UST','LUNA') and AMOUNT_USD is not null)

    SELECT
    case
    when RECIPIENT = 'terra1v0zuhlzznmz8r5csel3dtrm0pst0dmett62j6z' then 'secret'
    when RECIPIENT = 'terra1kq2rzz6fq2q7fsu75a9g7cpzjeanmk68wplle5' then 'osmosis'
    when RECIPIENT = 'terra17nsujlwvwf4xrgawwgxqphdak2anflw5hga0zu' then 'injective'
    end as destination,
    count(distinct tx_id) tx_count,
    count(distinct MSG_SENDER ) sender,
    CURRENCY,
    sum(AMOUNT) native_amount,
    sum(AMOUNT_USD) AMOUNT_USD
    from brg
    group by 1,CURRENCY
    order by 1,2,4
    Run a query to Download Data