Updated 2024-09-17
    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')
    , tot as (
    select
    BLOCK_TIMESTAMP,
    TO_ADDRESS as user,
    (RAW_AMOUNT / 1e18) as amount,
    CONTRACT_ADDRESS,
    'stake' as action
    from
    ethereum.core.ez_token_transfers
    where
    CONTRACT_ADDRESS in (
    '0x98305ef9d2619651c9bde583d288bf16e99ecc02',
    '0x490d3f102247d9eee1466bebcbc7b737083a41f5',
    '0xef036919fe86f1dad362f4b3e631b4f663607118',
    '0xd9e6987d77bf2c6d0647b8181fd68a259f838c36',
    '0x610aebd620437b4b4e88801abd0c8ba0d009df5c',
    '0x5a10de50160126a5f936506bd342c541ac44e943',
    QueryRunArchived: QueryRun has been archived