Skip to content

Commit

Permalink
add balance_changes
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Nov 26, 2024
1 parent 0f5dec7 commit 9db9eca
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions blocks/evm/schema.snowflake.sql
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,28 @@ SELECT
end_ordinal,
FROM "v1.0.0-traces";

CREATE OR REPLACE SECURE VIEW v1_balance_changes AS
SELECT
-- block --
block_time,
block_number,
block_hash,
block_date,

-- transaction --
tx_hash,

-- balance change --
address,
ZEROIFNULL(TRY_TO_DECIMAL(hex_encode(new_balance_bytes), 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')) as new_balance,
new_balance_bytes,
ZEROIFNULL(TRY_TO_DECIMAL(hex_encode(old_balance_bytes), 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')) as old_balance,
old_balance_bytes,
ordinal,
reason,
reason_code,
FROM "v1.0.0-balance_changes";

CREATE OR REPLACE SECURE VIEW v1_logs AS
SELECT
*
Expand Down

0 comments on commit 9db9eca

Please sign in to comment.