afonsoUntitled Query
    Updated 2022-12-22
    with
    main as (
    select
    case currency
    when 'ibc/CBF67A2BCF6CAE343FDF251E510C8E18C361FC02B23430C121116E0811835DEF' then 'axlUSDT'
    when 'ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4' then 'axlUSDC'
    end as token,
    tx_id,
    amount/1e6 as amount,
    sender,
    block_timestamp,
    transfer_type
    from terra.core.ez_transfers x
    where 1 = 1

    and message_type in (
    '/cosmos.bank.v1beta1.MsgMultiSend',
    '/ibc.applications.transfer.v1.MsgTransfer',
    '/cosmos.bank.v1beta1.MsgSend'
    )
    and currency in (
    'ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4',
    'ibc/CBF67A2BCF6CAE343FDF251E510C8E18C361FC02B23430C121116E0811835DEF'
    )
    )
    ,

    inflow as (
    select
    date_trunc('week', block_timestamp)::date as week,
    token,
    count(distinct tx_id) as inflow_txn_num,
    sum(amount) as total_inflow_volume,
    count(distinct sender) as inflow_users_num
    from main
    Run a query to Download Data