-- where token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' -- WETH contract
-- group by 1
-- ),
baseas(
select
e.block_timestamp,
e.tx_hash,
event_inputs:toasbuyer,
event_inputs:fromasseller,
event_inputs:tokenIdasid--,
-- raw_amount/pow (10,18) as amount_in_eth,
-- amount_in_eth * eth_price as amount_in_usd
frompolygon.core.fact_event_logse--join polygon.core.fact_token_transfers t on e.tx_hash = t.tx_hash and e.block_timestamp::date = t.block_timestamp::date join price on day = e.block_timestamp::date