rezarwzsimulate the distribution of points among users
Updated 2023-12-14
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 pol as (
SELECT
'pol' AS network,
ua,
SUM(v) AS total_v,
SUM(t) AS total_t,
d
FROM
(
SELECT
ev.ORIGIN_FROM_ADDRESS as ua,
COALESCE(SUM(ma.AMOUNT_USD), 0) + COALESCE(SUM(tr.AMOUNT_USD), 0) as v,
count(DISTINCT ev.tx_hash) as t,
date_trunc('month', ev.BLOCK_TIMESTAMP) as d
FROM
polygon.core.ez_decoded_event_logs ev
left JOIN polygon.core.ez_matic_transfers ma on ma.tx_hash = ev.tx_hash
and ev.ORIGIN_FROM_ADDRESS = ma.matic_from_address
left join polygon.core.ez_token_transfers tr on tr.tx_hash = ev.tx_hash
and ev.ORIGIN_FROM_ADDRESS = tr.from_address
where
ev.block_number >= 42020325
and ev.contract_Address = '0x3a23f943181408eac424116af7b7790c94cb97a5'
and event_name in ('SocketBridge', 'SocketSwapTokens')
and DECODED_LOG:metadata = '0x00000000000000000000000000000000000000000000000000000000000000cd'
GROUP by
1,
4
UNION
all
SELECT
matic_From_address as ua,
sum(amount_usd) as v,
count(DISTINCT tx_hash) as t,
date_trunc('month', ez.BLOCK_TIMESTAMP) as d
from
Run a query to Download Data