Mikey_Bebop
Updated 2022-11-10Copy Reference Fork
999
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 bebop_supported_tokens as
(
select
distinct contract_address
from polygon.core.fact_event_logs
where origin_to_address = '0xaf0b0000f0210d0f421f0009c72406703b50506b' and
origin_function_signature in ('0x4263b9ab', '0x8c4bd1cb') and
event_name = 'Transfer' and
event_inputs:"from"::string = '0xaf0b0000f0210d0f421f0009c72406703b50506b'
),
polygon_decimals as
(
select distinct token, decimals
from
(
select token0_address as token, token0_decimals as decimals
from polygon.sushi.dim_dex_pools
where token0_decimals is not null and
token0_address in (select * from bebop_supported_tokens)
union all
select token1_address as token, token1_decimals as decimals
from polygon.sushi.dim_dex_pools
where token1_decimals is not null and
token1_address in (select * from bebop_supported_tokens)
)
),
polygon_prices as
(
select
avg(price) as price,
symbol,
token,
"Date"
from
Run a query to Download Data