keshanUntitled Query
Updated 2022-08-01
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
›
⌄
/* with data_ as (select tx_hash,
ifnull(address_name, contract_address) as contract_address,
block_timestamp,
origin_from_address,
event_index,
event_inputs:amount0In as amount0in,
event_inputs:amount0Out as amount0out,
event_inputs:amount1In as amount1in,
event_inputs:amount1Out as amount1out,
concat_ws('$', event_index, contract_address, amount0in, amount0out, amount1in, amount1out) as raw
from optimism.core.fact_event_logs left join optimism.core.dim_labels on contract_address=address
where origin_to_address='0xa132dab612db5cb9fc9ac426a0cc215a3423f9c9'
and event_name ='Swap' --and origin_function_signature='0xf41766d8'
)
select * from (
SELECT DISTINCT tx_hash,
min(origin_from_address) from_address,
ARRAYAGG(raw) fld,
ARRAYAGG(contract_address) pool,
ARRAYAGG(event_index) event_id,
ARRAYAGG(amount0in) amnt0in,
ARRAYAGG(amount0out) amnt0out,
ARRAYAGG(amount1in) amnt1in,
ARRAYAGG(amount1out) amnt1out
FROM data_
group by tx_hash
)
limit 5 */
select * from optimism.core.dim_contracts
--tx_hash='0x1fcf286457217de5f7a2d3a6f2383ebf4bd30fa2502900380c10cd2a0ca7977a'
--contract_address=lower('0xa132DAB612dB5cB9fC9Ac426A0Cc215A3423F9c9')
Run a query to Download Data