0xHaM-dstake
    Updated 2022-10-16
    select
    BLOCK_TIMESTAMP::DATE as date,
    'Stake Pre Hack' as status,
    COUNT(DISTINCT TX_ID) as tx_cnt,
    count(DISTINCT SIGNERS[0]) as user_cnt,
    sum((PRE_BALANCES[0]/1e9) - (POST_BALANCES[0]/1e9)) as stake_amt,
    avg((PRE_BALANCES[0]/1e9) - (POST_BALANCES[0]/1e9)) as avg_stake_amt
    from solana.core.fact_staking_lp_actions
    where EVENT_TYPE in ('delegate')
    and SUCCEEDED = 'TRUE'
    and BLOCK_TIMESTAMP::date >= '2022-10-01'
    and block_timestamp::date < '2022-10-11'
    and PROGRAM_ID = 'Stake11111111111111111111111111111111111111'
    GROUP BY 1

    UNION
    select
    BLOCK_TIMESTAMP::DATE as date,
    'UnStake Pre Hack' as status,
    COUNT(DISTINCT TX_ID) as tx_cnt,
    count(DISTINCT SIGNERS[0]) as user_cnt,
    sum((POST_BALANCES[0]/1e9) - (PRE_BALANCES[0]/1e9)) as unstake_amt,
    avg((POST_BALANCES[0]/1e9) - (PRE_BALANCES[0]/1e9)) as avg_unstake_amt
    from solana.core.fact_staking_lp_actions
    where EVENT_TYPE in ('withdraw')
    and SUCCEEDED = 'TRUE'
    and BLOCK_TIMESTAMP::date >= '2022-10-01'
    and block_timestamp::date < '2022-10-11'
    and PROGRAM_ID = 'Stake11111111111111111111111111111111111111'
    GROUP BY 1

    UNION
    select
    BLOCK_TIMESTAMP::DATE as date,
    Run a query to Download Data