MasiWeekly Per Liquidity
Updated 2024-09-16
999
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
›
⌄
-- forked from Weekly Swap Per Chain @ https://flipsidecrypto.xyz/edit/queries/12184f51-c338-444d-91a6-5f9f4485344b
with tb1 as ( select trunc(block_timestamp,'hour') as hourly,
'Ethereum' as chain,
tx_hash,
pool_name,
platform,
CONTRACT_ADDRESS as pool_address,
origin_from_address as trader,
case when token_in = lower('0x85F17Cf997934a597031b2E18a9aB6ebD4B9f6a4') then amount_in
when token_out = lower('0x85F17Cf997934a597031b2E18a9aB6ebD4B9f6a4') then amount_out end as swap_amount
from ethereum.defi.ez_dex_swaps
where (token_in = lower('0x85F17Cf997934a597031b2E18a9aB6ebD4B9f6a4')
or token_out = lower('0x85F17Cf997934a597031b2E18a9aB6ebD4B9f6a4')))
,
tb2 as ( select DISTINCT tx_hash
from ethereum.core.ez_decoded_event_logs
where (event_name ilike '%liquidity%'
or event_name ilike '%mint')
and tx_hash not in (select tx_hash from tb1))
,
tb3 as ( select trunc(a.block_timestamp,'hour') as hourly,
a.tx_hash,
a.origin_from_address as provider,
to_address as pool_address,
'ETH' AS SYMBOL,
a.amount as liquidity_amount,
amount_usd
from ethereum.core.ez_native_transfers a join tb1 b on a.to_address = b.pool_address
where a.tx_hash not in (select tx_hash from tb1)
UNION
select trunc(a.block_timestamp,'hour') as hourly,
a.tx_hash,
a.origin_from_address as provider,
to_address as pool_address,
SYMBOL,
QueryRunArchived: QueryRun has been archived