SocioAnalyticauniversal-moccasin
Updated 2024-12-05
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
›
⌄
-- Sample Deposit tx_hash (Blast) 0x248799202f1c5b8d23ebc1862be392c854579ab383f4e60116617e5bd3b6d9a2
-- -- Sample Deposit tx_hash (BSC) 0xc33c7e8679bffc539c166ca866f278944d96908379fa795302e25d45e6d88111
SELECT
'deposit' as action,
date_trunc('d', block_timestamp) as date,
-- decoded_log:epoch,
count(DISTINCT tx_hash) as n_deposits,
sum(decoded_log:amount * price / pow(10, decimals)) as volume,
count(DISTINCT origin_from_address) as n_users --decoded_log:spender can be used
FROM
blast.core.ez_decoded_event_logs a
LEFT JOIN ethereum.price.ez_prices_hourly b on hour = date_trunc('hour', block_timestamp)
where
event_name = 'AddLoad'
AND contract_address = '0x096430ef0a653c067df32e93ff77090e084169de' --AND origin_to_address = '0x0817b88a528e2f5f980d26e98fc950cbd6ae31ef'
AND token_address = '0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee'
AND date >= current_date - 30
GROUP BY
1,
2 --,3
UNION
SELECT
'redeem' as action,
date_trunc('d', block_timestamp) as date,
-- decoded_log:epoch as epoch,
count(DISTINCT tx_hash) as n_deposits,
sum(decoded_log:amount * price / pow(10, decimals)) as volume,
count(DISTINCT origin_from_address) as n_users --decoded_log:saver can be used
FROM
blast.core.ez_decoded_event_logs a
LEFT JOIN ethereum.price.ez_prices_hourly b on hour = date_trunc('hour', block_timestamp)
WHERE
event_name = 'SubLoad'
AND contract_address = '0x096430ef0a653c067df32e93ff77090e084169de' --AND origin_to_address = '0x0817b88a528e2f5f980d26e98fc950cbd6ae31ef'
AND token_address = '0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee'
AND date >= current_date - 30
QueryRunArchived: QueryRun has been archived