MostlyData_Rewards data by epoch C1
    Updated 2025-01-28
    -- forked from JitoMEV data by epoch @ https://flipsidecrypto.xyz/studio/queries/82973245-7881-4a00-a7b3-bd85278668aa

    /*
    This query decode MEV payment via Jito client following the schema described here

    https://jito-foundation.gitbook.io/mev/mev-payment-and-distribution/tip-distribution-program

    tracking the tip distribution program that is responsible for collecting and distributing MEV
    */
    with jito_tip_dist_program as(
    /*
    Tracking initializeTipDistributionAccount.
    See https://solscan.io/tx/64sBnPEsqNGZuqv7AT8GDxWHnNb5L4hSMRZnrdrX1XQJxS9FS9SpgnuApLTFheEXWNnzYQfyVzc7jn4XAGwLWAJr
    */
    select
    distinct ep.epoch,
    'Chorus One' as validator,
    instruction['parsed']['info']['newAccount'] as TipDistributionAccount

    from solana.core.fact_events_inner ei
    inner join solana.gov.dim_epoch ep on (ep.start_block <= ei.block_id and ei.block_id <= ep.end_block)

    where
    signers[0] = 'ChorusmmK7i1AxXeiTtQgQZhQNiXYU84ULeaYF1EH15n'
    and instruction_program_id = '4R3gSG8BpU4t19KYj8CfnbtRpnT8gtk4dvTHxVRwc2r7'
    and event_type = 'createAccount'
    and (
    (
    '{{n_days}}' = 0
    and block_timestamp >= cast('{{start_date}}' as timestamp)
    and block_timestamp <= cast('{{end_date}}' as timestamp)
    )
    or
    (
    '{{n_days}}' != 0
    QueryRunArchived: QueryRun has been archived