freemartianPika V3 Vault
    Updated 2023-06-22
    -- select * FROM optimism.core.fact_token_transfers
    -- where tx_hash = '0x039d8c5514359e134d45f9cbf41bfaaea49ad26ef2ef43713d24229899690db9'

    -- with stake AS (
    -- SELECT
    -- sum(event_inputs:amount)/pow(10,8) as historical_stake
    -- FROM optimism.core.fact_event_logs
    -- WHERE event_name = 'Staked'
    -- AND origin_to_address = '0xd5a8f233cbddb40368d55c3320644fb36e597002'
    -- AND origin_function_signature = '0x7acb7757'),

    -- add_margin AS (
    -- SELECT
    -- sum(event_inputs:value)/pow(10,6) as add_margin
    -- FROM optimism.core.fact_event_logs
    -- WHERE event_name = 'Transfer'
    -- AND origin_to_address = '0xd5a8f233cbddb40368d55c3320644fb36e597002'
    -- AND origin_function_signature = '0xd41194b8'
    -- AND tx_status = 'SUCCESS'),

    -- reinvest AS (
    -- SELECT
    -- sum(event_inputs:amount)/pow(10,8) as reinvest
    -- FROM optimism.core.fact_event_logs
    -- WHERE event_name = 'Staked'
    -- AND origin_to_address = '0x939c11c596b851447e5220584d37f12854ba02ae'
    -- AND origin_function_signature = '0xfdb5a03e'),

    -- Unstake AS (
    -- SELECT
    -- sum(event_inputs:value)/pow(10,6) as historical_unstake
    -- FROM optimism.core.fact_event_logs
    -- WHERE event_name = 'Transfer'
    -- AND origin_to_address = '0xd5a8f233cbddb40368d55c3320644fb36e597002'
    -- AND origin_function_signature = '0x5c833bfd')

    Run a query to Download Data