cloudr3ntotal chikn sales 2
Updated 2023-03-27Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
›
⌄
with chikn as (select
tokenflow_eth.hextoint(substr(data,1,66)) as tokenID,
tokenflow_eth.hextoint(substr(data,195,64))*pow(10,-18) as price,
concat('0x', substr(data,91,40)) as seller,
concat('0x', substr(data,155,40)) as buyer,
*,
data
from avalanche.core.fact_event_logs
where 1=1 and
--tx_hash='0xf1c076b053513b3838fefafe9602307db4a6c4bbb14f270725482cb58ba05499' and
origin_function_signature='0x2d296bf1' AND
price>0 and
event_name is null and
contract_address in ('0x8927985b358692815e18f2138964679dca5d3b79', '0x00f5d01d86008d14d04e29efe88dffc75a9cac47', '0xcf91b99548b1c17dd1095c0680e20de380635e20')
--where contract_address=lower('0x8927985B358692815E18F2138964679DcA5d3b79')
QUALIFY ROW_NUMBER() OVER (PARTITION BY tx_hash ORDER BY event_index desc) = 1
)
select sum(price) as daily_sales, date(block_timestamp) as dates
, sum(daily_sales) OVER( partition BY null ORDER BY dates ASC rows UNBOUNDED PRECEDING ) "CUMULATIVE SUM"
from chikn
group by dates
order by dates desc
Run a query to Download Data