diff --git a/dags/ethereumetl_airflow/build_partition_dag.py b/dags/ethereumetl_airflow/build_partition_dag.py index 29d139d39..0ada06d0f 100644 --- a/dags/ethereumetl_airflow/build_partition_dag.py +++ b/dags/ethereumetl_airflow/build_partition_dag.py @@ -175,15 +175,19 @@ def enrich_task(ds, **kwargs): and (call_type not in ('delegatecall', 'callcode', 'staticcall') or call_type is null) union all -- transaction fees debits - select miner as address, sum(cast(receipt_gas_used as numeric) * cast(gas_price as numeric)) as value + select + miner as address, + sum(cast(receipt_gas_used as numeric) * cast((receipt_effective_gas_price - coalesce(base_fee_per_gas, 0)) as numeric)) as value from `{public_project_id}.{public_dataset_name}.transactions` as transactions join `{public_project_id}.{public_dataset_name}.blocks` as blocks on blocks.number = transactions.block_number where true and date(transactions.block_timestamp) > '{ds}' - group by blocks.miner + group by blocks.number, blocks.miner union all -- transaction fees credits - select from_address as address, -(cast(receipt_gas_used as numeric) * cast(gas_price as numeric)) as value + select + from_address as address, + -(cast(receipt_gas_used as numeric) * cast(receipt_effective_gas_price as numeric)) as value from `{public_project_id}.{public_dataset_name}.transactions` where true and date(block_timestamp) > '{ds}'