MoDeFibase 02-00
    Updated 2023-08-05
    with eth_price as
    (select HOUR, PRICE
    from ethereum.core.fact_hourly_token_prices
    where TOKEN_ADDRESS='0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'),
    base_contract_create as (
    select BLOCK_TIMESTAMP, FROM_ADDRESS as user, tx_hash, TX_FEE*price as fee
    from base.core.fact_transactions
    left join eth_price
    on hour=date_trunc(hour, BLOCK_TIMESTAMP)
    where ORIGIN_FUNCTION_SIGNATURE='0x60806040'
    and TO_ADDRESS is null and STATUS='SUCCESS'
    ),

    creators as (
    select user, min(BLOCK_TIMESTAMP) as min_date
    from base_contract_create
    group by 1),

    creations as (
    select date_trunc({{time_interval}},BLOCK_TIMESTAMP) as date_, count(tx_hash) as txs
    from base_contract_create
    group by 1)


    select
    count(*) as "Contracts",
    count(distinct user) as "Users",
    avg(fee) as "Average Fee",
    median(fee) as "Median Fee"
    from base_contract_create



    Run a query to Download Data