Sandeshobliged-turquoise
    Updated 2024-11-20
    WITH dates AS (
    SELECT
    DATE_TRUNC('hour', BLOCK_TIMESTAMP) AS hour_timestamps
    FROM arbitrum.core.fact_transactions
    WHERE hour_timestamps >= '2024-11-18'
    AND hour_timestamps <= CURRENT_DATE
    GROUP BY 1
    ),
    stake AS (
    SELECT
    *,
    'stake' AS action,
    amount AS staked_amount
    FROM base.core.ez_token_transfers
    WHERE 1=1
    AND block_timestamp >= '2024-11-18 00:00:00.000'
    AND origin_function_signature = '0xa694fc3a'
    -- and origin_to_address=lower('0x56f9341eE2d2ede918BAEAAA6D236EEcEdA44468')
    AND contract_address = lower('0xEb6d78148F001F3aA2f588997c5E102E489Ad341')
    ),
    unstake AS (
    SELECT
    *,
    'unstake' AS action,
    -amount AS staked_amount
    FROM base.core.ez_token_transfers
    WHERE 1=1
    AND block_timestamp >= '2024-11-18 00:00:00.000'
    AND origin_function_signature = '0x2e17de78'
    -- and origin_to_address=lower('0x56f9341eE2d2ede918BAEAAA6D236EEcEdA44468')
    AND contract_address = lower('0xEb6d78148F001F3aA2f588997c5E102E489Ad341')
    ),
    combined AS (
    SELECT
    block_number,
    block_timestamp,
    QueryRunArchived: QueryRun has been archived