SalehNot Your Keys-The destination of chains-daily
    Updated 2022-11-18
    -- dear jacktheguy
    -- Credit: https://app.flipsidecrypto.com/velocity/queries/bb56d191-232c-421b-99ff-93e4d1311ce1
    with txtable as (
    select
    tx_id
    ,ATTRIBUTE_VALUE as chain
    from axelar.core.fact_msg_attributes
    where ATTRIBUTE_KEY = 'destinationChain'
    and block_timestamp::date >= CURRENT_DATE - 30)

    ,usertable as (
    select
    ATTRIBUTE_VALUE as User
    ,tx_id
    from axelar.core.fact_msg_attributes
    where tx_id in (select tx_id from txtable)
    and ATTRIBUTE_KEY = 'spender'),

    maintable1 as (
    select distinct user,
    date_trunc(day,block_timestamp) as date
    ,t1.tx_id
    ,chain
    ,t1.ATTRIBUTE_VALUE
    from axelar.core.fact_msg_attributes t1 join txtable t2 on t1.tx_id = t2.tx_id
    join usertable t3 on t1.tx_id = t3.tx_id
    where MSG_TYPE = 'coin_spent'
    and ATTRIBUTE_INDEX = 1)

    ,labeltable as (
    select
    date
    ,attribute_value
    ,tx_id
    ,user
    ,chain
    Run a query to Download Data