with tab1 as (
select
to_address as "Contract Address",
count(*) as count1
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
name,
count1
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'