mamad-5XN3k3Avant avUSD (Stakers Distribution)
    Updated 2025-03-27
    with rawt as (
    select
    'Deposit' as type,
    TX_HASH,
    BLOCK_TIMESTAMP,
    DECODED_LOG:"sender" as user,
    DECODED_LOG:"owner" as owner,
    DECODED_LOG:"assets"/1e18 as avusd_amount,
    DECODED_LOG:"shares"/1e18 as savusd_amount
    from avalanche.core.ez_decoded_event_logs
    where CONTRACT_ADDRESS = lower('0x06d47f3fb376649c3a9dafe069b3d6e35572219e')
    and EVENT_NAME = 'Deposit'
    and ORIGIN_FUNCTION_SIGNATURE = '0x6e553f65'
    and TX_SUCCEEDED = 'TRUE'
    --group by 1,2

    union

    select
    'Withdraw' as type,
    TX_HASH,
    BLOCK_TIMESTAMP,
    DECODED_LOG:"receiver" as user,
    DECODED_LOG:"owner" as owner,
    DECODED_LOG:"assets"/1e18 as avusd_amount,
    DECODED_LOG:"shares"/1e18 as savusd_amount
    from avalanche.core.ez_decoded_event_logs
    where CONTRACT_ADDRESS = lower('0x06d47f3fb376649c3a9dafe069b3d6e35572219e')
    and EVENT_NAME = 'Withdraw'
    and ORIGIN_FUNCTION_SIGNATURE = '0x9343d9e1'
    and TX_SUCCEEDED = 'TRUE'
    --group by 1,2
    )

    /*select
    date_trunc('week',BLOCK_TIMESTAMP) as date,
    Last run: about 1 month ago
    TYPE
    USERS
    1
    5. 1K ~ 5K33
    2
    3. 100 ~ 50023
    3
    4. 500 ~ 1K14
    4
    2. 10 ~ 10055
    5
    6. >5K62
    6
    1. <1062
    6
    105B
    4s