freemartianAptos Core - [bridge] all bridge activity
    Updated 2023-12-07
    -- SELECT split(payload_function, '::')[2] from aptos.core.fact_transactions
    -- GROUP BY 1



    select
    block_timestamp,
    tx_hash
    , version
    , split(payload_function, '::')[2] ::string as function
    , case
    when function = 'send_coin_from' then 'send'
    else 'receive'
    end as action
    , payload :type_arguments[0] ::string as token_address
    , dim_tokens.symbol
    , case
    when function = 'lz_receive'
    then livequery.utils.udf_hex_to_int(right(payload :arguments[2], 16))
    when function = 'send_coin_from'
    then payload :arguments[2]
    when function = 'claim_coin'
    then ifnull(events[0] :data :amount, events[1] :data :amount)
    else 0
    end / pow(10, zeroifnull(dim_tokens.decimals)) as amount
    , amount * price as amount_usd
    , case
    when function = 'lz_receive'
    then concat('0x', substr(payload :arguments[2], 69, 64))
    when function = 'send_coin_from'
    then sender
    when function = 'claim_coin'
    then sender
    else '0x00'
    end as user_address
    , 'LayerZero' as label_bridge
    Run a query to Download Data