Flipside TeamMatic: Top 10 Entities vs Others MoM stake/unstake
    Updated 2025-03-20
    -- forked from I - 3: Monthly - Top10 @ https://flipsidecrypto.xyz/studio/queries/32c16b33-b068-4acd-b406-e539954823c2

    with contracts as (with txs2 as (select TX_HASH
    from ethereum.core.ez_decoded_event_logs
    where CONTRACT_ADDRESS = '0x47cbe25bbdb40a774cc37e1da92d10c2c7ec897f'
    and CONTRACT_NAME = 'Matic Validator'
    and ORIGIN_FUNCTION_SIGNATURE = '0x6a761202'
    and ORIGIN_TO_ADDRESS = '0xfa7d2a996ac6350f4b56c043112da0366a59b74c') ,
    txs1 as (select TX_HASH
    from ethereum.core.ez_decoded_event_logs
    where CONTRACT_ADDRESS = '0x47cbe25bbdb40a774cc37e1da92d10c2c7ec897f'
    and CONTRACT_NAME = 'Matic Validator'
    and ORIGIN_FUNCTION_SIGNATURE = '0x4fdd20f1'
    and ORIGIN_TO_ADDRESS = '0x5e3ef299fddf15eaa0432e6e66473ace8c13d908')
    select date_trunc('month', BLOCK_TIMESTAMP) AS month,CONTRACT_ADDRESS
    from txs2 t left join ethereum.core.ez_decoded_event_logs e on t.TX_HASH=e.TX_HASH
    where EVENT_NAME = 'OwnershipTransferred'
    union
    select date_trunc('month', BLOCK_TIMESTAMP) AS month,CONTRACT_ADDRESS
    from txs1 t left join ethereum.core.ez_decoded_event_logs e on t.TX_HASH=e.TX_HASH
    where EVENT_NAME = 'OwnershipTransferred')
    , tot1 as (
    select
    date_trunc('month', BLOCK_TIMESTAMP) AS month,
    TO_ADDRESS as wallet,
    (RAW_AMOUNT / 1e18) as amount,
    CONTRACT_ADDRESS,
    'Stake' as action
    from
    ethereum.core.ez_token_transfers
    where
    CONTRACT_ADDRESS in (
    select CONTRACT_ADDRESS from contracts
    )
    and TO_ADDRESS != '0x0000000000000000000000000000000000000000'
    union
    Last run: about 1 month ago
    DMONTH
    Direction
    Labels
    Stake Changes
    Net Flow
    1
    2023-09-01 00:00:00.000UnstakeTop 10 Entities-2430606.29-80796184.87
    2
    2023-09-01 00:00:00.000UnstakeOthers-159161763.45-80796184.87
    3
    2023-09-01 00:00:00.000StakeOthers103239559.359227274.8
    4
    2023-09-01 00:00:00.000StakeTop 10 Entities15214990.359227274.8
    5
    2023-10-01 00:00:00.000StakeTop 10 Entities13749257.63121802383.19
    6
    2023-10-01 00:00:00.000StakeOthers229855508.75121802383.19
    7
    2023-10-01 00:00:00.000UnstakeTop 10 Entities-2979843.46-130644013.065
    8
    2023-10-01 00:00:00.000UnstakeOthers-258308182.67-130644013.065
    9
    2023-11-01 00:00:00.000UnstakeOthers-316033368.45-168123321.865
    10
    2023-11-01 00:00:00.000StakeTop 10 Entities25410017.25108961222.235
    11
    2023-11-01 00:00:00.000UnstakeTop 10 Entities-20213275.28-168123321.865
    12
    2023-11-01 00:00:00.000StakeOthers192512427.22108961222.235
    13
    2023-12-01 00:00:00.000StakeTop 10 Entities26194628.98149588044.09
    14
    2023-12-01 00:00:00.000StakeOthers272981459.2149588044.09
    15
    2023-12-01 00:00:00.000UnstakeOthers-368874847.83-185206980.575
    16
    2023-12-01 00:00:00.000UnstakeTop 10 Entities-1539113.32-185206980.575
    17
    2024-01-01 00:00:00.000UnstakeTop 10 Entities-28810328.51-82484599.77
    18
    2024-01-01 00:00:00.000UnstakeOthers-136158871.03-82484599.77
    19
    2024-01-01 00:00:00.000StakeOthers283462169.09168320812.45
    20
    2024-01-01 00:00:00.000StakeTop 10 Entities53179455.81168320812.45
    52
    4KB
    138s