scottincryptoYearn yvBOOST Zaps
    Updated 2021-09-21
    with zaptx as (
    select
    tx_id

    from ethereum.udm_events
    where contract_address = '0x9d409a0a012cfba9b15f6d4b36ac57a46966ab9a'
    and (origin_function_signature in ('0x38b32e68', '0x89c6973b', '0x82650b10', '0x2c6ca9ac', '0xf6216495')
    or origin_function_name in ('deposit', 'withdraw'))
    )

    , all_zap_details as (
    select
    *
    , case
    when origin_function_signature in ('0x38b32e68','0x82650b10') then 'Zapin'
    when origin_function_signature in ('0x89c6973b', '0x2c6ca9ac', '0xf6216495') then 'Zapout'
    when origin_function_name = 'deposit' then 'Deposit'
    when origin_function_name = 'withdraw' then 'Withdraw'
    else null
    end as zap_function
    from ethereum.udm_events
    where tx_id in (select tx_id from zaptx)
    )

    , zapins as (
    select
    *
    from all_zap_details
    --where to_address = '0x9d409a0a012cfba9b15f6d4b36ac57a46966ab9a'
    -- and from_address != '0x0000000000000000000000000000000000000000'
    where origin_address = from_address and
    zap_function in ('Zapin', 'Deposit')
    )

    , zapouts as (
    select
    Run a query to Download Data