marquOP DEX Aggregators - Slingshot assets in
Updated 2022-09-29
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
swap_txs as (
select
block_timestamp,
tx_hash,
label_aggregator,
from_amount_raw,
from_amount_raw / pow(10,ifnull(prices_from.decimals,18)) as from_amount,
coalesce(from_amount * prices_from.price,
to_amount_raw / pow(10,ifnull(prices_to.decimals,18)) * prices_to.price,
0) as from_amount_usd,
prices_from.symbol as from_symbol
from (
select distinct
block_timestamp,
tx_hash,
'Slingshot' as label_aggregator,
origin_from_address as user_address,
first_value(raw_amount) over (partition by tx_hash order by regexp_replace(_log_id,'0x[A-z0-9]*-','')::int) as from_amount_raw,
first_value(contract_address) over (partition by tx_hash order by regexp_replace(_log_id,'0x[A-z0-9]*-','')::int) as from_token_address,
last_value(raw_amount) over (partition by tx_hash order by regexp_replace(_log_id,'0x[A-z0-9]*-','')::int) as to_amount_raw,
last_value(contract_address) over (partition by tx_hash order by regexp_replace(_log_id,'0x[A-z0-9]*-','')::int) as to_token_address
from optimism.core.fact_token_transfers
where origin_to_address in ('0x00c0184c0b5d42fba6b7ca914b31239b419ab80b','0xedd118e091eee0e7fa9eeb9b4db717518f56cb15')
and origin_function_signature = '0x06e75722'
and block_timestamp >= current_date() - interval '{{timeframe_months}} months'
Run a query to Download Data