scottincryptoShuttle Bridge Transactions BSC Sends
    Updated 2021-11-17
    --send native to bsc bridge
    select
    block_id
    , block_timestamp
    , chain_id
    , event_attributes:amount[0]:amount::numeric / 1e6 as amount
    , event_attributes:amount[0]:denom::string as denom
    , event_attributes:sender::string as user
    , 'send' as tx_direction
    , 'native' as token_type
    , 4 as shuttle_chain_id
    from terra.msg_events
    where event_attributes:recipient::string = 'terra1g6llg3zed35nd3mh9zx6n64tfw3z67w2c48tn2'
    and event_type = 'transfer'
    and tx_status = 'SUCCEEDED'
    and chain_id = 'columbus-5'
    and msg_type = 'bank/MsgSend'

    union all

    --send non_native to bsc bridge
    select
    block_id
    , block_timestamp
    , chain_id
    , coalesce(event_attributes:"0_amount"::numeric, event_attributes:amount::numeric) / 1e6 as amount
    , coalesce(event_attributes:"0_contract_address"::string, event_attributes:contract_address::string) as denom
    , event_attributes:from::string as user
    , 'send' as tx_direction
    , 'non_native' as token_type
    , 4 as shuttle_chain_id
    from terra.msg_events
    where event_attributes:to::string = 'terra1g6llg3zed35nd3mh9zx6n64tfw3z67w2c48tn2'
    and event_type = 'wasm'
    and tx_status = 'SUCCEEDED'
    and chain_id = 'columbus-5'
    Run a query to Download Data