freemartianTotal Initial AISTR Activities percentage
    Updated 2025-01-13
    -- forked from Total Initial AISTR Activities Pie @ https://flipsidecrypto.xyz/studio/queries/93f72663-724e-4afb-b748-494335e77b5d

    WITH first_dist AS(
    SELECT block_timestamp, tx_hash, to_address AS user, amount AS first_amount_received,
    FROM base.core.ez_token_transfers
    WHERE contract_address = '0x20ef84969f6d81ff74ae4591c331858b20ad82cd'
    AND tx_hash = '0xcf585407c610647a46e7d8900b91db33df2d6276697f5bbf12e5be5d97796605'
    ORDER BY event_index ASC
    ),

    token_in_out AS(
    SELECT
    to_address AS user,
    SUM(amount) AS amount,
    FROM base.core.ez_token_transfers
    WHERE contract_address = '0x20ef84969f6d81ff74ae4591c331858b20ad82cd'
    GROUP BY 1
    UNION ALL
    SELECT
    from_address AS user,
    SUM(-amount) AS amount,
    FROM base.core.ez_token_transfers
    WHERE contract_address = '0x20ef84969f6d81ff74ae4591c331858b20ad82cd'
    GROUP BY 1
    ),
    current_user_amount AS(
    SELECT
    user,
    sum(amount) AS current_balance
    FROM token_in_out
    GROUP BY 1
    ),

    stake AS(
    -- stake
    SELECT
    Last run: 2 months ago
    LABEL
    VALUE
    1
    Crazy Jeet39
    2
    Dimond hands225
    3
    Partial jeets4
    4
    Profit takers17
    4
    81B
    39s