kidaHop Latency (Arbitrum)
    Updated 2023-01-07
    -- skipping TransferSentToL2 cause the transaction count is too large
    -- since we're just finding the median latency, the result wont be too different

    with
    origin_deposits as (
    select
    block_timestamp,
    tx_hash,
    'arbitrum' as from_chain,
    tokenflow_eth.hextoint(substr(data, 1 + 2, 64)) as amount,
    amount * 0.95 as lower_limit,
    substr(data, 1 + 2 + 64*1, 64) as nonce,
    tokenflow_eth.hextoint(topics[2]) as chain_id,
    '0x' || substr(topics[3], 27, 40) as recipient
    from arbitrum.core.fact_event_logs
    where topics[0] = '0xe35dddd4ea75d7e9b3fe93af4f4e40e778c3da4074c9d93e7c6536f1e803c1eb' -- TransferSent
    and chain_id in (1, 56, 137, 43114, 10, 42161)

    /* union

    select
    block_timestamp,
    tx_hash,
    'optimism' as from_chain,
    tokenflow_eth.hextoint(substr(data, 1 + 2, 64)) as amount,
    amount * 0.95 as lower_limit,
    '' as nonce,
    tokenflow_eth.hextoint(topics[1]) as chain_id,
    '0x' || substr(topics[2], 27, 40) as recipient
    from optimism.core.fact_event_logs
    where topics[0] = '0x0a0607688c86ec1775abcdbab7b33a3a35a6c9cde677c9be880150c231cc6b0b' -- TransferSentToL2
    and origin_function_signature = '0xdeace8f5' -- sendToL2 */
    ),

    ethereum_redeems as (
    select
    Run a query to Download Data