banterlyticsnft-won-new
Updated 2024-03-07
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
›
⌄
-- forked from nft-won @ https://flipsidecrypto.xyz/edit/queries/341e139a-8bc6-42d3-b885-95a8eb9d8b0a
with boundaries as
(select
ethereum.public.udf_hex_to_int(regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}')[0])::integer as season,
block_timestamp,
COALESCE(LEAD(block_timestamp) OVER (ORDER BY block_timestamp),to_timestamp(100000000000)) as next_timestamp
from polygon.core.fact_event_logs
where block_timestamp::date > '2024-01-04'
and contract_address = '0x70c575588b98c1f46b1382c706adaf398a874e3e'
and topics[0]::string = '0x9b492ca62dd845faf66276dbd14ed82e0d819d8b172cb51433ffe4268ab3dd9e')
SELECT boundaries.season,
sum(ethereum.public.udf_hex_to_int(regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}')[1]::string)) as nftwon
from polygon.core.fact_event_logs ftt
LEFT OUTER JOIN boundaries ON
ftt.block_timestamp >= boundaries.block_timestamp AND
ftt.block_timestamp < boundaries.next_timestamp
WHERE ftt.block_timestamp > '2024-01-04'
and topics[0]::string = lower('0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62')
and contract_address in (lower('0x543dc6ca8381e8a1dd425bd7a686d5d7295f950e'),lower('0x268166c237f6d7a061157891a3e2183c943e5f87'))
and topics[1] =lower('0x00000000000000000000000070c575588b98c1f46b1382c706adaf398a874e3e')
and season IS NOT NULL
group by 1
order by 1 desc
QueryRunArchived: QueryRun has been archived