0x97a93E68f2f8d99A69a95e7a8b683561410a1ac3smart trader check (4.2) - Event Transfer table copy
Updated 2023-02-11Copy 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
›
⌄
-- forked from b93916b3-9cc9-44e2-88e0-f49d0265c058
with smart_trader as (select '{{address}}' as address),
raw_evt_transfer as
(select
'deposit' as type,
t.*,
c.name,
c.symbol,
t.raw_amount/cast(concat('1e',c.decimals) as numeric) as amount
from ethereum.core.fact_token_transfers t
inner join smart_trader s
on s.address = t.to_address
-- and symbol = '{{symbol}}'
and contract_address = '{{token_address}}'
and block_timestamp::date between '{{start_date}}' and '{{end_date}}'
inner join ethereum.core.dim_contracts c
on t.contract_address = c.address
union all
select
'withdraw' as type,
t.*,
c.name,
c.symbol,
t.raw_amount/cast(concat('1e',c.decimals) as numeric) as amount
from ethereum.core.fact_token_transfers t
inner join smart_trader s
on s.address = t.from_address
-- and symbol = '{{symbol}}'
and contract_address = '{{token_address}}'
and block_timestamp::date between '{{start_date}}' and '{{end_date}}'
inner join ethereum.core.dim_contracts c
on t.contract_address = c.address),
Run a query to Download Data