scottincryptoParaswap swaps eth query 1
Updated 2021-12-19
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 tx_swap_events as (
select
tx_id
, origin_address --wallet/user address
, contract_address --token transferred
, symbol
, amount
, coalesce(amount_usd, 0) as amount_usd
, event_id
, row_number() over (partition by tx_id order by event_id) as event_count
, iff(amount_usd is null, 'no_amount', 'amount') as amount_status
from ethereum.udm_events
--where tx_id in ('0x707aa18bdce281cc7ce911c4cf95d9cbc8f060559665a7009e32012b159f7851' , '0xed3e12b026e5658cf08a97aaaf1e1f37fdd46e7fbd6e943ee53a7c9ffa9c3a51')
where to_address in ('0x72338b82800400f5488eca2b5a37270ba3b7a111' --AugustusSwapper Old Contract 2
, '0xf92c1ad75005e6436b4ee84e88cb23ed8a290988' --AugustusSwapper Old Contract 3
, '0x86969d29f5fd327e1009ba66072be22db6017cc6' --AugustusSwapper Paraswap V1
, '0x9509665d015bfe3c77aa5ad6ca20c8afa1d98989' --AugustusSwapper Paraswap V2
, '0xf90e98f3d8dce44632e5020abf2e122e0f99dfab' --AugustusSwapper Paraswap V3
, '0x1bd435f3c054b6e901b7b108a0ab7617c808677b' --AugustusSwapper Paraswap V4
, '0xdef171fe48cf0115b1d80b88dc8eab59176fee57' --AugustusSwapper Paraswap v5: Augustus Swapper Mainnet
)
and block_id < 13380733 --snapshot block from github
)
, eth_users as (
select
origin_address
, count(tx_id) as tx_count
, sum(amount_usd) as sum_usd
from tx_swap_events
where event_count = 1
group by origin_address
)
select
Run a query to Download Data