adriaparcerisasAxelar bridge user behavior 2
    Updated 2024-07-17
    with
    attributes_prev_1 as (
    SELECT
    tx_id,
    --CASE WHEN ATTRIBUTE_KEY LIKE 'depositAddress' THEN ATTRIBUTE_VALUE END as sender,
    CASE WHEN ATTRIBUTE_KEY LIKE 'destinationChain' THEN ATTRIBUTE_VALUE END as chain
    FROM axelar.core.fact_msg_attributes WHERE attribute_key in ('destinationChain')
    ),
    attributes_prev_2 as (
    SELECT
    tx_id,
    CASE WHEN ATTRIBUTE_KEY LIKE 'depositAddress' THEN ATTRIBUTE_VALUE END as sender--,
    --CASE WHEN ATTRIBUTE_KEY LIKE 'destinationChain' THEN ATTRIBUTE_VALUE END as chain
    FROM axelar.core.fact_msg_attributes WHERE attribute_key in ('depositAddress')
    ),
    attributes as (
    select distinct x.tx_id,sender,chain
    from attributes_prev_1 x
    join attributes_prev_2 y on x.tx_id=y.tx_id
    where sender is not null and chain is not null
    ),
    tokens as (
    select
    trunc(block_timestamp,'day') as date,
    sender,
    --credits to jacktheguy for this part
    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 'WETH'
    WHEN attribute_value LIKE '%ibc/4627AD2524E3E0523047E35BB76CC90E37D9D57ACF14F0FCBCEB2480705F3CB8%' THEN 'LUNA'
    WHEN attribute_value LIKE '%wbtc-satoshi%' THEN 'WBTC'
    when attribute_value LIKE '%ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7%' THEN 'DAI'
    when attribute_value LIKE '%ibc/3FF92D26B407FD61AE95D975712A7C319CDE28DE4D80BDC9978D935932B991D7%' THEN 'DOT'
    when attribute_value LIKE '%ibc/D3327A763C23F01EC43D1F0DB3CEFEC390C362569B6FD191F40A5192F8960049%' THEN 'LINK'
    QueryRunArchived: QueryRun has been archived