Updated 2023-03-27
    with
    aave as (
    select tx_hash
    from arbitrum.core.fact_event_logs x
    join arbitrum.core.dim_labels y on x.contract_address=y.address
    where project_name='aave'
    --contract_address = lower('0x489ee077994b6658eafa855c308275ead8097c4a')
    --and topics[0]::string = '0x0874b2d545cb271cdbda4e093020c452328b24af12382ed62c4d00f5c26709db'
    ),
    uniswap as (
    select tx_hash
    from arbitrum.core.fact_event_logs x
    join arbitrum.core.dim_labels y on x.contract_address=y.address
    where project_name='uniswap'
    --and origin_to_address in ('0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45','0x4C60051384bd2d3C01bfc845Cf5F4b44bcbE9de5')
    --and topics[0]::string = '0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67'
    ),

    sushiswap as (
    select tx_hash
    from arbitrum.core.fact_event_logs x
    join arbitrum.core.dim_labels y on x.contract_address=y.address
    where project_name='sushiswap'
    )

    select
    'Aave' as platform,
    count(distinct tx_hash) as transactions,
    count(distinct from_address) as unique_users,
    (transactions/ unique_users) as avg_txs_per_user,
    sum(tx_fee) as generated_eth_fees,
    sum(gas_used) as gas_gwei_used,
    (generated_eth_fees / unique_users) as avg_eth_fee_user,
    (generated_eth_fees / transactions) as avg_tx_fee
    from arbitrum.core.fact_transactions
    where status = 'SUCCESS'
    Run a query to Download Data