sarathnot_ur_keys7
    Updated 2022-11-19
    with satellite as ( select tx_id,
    ATTRIBUTE_VALUE as destination
    from axelar.core.fact_msg_attributes
    where ATTRIBUTE_KEY = 'destinationChain'
    and TX_SUCCEEDED = 'TRUE'),
    assets as ( select trunc(block_timestamp,'day') as day,
    a.tx_id,
    destination,
    attribute_value,
    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' end as assets
    from axelar.core.fact_msg_attributes a join satellite b on a.tx_id = b.tx_id
    where MSG_TYPE = 'coin_spent'
    and day > '2022-11-06'
    and ATTRIBUTE_INDEX = 1
    ),

    token_amount as ( select day,
    tx_id ,
    destination,
    assets,
    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 bridge_amount
    from assets
    where assets is not null
    Run a query to Download Data