Elprognerd5 - month staking
    Updated 2023-06-05
    with t1 as (select date_trunc('month',BLOCK_TIMESTAMP) as date, amount,
    'Stake' as action,
    TO_ADDRESS as wallet,
    TX_HASH
    FROM ethereum.core.ez_token_transfers
    where CONTRACT_ADDRESS = '0x4da27a545c0c5b758a6ba100e3a049001de870f5' and from_address = '0x0000000000000000000000000000000000000000'

    union all

    select date_trunc('month',BLOCK_TIMESTAMP) as date, amount,
    'Unstake' as action,
    FROM_ADDRESS wallet,
    TX_HASH
    FROM ethereum.core.ez_token_transfers
    where CONTRACT_ADDRESS = '0x4da27a545c0c5b758a6ba100e3a049001de870f5' and to_address = '0x0000000000000000000000000000000000000000')


    select
    date,
    action,
    sum(amount) as volume,
    count(distinct wallet) as "Number of users",
    count(DISTINCT TX_HASH) as "Number of transactions"
    from t1
    GROUP BY 1, 2
    order by 1, 2
    Run a query to Download Data