Unit Zero LabsPYTH First day Stats copy
    Updated 2024-04-24
    -- forked from kida / PYTH First day Stats @ https://flipsidecrypto.xyz/kida/q/RSS19aau82pf/pyth-first-day-stats

    with claims as (
    select
    tx_to as claimer,
    sum(amount) as claimed_amount
    from solana.core.fact_transfers
    where tx_from = '75WTeS4ZKruLJH4mz6omtbMNz8H9HEG1kY4G6VNQLX5i' -- claim source
    and mint = 'HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3'
    and block_timestamp >= '2023-11-20' -- 2023-11-20 first day
    and block_timestamp < '2023-11-21 11:00' -- 2023-11-20 first day, 2 weeks
    group by 1
    ),

    liquidity_txs as (
    select
    tx_id
    from solana.defi.fact_liquidity_pool_actions
    where mint = 'HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3'
    and block_timestamp >= '2023-11-20' -- 2023-11-20 first day
    and block_timestamp < '2023-11-21 11:00' -- 2023-11-20 first day, 2 weeks
    ),

    agg_liquidity as (
    select
    claimer,
    claimed_amount,
    sum(case
    when action = 'withdraw' then amount
    else 0
    end) as liquidity_removed,
    sum(case
    when action = 'deposit' then amount
    else 0
    end) as liquidity_provided,
    liquidity_provided - liquidity_removed as net_liquidity_provided,
    QueryRunArchived: QueryRun has been archived