theericstoneWhere the OHMise Go?
    Updated 2022-01-18
    -- find the ones who sold the $OHMs
    with allswaps as (
    SELECT
    distinct tx_id, contract_address as swap_contract
    FROM
    ethereum.events_emitted
    where
    block_timestamp > current_date - 15
    and lower(event_name) like 'swap%'
    ),

    ohmditches as (
    select udm.tx_id from ethereum.udm_events udm
    join allswaps swa on
    swa.tx_id = udm.tx_id
    where to_address = swap_contract -- capture the "IN" side
    and contract_address = '0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5' -- restrict to $OHM ditches
    and amount > 0
    and block_timestamp > current_date - 15
    )

    select
    distinct coalesce(symbol,contract_address) as token,
    count(1) as n_swaps,
    sum(amount) as token_amount,
    sum(amount_usd) as usd_amount
    from ethereum.udm_events udm
    join allswaps swa on
    swa.tx_id = udm.tx_id
    where from_address = swap_contract -- what they get??
    and (contract_address <> '0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5'
    OR contract_address IS NULL) -- restrict to $OHM ditches
    and amount > 0 and amount_usd > 0
    and block_timestamp > current_date - 15
    group by 1
    order by n_swaps desc;
    Run a query to Download Data