0xHaM-dalpha 1 copy
    Updated 2024-07-27
    -- forked from MLDZMN / alpha 1 @ https://flipsidecrypto.xyz/MLDZMN/q/2ovHeVLrneFj/alpha-1

    with Alpha as (
    select
    BLOCK_TIMESTAMP,
    'Alpha' as stage,
    tx_hash,
    MULTISIG_ADDRESS as multisig,
    OWNER_ADDRESS as owner,
    SERVICE_ID as serviceId,
    row_number() OVER (partition BY serviceId order by BLOCK_TIMESTAMP desc) as rank
    from crosschain.olas.ez_service_staking
    where PROGRAM_NAME = 'Alpha'
    and EVENT_NAME = 'ServiceStaked'
    qualify rank = 1
    )
    ,
    Everest as (
    select
    BLOCK_TIMESTAMP,
    'Everest' as stage,
    tx_hash,
    DECODED_LOG:multisig as multisig,
    DECODED_LOG:owner as owner,
    DECODED_LOG:serviceId as serviceId,
    row_number() OVER (partition BY serviceId order by BLOCK_TIMESTAMP desc) as rank
    from gnosis.core.ez_decoded_event_logs
    where CONTRACT_ADDRESS = '0x5add592ce0a1b5dcecebb5dcac086cd9f9e3ea5c'
    and EVENT_NAME = 'ServiceStaked'
    qualify rank = 1
    )
    , Coastal1 as (
    select
    BLOCK_TIMESTAMP,
    'Coastal' as stage,
    tx_hash,
    QueryRunArchived: QueryRun has been archived