theericstoneWhere the OHMise Go?
Updated 2022-01-18
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
-- 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