dr1888Top 5 staker and unstakers
    Updated 2023-06-04
    with A as(
    SELECT
    ORIGIN_FROM_ADDRESS as User,
    sum(AMOUNT) as Total_Amount,
    'Unstaker' as label
    from ethereum.core.ez_token_transfers
    where from_ADDRESS='0x4da27a545c0c5b758a6ba100e3a049001de870f5'
    and ORIGIN_TO_ADDRESS='0x4da27a545c0c5b758a6ba100e3a049001de870f5'
    and block_timestamp >= CURRENT_DATE - {{Period_From_Current_Date}}
    and SYMBOL = 'AAVE'
    group by 1
    order by 2 DESC
    limit 5
    ),
    B as (
    SELECT
    ORIGIN_FROM_ADDRESS as User,
    sum(AMOUNT) as Total_Amount,
    'Staker' as label
    from ethereum.core.ez_token_transfers
    where TO_ADDRESS='0x4da27a545c0c5b758a6ba100e3a049001de870f5'
    and ORIGIN_TO_ADDRESS='0x4da27a545c0c5b758a6ba100e3a049001de870f5'
    and block_timestamp >= CURRENT_DATE - {{Period_From_Current_Date}}
    and SYMBOL='AAVE'
    group by 1
    order by 2 DESC
    limit 5
    ),
    C as(
    select * from A
    union all
    select * from B
    )
    select * from C
    Run a query to Download Data