0xHaM-dTotal
    Updated 2025-03-27
    with eventTb as (
    select
    block_timestamp,
    ORIGIN_FUNCTION_SIGNATURE,
    tx_hash,
    from_address as delegator,
    value as amount,
    concat('0x',split(input_data,'000000000000000000000000')[1]) as validator_id
    from ronin.core.fact_transactions
    where block_timestamp::date>='2024-10-01'
    and ORIGIN_FUNCTION_SIGNATURE = '0x5c19a95c' --Delegate
    and TO_ADDRESS='0x545edb750eb8769c868429be9586f5857a768758'

    union all

    select
    block_timestamp,
    ORIGIN_FUNCTION_SIGNATURE,
    tx_hash,
    origin_from_address as delegator,
    DECODED_LOG:amount/1e18 as amount,
    DECODED_LOG:poolId as validator_id
    from ronin.core.ez_decoded_event_logs
    where block_timestamp::date>='2024-10-01'
    and origin_TO_ADDRESS='0x545edb750eb8769c868429be9586f5857a768758'
    and ORIGIN_FUNCTION_SIGNATURE in (
    '0x4d99dd16' --undelegate
    , '0x097e4a9d' -- RewardClaimed
    )
    and EVENT_NAME in ('Undelegated','RewardClaimed')
    )
    ,
    priceTb as (
    select
    hour,
    median(price) as price
    QueryRunArchived: QueryRun has been archived