vendettaWhale Staking 2 copy
    Updated 2023-02-14
    -- forked from e2e1859b-c8ad-4f35-946c-5c740cbad657

    with tab1 as (
    select
    tx_signer,
    sum(deposit/power(10,24)) as Amount_sent
    from near.core.fact_transfers
    group by 1
    ),
    tab2 as (
    select
    TX_RECEIVER,
    sum(deposit/power(10,24)) as Amount_recieved
    from near.core.fact_transfers
    group by 1
    )

    , tab3 as (
    select
    tx_signer,
    amount_recieved - amount_sent as Net_NEAR

    from tab1 left outer join tab2 on
    tx_signer = TX_RECEIVER
    having net_NEAR is not null
    and tx_signer not like '%lockup%' and tx_signer not like 'nfeco%' and tx_signer not like 'nfendowment%' and tx_signer not like 'aurora' and tx_signer not like 'kucoinc.near'
    and tx_signer not like 'binance1.near' and tx_signer not like 'marketplace.paras.near' and tx_signer not like 'bitkubhwallet.near' and tx_signer not like 'app.nearcrowd.near'
    and net_near < 45641694.4836753
    order by 2 desc
    limit 20 )

    select
    action,
    sum(stake_amount/power(10,24)) as Stake_Volume,
    count(*) as Stake_Events

    Run a query to Download Data