cloudr3nFarmland Sales
    Updated 2023-03-27
    with farmland 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=lower('0x00f5D01D86008D14d04E29EFe88DffC75a9cAc47')
    --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 farmland
    group by dates
    order by dates desc

    Run a query to Download Data