Datafismart trader check (5) - Event Transfer (all ERC-20)
Updated 2023-03-06Copy 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 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 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 block_timestamp::date between '{{start_date}}' and '{{end_date}}'
inner join ethereum.core.dim_contracts c
on t.contract_address = c.address),
day_close_price as
(SELECT
p.recorded_hour::date as date,
a.symbol,
a.name,
a.token_address,
p.close
Run a query to Download Data