scottincryptoUntitled Query
    Updated 2022-08-07
    with awsteth as (
    select
    date_trunc('day',block_timestamp) as block_day
    , from_address
    , to_address
    , raw_amount / 1e18 as amount
    from ethereum.core.ez_token_transfers
    where contract_address = '0x1982b2f5814301d4e9a8b0201555376e62f82428' --awstETH
    )

    , awsteth_out as (
    select
    block_day
    , from_address as wallet
    , sum(amount) as awsteth_out
    from awsteth
    group by block_day, from_address
    )

    , awsteth_in as (
    select
    block_day
    , to_address as wallet
    , sum(amount) as awsteth_in
    from awsteth
    group by block_day, to_address
    )
    select 1
    -- repeat all this for WETH debt tokens

    -- make dates_wallets
    -- join both ins & outs to this
    -- add a cumu balance partition by wallet order by day for both tokens
    -- filter both tokens positive balance - and keep null address
    -- roll up by day without null address
    --
    Run a query to Download Data