Afonso_DiazSmart Contracts Balances
    Updated 2024-04-15
    with

    deposit as (
    select
    to_address as contract_address,
    sum(amount) as increase_volume
    from blast.core.ez_native_transfers
    group by 1
    ),

    withdraw as (
    select
    from_address as contract_address,
    sum(amount) as decrease_volume
    from blast.core.ez_native_transfers
    group by 1
    ),

    contract_address_list as (
    select
    to_address as contract_address,
    tx_hash as creation_tx_hash
    from blast.core.fact_traces
    where type in ('CREATE')
    and identifier = 'CREATE_ORIGIN'
    and tx_status = 'SUCCESS'
    and contract_address is not null
    and trace_status = 'SUCCESS'
    ),

    balances as (
    select
    contract_address,
    increase_volume - nvl(decrease_volume, 0) as balance_eth
    from deposit
    left join withdraw
    QueryRunArchived: QueryRun has been archived