RayyykFLOW Whales 6
    Updated 2022-11-27
    with table_1 as (select recipient as wallets,
    sum(amount) as amount_deposited
    from flow.core.ez_token_transfers
    where tx_succeeded = 'TRUE'
    and token_contract = 'A.1654653399040a61.FlowToken'
    group by 1),

    table_2 as (select sender as wallets,
    sum(amount) as amount_withdrew
    from flow.core.ez_token_transfers
    where tx_succeeded = 'TRUE'
    and token_contract = 'A.1654653399040a61.FlowToken'
    group by 1),

    table_3 as (select a.wallets,
    amount_deposited - amount_withdrew as flow_holdings
    from table_1 a
    join table_2 b on a.wallets = b.wallets
    having flow_holdings > 10000),

    table_4 as (select count(distinct(wallets)) as total_whales
    from table_3),

    table_5 as (select count(distinct(wallets)) as nft_wallets
    from flow.core.ez_nft_sales a
    join table_3 b on a.buyer = b.wallets
    where tx_succeeded = 'TRUE')

    select nft_wallets, 'Whales that have purchased an NFT'
    from table_5
    union
    select total_whales - nft_wallets, 'Whales that have not purchased an NFT'
    from table_4, table_5
    Run a query to Download Data