mz0111Quix distribution 2 since 2022
Updated 2022-09-27Copy Reference Fork
999
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 Pricet as (
select hour::date as PriceDate,
Symbol as USDToken,
avg (price) as USDPrice
from optimism.core.fact_hourly_token_prices
where Symbol in ('OP', 'ETH', 'WETH')
group by 1,2),
Seaport as (
select tx_hash from optimism.core.fact_event_logs where contract_address = '0x998ef16ea4111094eb5ee72fc2c6f4e6e8647666'), --SeaPort Contract
WETH_Table as (
select tx_hash from optimism.core.fact_event_logs where contract_address = '0x4200000000000000000000000000000000000006'), --WETH
Table1 as (
select block_timestamp::date as date,
tx_hash,
event_inputs:to as Buyer,
event_inputs:from as Seller,
contract_address as Collection,
event_inputs[0]:tokenid as Token_ID
from optimism.core.fact_event_logs
where event_name = 'Transfer'
and tx_hash in (select tx_hash from Seaport)),
ETH_Table as (
select date,
a.tx_hash,
'ETH' as Symbol,
Buyer,
Seller,
Collection,
Token_ID,
eth_value as amount
from Table1 a join optimism.core.fact_transactions b on a.tx_hash = b.tx_hash
where eth_value != 0),
Run a query to Download Data