diff --git a/blocks/evm/schema.sql b/blocks/evm/schema.sql index 168526c..3044d7c 100644 --- a/blocks/evm/schema.sql +++ b/blocks/evm/schema.sql @@ -389,6 +389,7 @@ CREATE TABLE IF NOT EXISTS gas_changes -- gas change -- old_value UInt64, new_value UInt64, + delta_value DEFAULT '' COMMENT 'Int128', reason LowCardinality(String), reason_code UInt32, ordinal UInt64, diff --git a/blocks/evm/src/gas_changes.rs b/blocks/evm/src/gas_changes.rs index 48c62f5..0cb3998 100644 --- a/blocks/evm/src/gas_changes.rs +++ b/blocks/evm/src/gas_changes.rs @@ -43,6 +43,8 @@ pub fn gas_change_reason_to_string(reason: i32) -> String { pub fn insert_gas_change(tables: &mut DatabaseChanges, clock: &Clock, gas_change: &GasChange, transaction: &TransactionTrace, trace: &Call) { let old_value = gas_change.old_value; let new_value = gas_change.new_value; + let delta_value = new_value as i128 - old_value as i128; + let reason = gas_change_reason_to_string(gas_change.reason); let reason_code = gas_change.reason; let ordinal = gas_change.ordinal; @@ -54,6 +56,7 @@ pub fn insert_gas_change(tables: &mut DatabaseChanges, clock: &Clock, gas_change .change("reason_code", ("", reason_code.to_string().as_str())) .change("old_value", ("", old_value.to_string().as_str())) .change("new_value", ("", new_value.to_string().as_str())) + .change("delta_value", ("", delta_value.to_string().as_str())) .change("ordinal", ("", ordinal.to_string().as_str())); insert_timestamp(row, clock, false);