Monitize AIHolders vs. Sellers ($NYAN)
    Updated 2024-07-15
    with claimert as (
    select
    distinct tx_to as claimer,
    sum(amount) as Claimed_Amount,
    rank() over(order by claimed_amount desc) as rank
    from solana.core.fact_transfers
    where tx_from = '4cZgUw6T8yYQ2CordAfSzS4Q5VKJNyVU3JEX6xGg2Xwy'
    and mint = 'NYANpAp9Cr7YarBNrby7Xx4xU6No6JKTBuohNA3yscP'
    --and program_id = 'meRjbQXFNf5En86FXT2YPz1dQzLj4Yb3xK8u1MVgqpb'
    and tx_to != 'C8FXTcztFpdjMjPZYtu6mMTs3M5fLzNKR7Q6vymkQC8e'
    and amount > 0
    group by 1
    ),

    balancet as (
    select
    OWNER as user_address,
    Holding_Volume
    from(
    select
    BLOCK_TIMESTAMP,
    OWNER,
    BALANCE as Holding_Volume,
    row_number() over (partition by ACCOUNT_ADDRESS order by BLOCK_TIMESTAMP desc) as ra
    from solana.core.fact_token_balances
    join claimert on OWNER = claimer
    where mint = 'NYANpAp9Cr7YarBNrby7Xx4xU6No6JKTBuohNA3yscP'
    and BALANCE is not null)
    where ra = 1
    and Holding_Volume > 0
    ),

    finalt as (
    select
    claimer,
    COALESCE(Claimed_Amount, 0) as Claimed_Volume,
    QueryRunArchived: QueryRun has been archived