azerbaijanUntitled Query
    Updated 2022-12-09
    with msgs as (
    select
    tx_id as tx,
    attribute_value as to_chain
    from axelar.core.fact_msg_attributes
    where attribute_key = 'destinationChain'),
    chains as (
    select
    date_trunc('day', block_timestamp) as day,
    case
    when attribute_value like '%uaxl%' then 'AXL'
    when attribute_value like '%uusdc%' then 'USDC'
    when attribute_value like '%ibc/6F4968A73F90CF7DE6394BF937D6DF7C7D162D74D839C13F53B41157D315E05F%' then 'UST'
    when attribute_value like '%ibc/9117A26BA81E29FA4F78F57DC2BD90CD3D26848101BA880445F119B22A1E254E%' then 'ATOM'
    when attribute_value like '%weth-wei%' then 'ETH'
    when attribute_value like '%ibc/4627AD2524E3E0523047E35BB76CC90E37D9D57ACF14F0FCBCEB2480705F3CB8%' then 'LUNA'
    when attribute_value like '%wbtc-satoshi%' then 'WBTC'
    ELSE 'Other' end as axl_symbol,
    to_chain,
    count(distinct tx_id) as transactions,
    sum(
    case
    when attribute_value like '%uaxl%' then cast(REPLACE(attribute_value, 'uaxl', '') as INT) / power(10, 6)
    when attribute_value like '%uusdc%' then cast(REPLACE(attribute_value, 'uusdc', '') as INT) / power(10, 6)
    when attribute_value like '%ibc/6F4968A73F90CF7DE6394BF937D6DF7C7D162D74D839C13F53B41157D315E05F%' then cast(REPLACE(attribute_value, 'ibc/6F4968A73F90CF7DE6394BF937D6DF7C7D162D74D839C13F53B41157D315E05F', '') as INT) / power(10, 6)
    when attribute_value like '%ibc/9117A26BA81E29FA4F78F57DC2BD90CD3D26848101BA880445F119B22A1E254E%' then cast(REPLACE(attribute_value, 'ibc/9117A26BA81E29FA4F78F57DC2BD90CD3D26848101BA880445F119B22A1E254E', '') as INT) / power(10, 6)
    when attribute_value like '%weth-wei%' then cast(REPLACE(attribute_value, 'weth-wei', '') as INT) / power(10, 18)
    when attribute_value like '%ibc/4627AD2524E3E0523047E35BB76CC90E37D9D57ACF14F0FCBCEB2480705F3CB8%' then cast(REPLACE(attribute_value, 'ibc/4627AD2524E3E0523047E35BB76CC90E37D9D57ACF14F0FCBCEB2480705F3CB8', '') as INT) / power(10, 6)
    when attribute_value like '%wbtc-satoshi%' then cast(REPLACE(attribute_value, 'wbtc-satoshi', '') as INT) / power(10, 9)end
    ) as amounts
    from axelar.core.fact_msg_attributes left outer join msgs on tx = tx_id
    where msg_type like 'coin_spent'
    and attribute_index = 1
    and not to_chain is NULL
    group BY 1,2,3 ),
    Run a query to Download Data