Updated 2023-03-17
    WITH
    tab1 AS (
    SELECT date_trunc('day', block_timestamp) AS day, tx_id, attribute_value AS dest_chain
    FROM axelar.core.fact_msg_attributes
    WHERE attribute_key = 'destinationChain'
    ),
    tab2 AS (
    SELECT date_trunc('day', block_timestamp) AS day, tx_id, attribute_value AS dest_user
    FROM axelar.core.fact_msg_attributes
    WHERE attribute_key = 'destinationAddress' AND tx_id IN (SELECT tx_id FROM tab1)
    ),
    tab3 AS (
    SELECT date_trunc('day', block_timestamp) AS day, tx_id, attribute_value AS src_chain
    FROM axelar.core.fact_msg_attributes
    WHERE attribute_key = 'sourceChain' AND tx_id IN (SELECT tx_id FROM tab1)
    ),
    tab4 AS (
    SELECT date_trunc('day', block_timestamp) AS day, tx_id, attribute_value AS src_user
    FROM axelar.core.fact_msg_attributes
    WHERE attribute_key = 'sender' AND tx_id IN (SELECT tx_id FROM tab1)
    ),
    tab5 AS (
    SELECT date_trunc('day', block_timestamp) AS day, tx_id, attribute_value
    FROM axelar.core.fact_msg_attributes
    WHERE msg_type = 'coin_spent' AND attribute_index = 1
    AND tx_id IN (SELECT tx_id FROM tab1) AND tx_succeeded = 'TRUE'
    ),
    tab6 AS (
    SELECT
    t3.day, t3.tx_id, src_chain, dest_chain, src_user, dest_user, src_chain || ' To ' || dest_chain AS transfer_route,
    attribute_value AS token_code,
    CASE
    WHEN attribute_value LIKE '%uaxl%' THEN 'AXL'
    WHEN attribute_value LIKE '%uusdc%' THEN 'USDC'
    WHEN attribute_value LIKE '%ibc/9117A26BA81E29FA4F78F57DC2BD90CD3D26848101BA880445F119B22A1E254E%' THEN 'ATOM'
    WHEN attribute_value LIKE '%weth-wei%' THEN 'ETH'
    Run a query to Download Data