vendettasupply
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 data_all as (
select
DATE_TRUNC('WEEK', borrows.BLOCK_TIMESTAMP) AS date,
concat('0x', substring(topics[1], 27, 40)) as token,
tokenflow_eth.hextoint(substring(data, 67, 64)) as amount,
origin_from_address as user,
tx_hash,
'Supply' as action
from
optimism.core.fact_event_logs
where
contract_address = '0x794a61358d6845594f94dc1db02a252b5b4814ad'
and
topics[0] = '0x2b627736bca15cd5381dcf80b0bf11fd197d01a037c52b927a881a10fb73ba61' -- supply
and
block_timestamp::date >= CURRENT_DATE - 30
union all
select
DATE_TRUNC('WEEK', borrows.BLOCK_TIMESTAMP) AS date,
concat('0x', substring(topics[1], 27, 40)) as token,
tokenflow_eth.hextoint(substring(data, 67, 64)) as amount,
concat('0x', substring(topics[2], 27, 40)) as user,
tx_hash,
'Borrow' as action
from
optimism.core.fact_event_logs
where
contract_address = '0x794a61358d6845594f94dc1db02a252b5b4814ad'
and
topics[0] = '0xb3d084820fb1a9decffb176436bd02558d15fac9b0ddfed8c465bc7359d7dce0'
and
block_timestamp::date >= CURRENT_DATE - 240
)
, data_price as (
select
hour::date as date,
Run a query to Download Data