* SEI EVM

* header
This commit is contained in:
Austin 2025-02-12 15:46:55 -05:00 committed by GitHub
parent d46517ef9c
commit 5df93e17bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 130 additions and 96 deletions

View File

@ -263,14 +263,15 @@ SELECT
origin_function_signature,
tx_succeeded,
event_name,
full_decoded_data,
full_decoded_data as full_decoded_log,
decoded_log,
contract_name,
{{ dbt_utils.generate_surrogate_key(
['tx_hash', 'event_index']
) }} AS ez_decoded_event_logs_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
SYSDATE() AS modified_timestamp,
full_decoded_data -- deprecate
FROM
FINAL qualify ROW_NUMBER() over (
PARTITION BY ez_decoded_event_logs_id

View File

@ -40,8 +40,10 @@ models:
description: Whether the transaction was successful, returned as a boolean.
- name: EVENT_NAME
description: The name of the event, as defined in the contract ABI.
- name: FULL_DECODED_DATA
- name: FULL_DECODED_LOG
description: The full decoded log, including the event name, the event parameters, and the data type of the event parameters.
- name: FULL_DECODED_DATA
description: This column will be deprecated on 3/10/2025. Please use `FULL_DECODED_LOG` instead.
- name: DECODED_LOG
description: The flattened decoded log, where the keys are the names of the event parameters, and the values are the values of the event parameters.
- name: CONTRACT_NAME

View File

@ -21,11 +21,11 @@ SELECT
amount,
decimals,
symbol,
has_decimal,
_log_id,
_inserted_timestamp,
transfers_id AS ez_token_transfers_id,
inserted_timestamp,
modified_timestamp
modified_timestamp,
has_decimal, -- deprecate
_log_id, -- deprecate
_inserted_timestamp -- deprecate
FROM
{{ ref('silver_evm__transfers') }}

View File

@ -37,11 +37,11 @@ models:
- name: SYMBOL
description: '{{ doc("sei_symbol") }}'
- name: HAS_DECIMAL
description: '{{ doc("sei_transfer_has_decimal") }}'
description: This column is being deprecated for standardization purposes. Please update your queries by March 10, 2025. Please use `DECIMALS` instead.
- name: _LOG_ID
description: '{{ doc("internal_column") }}'
description: This column is being deprecated for standardization purposes. Please update your queries by March 10, 2025. Please use `EZ_TOKEN_TRANSFERS_ID` instead.
- name: _INSERTED_TIMESTAMP
description: '{{ doc("internal_column") }}'
description: This column is being deprecated for standardization purposes. Please update your queries by March 10, 2025. Please use `INSERTED_TIMESTAMP` instead.
- name: EZ_TOKEN_TRANSFERS_ID
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP

View File

@ -6,21 +6,29 @@
SELECT
block_number,
hash as block_hash,
block_timestamp,
'mainnet' AS network,
'sei' AS blockchain,
tx_count,
SIZE,
miner,
extra_data,
parent_hash,
gas_used,
gas_limit,
base_fee_per_gas,
difficulty,
total_difficulty,
extra_data,
gas_limit,
gas_used,
HASH,
parent_hash,
receipts_root,
sha3_uncles,
SIZE,
uncles AS uncle_blocks,
uncles as uncle_blocks,
nonce,
receipts_root,
state_root,
transactions_root,
logs_bloom,
blocks_id AS fact_blocks_id,
inserted_timestamp,
modified_timestamp,
OBJECT_CONSTRUCT(
'baseFeePerGas',
base_fee_per_gas,
@ -61,8 +69,6 @@ SELECT
'uncles',
uncles
) AS block_header_json,
blocks_id AS fact_blocks_id,
inserted_timestamp,
modified_timestamp
'sei' AS blockchain -- deprecate
FROM
{{ ref('silver_evm__blocks') }}

View File

@ -6,12 +6,14 @@ models:
columns:
- name: BLOCK_NUMBER
description: '{{ doc("sei_block_number") }}'
- name: BLOCK_HASH
description: '{{ doc("sei_blocks_hash") }}'
- name: BLOCK_TIMESTAMP
description: '{{ doc("sei_block_timestamp") }}'
- name: NETWORK
description: '{{ doc("sei_network") }}'
- name: BLOCKCHAIN
description: '{{ doc("sei_blockchain") }}'
description: This column is being deprecated for standardization purposes. Please update your queries by March 10, 2025.
- name: TX_COUNT
description: '{{ doc("sei_tx_count") }}'
- name: DIFFICULTY
@ -37,7 +39,7 @@ models:
- name: UNCLE_BLOCKS
description: '{{ doc("sei_uncle_blocks") }}'
- name: BLOCK_HEADER_JSON
description: '{{ doc("sei_block_header_json") }}'
description: This column is being deprecated for standardization purposes. Please update your queries by March 10, 2025.
- name: FACT_BLOCKS_ID
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP

View File

@ -8,18 +8,27 @@ SELECT
block_number,
block_timestamp,
tx_hash,
origin_function_signature,
origin_from_address,
origin_to_address,
{# tx_position, -- new column #}
event_index,
contract_address,
topics,
DATA,
topics[0]::string as topic_0,
topics[1]::string as topic_1,
topics[2]::string as topic_2,
topics[3]::string as topic_3,
data,
event_removed,
tx_status,
_log_id,
origin_from_address,
origin_to_address,
origin_function_signature,
CASE
WHEN tx_status = 'SUCCESS' THEN TRUE
ELSE FALSE
END AS tx_succeeded,
logs_id AS fact_event_logs_id,
inserted_timestamp,
modified_timestamp
modified_timestamp,
tx_status, -- deprecate
_log_id -- deprecate
FROM
{{ ref('silver_evm__logs') }}

View File

@ -16,20 +16,30 @@ models:
description: '{{ doc("sei_logs_contract_address") }}'
- name: TOPICS
description: '{{ doc("sei_topics") }}'
- name: TOPIC_0
description: The first topic of the event, which is a unique identifier for the event.
- name: TOPIC_1
description: The second topic of the event, if applicable.
- name: TOPIC_2
description: The third topic of the event, if applicable.
- name: TOPIC_3
description: The fourth topic of the event, if applicable.
- name: DATA
description: '{{ doc("sei_logs_data") }}'
- name: EVENT_REMOVED
description: '{{ doc("sei_event_removed") }}'
- name: _LOG_ID
description: '{{ doc("internal_column") }}'
description: This column is being deprecated for standardization purposes. Please update your queries by March 10, 2025. Please use `EZ_DECODED_EVENT_LOGS_ID` instead.
- name: TX_STATUS
description: '{{ doc("sei_tx_status") }}'
description: This column is being deprecated for standardization purposes. Please update your queries by March 10, 2025. Please use `TX_SUCCEEDED` instead.
- name: ORIGIN_FUNCTION_SIGNATURE
description: '{{ doc("sei_origin_sig") }}'
- name: ORIGIN_FROM_ADDRESS
description: '{{ doc("sei_origin_from") }}'
- name: ORIGIN_TO_ADDRESS
description: '{{ doc("sei_origin_to") }}'
- name: TX_SUCCEEDED
description: Whether the transaction was successful, returned as a boolean.
- name: FACT_EVENT_LOGS_ID
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP

View File

@ -1,7 +1,7 @@
version: 2
models:
- name: core_evm__fact_token_transfers
description: '{{ doc("sei_transfer_table_doc") }}'
description: This table is being deprecated for standardization purposes. Please update your queries to use `ez_token_transfers` instead by March 10, 2025.
columns:
- name: BLOCK_NUMBER

View File

@ -7,18 +7,20 @@
SELECT
block_number,
block_timestamp,
block_hash,
tx_hash,
nonce,
POSITION,
origin_function_signature,
from_address,
to_address,
VALUE,
origin_function_signature,
value,
value_precise_raw,
value_precise,
tx_fee,
tx_fee_precise,
case when tx_status = 'SUCCESS' then true else false end as tx_succeeded,
tx_type,
nonce,
position as tx_position,
input_data,
gas_price,
effective_gas_price,
gas AS gas_limit,
@ -26,13 +28,14 @@ SELECT
cumulative_gas_used,
max_fee_per_gas,
max_priority_fee_per_gas,
input_data,
tx_status AS status,
r,
s,
v,
transactions_id AS fact_transactions_id,
inserted_timestamp,
modified_timestamp
modified_timestamp,
tx_status AS status, -- deprecate
position, -- deprecate
block_hash -- deprecate
FROM
{{ ref('silver_evm__transactions') }}

View File

@ -9,13 +9,15 @@ models:
- name: BLOCK_TIMESTAMP
description: '{{ doc("sei_block_timestamp") }}'
- name: BLOCK_HASH
description: '{{ doc("sei_tx_block_hash") }}'
description: This column is being deprecated for standardization purposes. Please update your queries by March 10, 2025.
- name: TX_HASH
description: '{{ doc("sei_tx_hash") }}'
- name: NONCE
description: '{{ doc("sei_tx_nonce") }}'
- name: POSITION
description: '{{ doc("sei_tx_position") }}'
description: This column is being deprecated for standardization purposes. Please update your queries by March 10, 2025. Please use `TX_POSITION` instead.
- name: TX_POSITION
description: The position of the transaction within the block.
- name: FROM_ADDRESS
description: '{{ doc("sei_from_address") }}'
- name: TO_ADDRESS
@ -45,7 +47,9 @@ models:
- name: MAX_PRIORITY_FEE_PER_GAS
description: The maximum priority fee per gas of the transaction, in Gwei.
- name: STATUS
description: '{{ doc("sei_tx_status") }}'
description: This column is being deprecated for standardization purposes. Please update your queries by March 10, 2025. Please use `TX_SUCCEEDED` instead.
- name: TX_SUCCEEDED
description: Whether the transaction was successful, returned as a boolean.
- name: INPUT_DATA
description: '{{ doc("sei_tx_input_data") }}'
- name: ORIGIN_FUNCTION_SIGNATURE

View File

@ -27,11 +27,11 @@ WHERE
AND to_address IS NOT NULL
AND input IS NOT NULL
AND input != '0x'
AND tx_status = 'SUCCESS'
AND trace_status = 'SUCCESS'
AND tx_succeeded
AND trace_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
AND modified_timestamp >= (
SELECT
MAX(_inserted_timestamp) - INTERVAL '24 hours'
FROM

View File

@ -37,15 +37,15 @@ WITH base AS (
{{ ref('core_evm__fact_traces') }}
WHERE
VALUE > 0
AND tx_status = 'SUCCESS'
AND trace_status = 'SUCCESS'
AND tx_succeeded
AND trace_succeeded
AND TYPE NOT IN (
'DELEGATECALL',
'STATICCALL'
)
{% if is_incremental() %}
AND _inserted_timestamp >= (
AND modified_timestamp >= (
SELECT
MAX(_inserted_timestamp) - INTERVAL '12 hours'
FROM
@ -61,7 +61,7 @@ tx_table AS (
to_address AS origin_to_address,
origin_function_signature
FROM
{{ ref('silver_evm__transactions') }}
{{ ref('core_evm__fact_transactions') }}
WHERE
tx_hash IN (
SELECT
@ -71,7 +71,7 @@ tx_table AS (
)
{% if is_incremental() %}
AND _inserted_timestamp >= (
AND modified_timestamp >= (
SELECT
MAX(_inserted_timestamp) - INTERVAL '12 hours'
FROM

View File

@ -11,14 +11,14 @@ WITH emitted_events AS (
SELECT
contract_address,
COUNT(*) AS event_count,
MAX(_inserted_timestamp) AS max_inserted_timestamp_logs,
MAX(modified_timestamp) AS max_inserted_timestamp_logs,
MAX(block_number) AS latest_event_block
FROM
{{ ref('silver_evm__logs') }}
{{ ref('core_evm__fact_event_logs') }}
{% if is_incremental() %}
WHERE
_inserted_timestamp > (
modified_timestamp > (
SELECT
MAX(max_inserted_timestamp_logs)
FROM
@ -37,8 +37,8 @@ function_calls AS (
FROM
{{ ref('core_evm__fact_traces') }}
WHERE
tx_status = 'SUCCESS'
AND trace_status = 'SUCCESS'
tx_succeeded
AND trace_succeeded
AND to_address IS NOT NULL
AND input IS NOT NULL
AND input <> '0x'

View File

@ -10,7 +10,7 @@
WITH logs AS (
SELECT
_log_id,
concat(tx_hash, '-', event_index) AS _log_id,
block_number,
tx_hash,
block_timestamp,
@ -23,15 +23,15 @@ WITH logs AS (
utils.udf_hex_to_int(SUBSTR(DATA, 3, 64)) AS raw_amount_precise,
raw_amount_precise :: FLOAT AS raw_amount,
event_index,
_inserted_timestamp
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('silver_evm__logs') }}
{{ ref('core_evm__fact_event_logs') }}
WHERE
topics [0] :: STRING = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
AND modified_timestamp >= (
SELECT
MAX(
_inserted_timestamp

View File

@ -24,7 +24,7 @@ WITH created_pools AS (
)
) AS pool_id,
FROM
{{ ref ('silver_evm__logs') }}
{{ ref ('core_evm__fact_event_logs') }}
WHERE
tx_status = 'SUCCESS'
AND contract_address = LOWER('0x179d9a5592bc77050796f7be28058c51ca575df4') --DragonswapFactoryV2

View File

@ -49,14 +49,14 @@ swaps_base AS (
token1,
pool_address
FROM
{{ ref('silver_evm__logs') }}
{{ ref('core_evm__fact_event_logs') }}
l
INNER JOIN pools p
ON p.pool_address = l.contract_address
WHERE
l.block_timestamp :: DATE >= '2024-01-01'
AND topics [0] :: STRING = '0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND l.modified_timestamp >= (

View File

@ -31,16 +31,16 @@ WITH logs_pull AS (
utils.udf_hex_to_int(
segmented_data [1] :: STRING
) :: INT AS product_id,
_log_id,
_inserted_timestamp
concat(tx_hash, '-', event_index) AS _log_id,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('silver_evm__logs') }}
{{ ref('core_evm__fact_event_logs') }}
WHERE
topics [0] :: STRING = '0xfe53084a731040f869d38b1dcd00fbbdbc14e10d7d739160559d77f5bc80cf05'
AND contract_address = lower('0xaE1510367aA8d500bdF507E251147Ea50B22307F') --clearing house
{% if is_incremental() %}
AND _inserted_timestamp >= (
AND modified_timestamp >= (
SELECT
MAX(_inserted_timestamp) - INTERVAL '36 hours'
FROM

View File

@ -15,14 +15,14 @@ WITH logs_pull AS (
tx_hash,
block_number,
block_timestamp,
_inserted_timestamp,
_log_id
modified_timestamp AS _inserted_timestamp,
concat(tx_hash, '-', event_index) AS _log_id
FROM
{{ ref('silver_evm__logs') }}
{{ ref('core_evm__fact_event_logs') }}
WHERE
topics [0] :: STRING = '0x3286b0394bf1350245290b7226c92ed186bd716f28938e62dbb895298f018172'
{% if is_incremental() %}
AND _inserted_timestamp >= (
AND modified_timestamp >= (
SELECT
MAX(
_inserted_timestamp
@ -30,7 +30,7 @@ AND _inserted_timestamp >= (
FROM
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
AND modified_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
new_prod AS (

View File

@ -32,27 +32,26 @@ logs AS (
event_index,
event_removed,
topics,
_inserted_timestamp,
_log_id,
modified_timestamp as _inserted_timestamp,
concat(tx_hash, '-', event_index) AS _log_id,
is_pending,
logs_id,
inserted_timestamp,
modified_timestamp,
_invocation_id
modified_timestamp
FROM
{{ ref('silver_evm__logs') }}
{{ ref('core_evm__fact_event_logs') }}
WHERE
topics [0] :: STRING = '0x494f937f5cc892f798248aa831acfb4ad7c4bf35edd8498c5fb431ce1e38b035'
AND contract_address = LOWER('0xaE1510367aA8d500bdF507E251147Ea50B22307F')
{% if is_incremental() %}
AND _inserted_timestamp >= (
AND modified_timestamp >= (
SELECT
MAX(_inserted_timestamp) - INTERVAL '12 hours'
FROM
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
AND modified_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
logs_pull_v2 AS (

View File

@ -37,27 +37,26 @@ logs AS (
event_index,
event_removed,
topics,
_inserted_timestamp,
_log_id,
modified_timestamp as _inserted_timestamp,
concat(tx_hash, '-', event_index) AS _log_id,
is_pending,
logs_id,
inserted_timestamp,
modified_timestamp,
_invocation_id
modified_timestamp
FROM
{{ ref('silver_evm__logs') }}
{{ ref('core_evm__fact_event_logs') }}
WHERE
topics [0] :: STRING = '0x7c57459d6f4f0fb2fc5b1e298c8c0eb238422944964aa1e249eaa78747f0cca9'
AND contract_address = LOWER('0x56Ffa2fD437C3a718322ea701bEd40560745456e')
{% if is_incremental() %}
AND _inserted_timestamp >= (
AND modified_timestamp >= (
SELECT
MAX(_inserted_timestamp) - INTERVAL '12 hours'
FROM
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
AND modified_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
order_fill_decode_v2 AS (

View File

@ -38,27 +38,26 @@ logs AS (
event_index,
event_removed,
topics,
_inserted_timestamp,
_log_id,
modified_timestamp as _inserted_timestamp,
concat(tx_hash, '-', event_index) AS _log_id,
is_pending,
logs_id,
inserted_timestamp,
modified_timestamp,
_invocation_id
modified_timestamp
FROM
{{ ref('silver_evm__logs') }}
{{ ref('core_evm__fact_event_logs') }}
WHERE
topics [0] :: STRING = '0x7c57459d6f4f0fb2fc5b1e298c8c0eb238422944964aa1e249eaa78747f0cca9'
AND contract_address = LOWER('0x56Ffa2fD437C3a718322ea701bEd40560745456e')
{% if is_incremental() %}
AND _inserted_timestamp >= (
AND modified_timestamp >= (
SELECT
MAX(_inserted_timestamp) - INTERVAL '12 hours'
FROM
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
AND modified_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
order_fill_decode_v2 AS (