0xaimanBid Purchase
Updated 2023-04-13
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
›
⌄
with a as (select * , datediff('day',block_timestamp, getdate()) as dd from ethereum.core.ez_nft_sales
where project_name ='ens'
and dd<=14 and currency_symbol = 'WETH'),
sales as (select block_timestamp,origin_from_address as buyer, tx_hash, event_inputs:tokenId as token_id
from ethereum.core.fact_event_logs
where --tx_hash = '0x4023e92459de14a3ea13507aca5f3f8ff14a8075e084ec069cfa546167cd6bda' and
contract_address = '0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85' and event_name = 'Transfer' and origin_to_address = '0x00000000006c3852cbef3e08e8df289169ede581')
,
raw as (select block_timestamp as t,tx_hash, event_inputs:label as ens_id,event_inputs:name as ens_label, event_inputs:cost/10e17 as mint_cost, length(ens_label) as len
from ethereum.core.fact_event_logs
where event_name = 'NameRegistered' and origin_to_address = '0x283af0b28c62c092c9727f1ee09c02ca627eb7f5' and event_inputs:name is not null),
raw2 as (select * from (select * from raw
where len= {{ENS_Series}} )
where regexp_like(ens_label, '^[0-9]*$')),
mint as ( select block_timestamp as t, tx_hash, tokenid from ethereum.core.ez_nft_mints
where nft_address= '0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85' and
project_name = 'ens'),
tid as (select mint.t, raw2.tx_hash, tokenid,ens_label, len
from mint inner join raw2 on
mint.tx_hash=raw2.tx_hash),
rawb as (select block_timestamp as t, platform_name, tid.tokenid,price, price_usd, total_fees,platform_fee,platform_fee_usd, TX_FEE, TX_FEE_USD,ens_label
from a inner join tid on a.tokenid=tid.tokenid)
select date(t) as dt, platform_name, count(tokenid) as n_ens_sold, sum(price) as sales_weth, sum(price_usd) as sales_usd, sum(platform_fee) as tot_platform_fees,
sum(platform_fee_usd) as tot_platform_fee_usd, sum(sales_weth) OVER(ORDER BY dt asc ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cum_sales_weth,
sum(sales_usd) OVER(ORDER BY dt asc ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cum_sales_usd,
sum(tot_platform_fees) OVER(ORDER BY dt asc ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cum_tot_platform_fees,
Run a query to Download Data