olavRubicon swaps
Updated 2022-11-04Copy Reference Fork
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
list1 as (
select
block_timestamp,
tx_hash,
origin_from_address swapper,
event_inputs:buy_amt buy_amount_out,
event_inputs:pay_amt buy_amount_in,
event_inputs:buy_gem address_out,
event_inputs:pay_gem address_in
from optimism.core.fact_event_logs
where event_name = 'LogTrade'
and tx_status = 'SUCCESS'
and block_timestamp::date > current_date - interval '{{ days }} days'
and origin_to_address = '0x7af14adc8aea70f063c7ea3b2c1ad0d7a59c4bff'
),
list2 as (
select
t3.decimals as decimals_in,
t2.decimals as decimals_out,
buy_amount_out / pow(10, decimals_out) as amount_out,
buy_amount_in / pow(10, decimals_in) as amount_in,
t2.symbol as symbol_out,
t3.symbol as symbol_in,
list1.*
from list1
join optimism.core.dim_contracts t2
join optimism.core.dim_contracts t3
on
list1.address_out = t2.address
and
list1.address_in = t3.address
),
list3 as (
Run a query to Download Data