vendettaAAVE .25 copy
    Updated 2023-02-12
    -- forked from b1626ffc-11d9-4346-98ef-91c014ee0706

    with tab1 as (
    select
    to_address as "Contract Address",
    sum(FLASHLOAN_AMOUNT_USD) as "Flashloan Volume USD"

    from ethereum.aave.ez_flashloans left outer join ethereum.core.fact_transactions
    on ethereum.aave.ez_flashloans.tx_hash = ethereum.core.fact_transactions.tx_hash
    where FLASHLOAN_AMOUNT_USD < 1e9
    group by 1
    order by 2 desc
    )

    select
    date_trunc('week', block_timestamp),
    name,
    "Flashloan Volume USD"

    from tab1 left outer join ethereum.core.dim_contracts_extended
    on "Contract Address" = CONTRACT_ADDRESS
    where name is not null
    and name not like 'DSProxy'
    and name not like 'InstaAccountV2'
    and name not like 'AaveMonitorV2'
    order by 2 desc
    limit 100


    Run a query to Download Data