with receiving_tx_id as (
select
tx_id
from
terra.msgs
where msg_value : execute_msg : submit_vaa is not null
and msg_value : contract :: string = 'terra10nmmwe8r3g99a9newtqa7a75xfgs2e8z87r2sf'
),
receiving_native_terra_asset as(
select
tx_id
from
terra.msg_events
where
tx_id in (
select
tx_id
from
receiving_tx_id
)
and event_type = 'from_contract'
and event_attributes : action :: string = 'complete_transfer_terra_native'
and tx_status = 'SUCCEEDED'
),
receiving_wrapped_asset as(
select
tx_id
from
terra.msg_events
where
tx_id in (
select
tx_id
from
receiving_tx_id
)