scottincryptostkAAVE and stkABPT token distribution
    Updated 2023-05-09
    with staked as (
    select
    contract_address
    , event_inputs:to as wallet
    , sum(event_inputs:amount::numeric / 1e18) as amount_staked
    from ethereum.core.fact_event_logs
    where contract_address in ('0x4da27a545c0c5b758a6ba100e3a049001de870f5', '0xa1116930326d21fb917d5a27f1e9943a9595fb47') --stkAAVE, stkABPT
    and block_timestamp > '2020-09-23'
    and event_name = 'Staked'
    group by 1,2
    )

    , redeemed as (
    select
    contract_address
    , event_inputs:redeemer as wallet
    , sum(event_inputs:amount::numeric / 1e18) as amount_redeemed
    from ethereum.core.fact_event_logs
    where contract_address in ('0x4da27a545c0c5b758a6ba100e3a049001de870f5', '0xa1116930326d21fb917d5a27f1e9943a9595fb47') --stkAAVE, stkABPT
    and block_timestamp > '2020-09-23'
    and event_name = 'Redeem'
    group by 1,2
    )

    , transfers_in as (
    select
    contract_address
    , event_inputs:to as wallet
    -- , event_inputs
    , sum(event_inputs:value::numeric / 1e18) as transfers_in
    from ethereum.core.fact_event_logs
    where contract_address in ('0x4da27a545c0c5b758a6ba100e3a049001de870f5', '0xa1116930326d21fb917d5a27f1e9943a9595fb47') --stkAAVE, stkABPT
    and block_timestamp > '2020-09-23'
    and event_name = 'Transfer'
    and event_inputs:to != '0x0000000000000000000000000000000000000000'
    and event_inputs:from != '0x0000000000000000000000000000000000000000'
    Run a query to Download Data