binhachonUntitled Query
Updated 2021-11-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
›
⌄
-- select liquidator, count(liquidator) number_of_liquidations, count(distinct borrower) number_of_borrowers from aave.liquidations
-- group by liquidator
-- order by number_of_borrowers asc, number_of_liquidations desc
-- with price as(
-- select distinct amount, tx_id, row_number() over (partition by tx_id order by amount desc) as rank from ethereum.udm_events
-- where tx_id in (select tx_id from ethereum.nft_events
-- where contract_address = '0x7e6bc952d4b4bd814853301bee48e99891424de0')
-- and origin_function_signature = '0xab834bab'
-- and event_type = 'native_eth'
-- and amount > 0
-- qualify rank = 1),
-- nft_events as(
-- select block_timestamp, ethereum.nft_events.tx_id, token_id, platform_fee, creator_fee, event_type, contract_address, amount as price, event_platform
-- from ethereum.nft_events left join price
-- on price.tx_id = ethereum.nft_events.tx_id
-- where contract_address = '0x7e6bc952d4b4bd814853301bee48e99891424de0'
-- )
with nft_polygon_events as(
select tx_id, block_timestamp, event_inputs, contract_address, event_inputs:"_ids" as ID_raw, position('"', ID_raw, 1) as pos_1, position('"', ID_raw, pos_1+1) as pos_2, substr(ID_raw, pos_1 + 1, pos_2 - pos_1 - 1)::float as ID from polygon.events_emitted
where contract_address = '0xee7459affc6710ddc4f2174c88d4b161e24c3853'
and event_name = 'TransferBatch'
and event_inputs:"_ids" = '["5"]'
),
price as(
select block_timestamp, tx_id, max(amount_usd) as sales_price from polygon.udm_events
where tx_id in (select tx_id from nft_polygon_events)
group by block_timestamp, tx_id
)
select * from nft_polygon_events
order by block_timestamp asc
Run a query to Download Data