0x000eth-sW-WATLucky Coin: Blast Gold Event copy
Updated 2024-10-12
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
›
⌄
-- forked from sssstatistic / Lucky Coin: Blast Gold Event @ https://flipsidecrypto.xyz/sssstatistic/q/kayGO0ONDrn2/lucky-coin-blast-gold-event
-- forked from TOP Lucky Coin @ https://flipsidecrypto.xyz/studio/queries/d121a381-d844-4947-82c4-918e7dbf2810
WITH tables AS (
select decoded_log['tableId'] AS tableId,
max(decoded_log['host']) AS host,
max(decoded_log['player']) AS player,
max(decoded_log['winner']) AS winner,
max(decoded_log['cost'] / pow(10, 18)) AS cost,
max(decoded_log['reward'] / pow(10, 18)) AS reward
from blast.core.ez_decoded_event_logs
where contract_address = '0xaf466677d96e6df2e31a86fda7e54a31d64647ed'
and block_timestamp BETWEEN '2024-10-11 03:00:00' and '2024-10-28 03:00:00'
and event_name in (
'NewTable',
'Play',
'Claim'
)
GROUP BY decoded_log['tableId']
order by tableId DESC
), info AS (
-- winner
SELECT winner as address,
sum(cost * 90 / 100) AS reward,
max(cost) AS cost,
count(*) as times
FROM tables tb
WHERE winner is not NULL
group by winner
UNION ALL
-- unlucky
SELECT CASE
WHEN winner = player then host
ELSE player
END AS address,
QueryRunArchived: QueryRun has been archived