superflyUntitled Query
Updated 2022-07-17Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
›
⌄
WITH lock AS (SELECT *,
CONCAT('0x', SUBSTR(topics [1] :: STRING, 27, 42)) AS wallets_have_locked_the_most ,
ethereum.public.udf_hex_to_int(topics [2] :: STRING) :: DATE AS lock_date,-----Locked till this time
regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented,
ethereum.public.udf_hex_to_int(segmented [1] :: STRING)/pow(10,18) AS Locked_value ----Volume /Value($VELO
FROM optimism.core.fact_event_logs --ORIGIN_FROM_ADDRESS ORIGIN_TO_ADDRESS
WHERE origin_to_address = '0x9c7305eb78a432ced5c4d14cac27e8ed569a2e26'
and origin_function_signature = '0x65fc3873'
and topics [0] :: STRING = '0xff04ccafc360e16b67d682d17bd9503c4c6b9a131f6be6325762dc9ffc7de624'
),m2 as (
select
block_timestamp::date as date,tx_hash,wallets_have_locked_the_most ,--Locked till this time
timediff(month,block_timestamp::date,lock_date) as locktime,Locked_value
from lock
where block_timestamp::date>=CURRENT_DATE()-28) ---- last 4 weeks
select distinct wallets_have_locked_the_most,
sum(Locked_value)------wallets have locked the most
from main1-----Table made by myself
group by 1 order by 2 DESC
limit 50 ---Top 50 numbers and more
Run a query to Download Data