azerbaijanUntitled Query
    Updated 2022-12-09
    with msgs as (
    select
    TX_ID as tx,
    ATTRIBUTE_VALUE as user_ID
    from AXELAR.CORE.FACT_MSG_ATTRIBUTES
    where ATTRIBUTE_KEY = 'spender'),

    chains as (
    select
    user_ID as users,
    BLOCK_TIMESTAMP::date as timestamps,
    a.TX_ID,
    a.ATTRIBUTE_VALUE
    from AXELAR.CORE.FACT_MSG_ATTRIBUTES a join msgs b on a.tx_id = b.tx
    where MSG_TYPE = 'coin_spent'
    and ATTRIBUTE_INDEX = 1
    and MSG_group = '1:0'),

    tokens as (
    select
    timestamps,
    ATTRIBUTE_VALUE,
    TX_ID,
    users,
    case
    when ATTRIBUTE_VALUE ilike '%uaxl%' then 'AXL'
    when ATTRIBUTE_VALUE ilike '%uusd%' then 'USDC'
    when ATTRIBUTE_VALUE ilike '%weth-wei%' then 'ETH'
    when ATTRIBUTE_VALUE ilike '%wbtc-satoshi%' then 'WBTC'
    when ATTRIBUTE_VALUE ilike '%ibc/6F4968A73F90CF7DE6394BF937D6DF7C7D162D74D839C13F53B41157D315E05F%' then 'UST'
    ELSE 'OTHER' end as token
    from chains),

    token_Amount_Table as(
    select
    timestamps,
    Run a query to Download Data