MoDeFiAave - 7.13
    Updated 2023-04-13
    with aave_supply_v3 as (
    select BLOCK_TIMESTAMP, 'polygon' as chain, 'Version 3' as version,
    EVENT_INPUTS:from as address, CONTRACT_ADDRESS as token, EVENT_INPUTS:value/1e18 as token_amount, tx_hash
    from polygon.core.fact_event_logs
    where ORIGIN_FUNCTION_SIGNATURE='0x617ba037'
    and EVENT_NAME='Transfer' and EVENT_INPUTS:from!='0x0000000000000000000000000000000000000000' and CONTRACT_ADDRESS='0xd6df932a45c0f255f85145f286ea0b292b21c90b'
    union all
    select BLOCK_TIMESTAMP, 'optimism' as chain, 'Version 3' as version,
    EVENT_INPUTS:from as address, CONTRACT_ADDRESS as token, EVENT_INPUTS:value/1e18 as token_amount, tx_hash
    from optimism.core.fact_event_logs
    where ORIGIN_FUNCTION_SIGNATURE in ('0xf7a73840', '0x617ba037')
    and EVENT_NAME='Transfer' and EVENT_INPUTS:from!='0x0000000000000000000000000000000000000000' and CONTRACT_ADDRESS='0x76fb31fb4af56892a25e32cfc43de717950c9278'

    union all

    select BLOCK_TIMESTAMP, 'arbitrum' as chain, 'Version 3' as version,
    EVENT_INPUTS:from as address, CONTRACT_ADDRESS as token, EVENT_INPUTS:value/1e18 as token_amount, tx_hash
    from arbitrum.core.fact_event_logs
    where ORIGIN_FUNCTION_SIGNATURE in ('0x617ba037','0x680dd47c')
    and EVENT_NAME='Transfer' and EVENT_INPUTS:from!='0x0000000000000000000000000000000000000000' and CONTRACT_ADDRESS='0xba5ddd1f9d7f570dc94a51479a000e3bce967196'

    union all

    select BLOCK_TIMESTAMP, 'avalanche' as chain, 'Version 3' as version,
    EVENT_INPUTS:from as address, CONTRACT_ADDRESS as token, EVENT_INPUTS:value/1e18 as token_amount, tx_hash
    from avalanche.core.fact_event_logs
    where ORIGIN_FUNCTION_SIGNATURE='0x617ba037'
    and EVENT_NAME='Transfer' and EVENT_INPUTS:from!='0x0000000000000000000000000000000000000000' and CONTRACT_ADDRESS='0x63a72806098bd3d9520cc43356dd78afe5d386d9'
    ) ,

    aave_supply_v2 as (
    select BLOCK_TIMESTAMP, 'polygon' as chain, 'Version 2' as version,
    EVENT_INPUTS:from as address, CONTRACT_ADDRESS as token, EVENT_INPUTS:value/1e18 as token_amount, tx_hash
    from polygon.core.fact_event_logs
    Run a query to Download Data