rmasAcross Bridge Transactions - Assets Bridged
    Updated 2022-06-21
    WITH

    bridge_transactions AS (
    SELECT
    ev1.tx_hash
    , ev1.block_timestamp
    , ev1.origin_from_address AS wallet_address
    , regexp_substr_all(SUBSTR(ev1.data, 3, len(ev1.data)), '.{64}') AS segmented_data
    , ethereum.public.udf_hex_to_int(segmented_data[0]) AS amount
    , ethereum.public.udf_hex_to_int(segmented_data[1]) AS origin_chain_id
    , ethereum.public.udf_hex_to_int(segmented_data[2]) AS destination_chain_id
    , '0x' || right(segmented_data[5], 40) AS recipient
    , '0x' || right(ev1.topics[2], 40) AS token_address
    , '0x' || right(ev1.topics[3], 40) AS depositor
    FROM ethereum.core.fact_event_logs AS ev1
    WHERE ev1.tx_status = 'SUCCESS'
    AND ev1.contract_address = '0x4d9079bb4165aeb4084c526a32695dcfd2f77381'
    AND ev1.topics[0] = '0x4a4fc49abd237bfd7f4ac82d6c7a284c69daaea5154430cff04ad7482c6c4254' -- FundsDeposited event hash
    ),


    bridge_transactions_parsed AS (
    SELECT
    bt.tx_hash
    , bt.block_timestamp
    , bt.wallet_address
    , bt.depositor
    , bt.recipient
    , bt.token_address
    , p.symbol
    , bt.amount AS amount_raw
    , bt.amount / pow(10, p.decimals) AS amount_tokens
    , p.price * bt.amount / pow(10, p.decimals) AS amount_usd
    Run a query to Download Data