mirror of
https://github.com/FlipsideCrypto/blast-models.git
synced 2026-02-06 09:26:44 +00:00
AN-5335-v2/blast-standardization (#79)
* new columns ymls and docs * new column in silver logs * refs to core fact tables * ymls and new columns * minor updates * columns * docs * updates for native transfer * updates * deprecation notices * native transfers table * core column changes and docs * full_decoded_log changes * merge * misc updates for deprecating columns * tx and trace status * misc updates * remove comments * remove trace_address from native_transfers * timestamps for native * docs * token transfers * missing_decoding macro * l1 fee precise * removed trace address column from silver native transfers * deprecation date * ez decoded_event_logs * standard pred
This commit is contained in:
parent
9ac494d04b
commit
13ba135a6c
3
.gitignore
vendored
3
.gitignore
vendored
@ -17,4 +17,5 @@ logs/
|
||||
.env
|
||||
dbt-env/
|
||||
|
||||
package-lock.yml
|
||||
package-lock.yml
|
||||
.user.yml
|
||||
|
||||
22
macros/dbt/incremental_predicates.sql
Normal file
22
macros/dbt/incremental_predicates.sql
Normal file
@ -0,0 +1,22 @@
|
||||
{% macro standard_predicate(
|
||||
input_column = 'block_number'
|
||||
) -%}
|
||||
{%- set database_name = target.database -%}
|
||||
{%- set schema_name = generate_schema_name(
|
||||
node = model
|
||||
) -%}
|
||||
{%- set table_name = generate_alias_name(
|
||||
node = model
|
||||
) -%}
|
||||
{%- set tmp_table_name = table_name ~ '__dbt_tmp' -%}
|
||||
{%- set full_table_name = database_name ~ '.' ~ schema_name ~ '.' ~ table_name -%}
|
||||
{%- set full_tmp_table_name = database_name ~ '.' ~ schema_name ~ '.' ~ tmp_table_name -%}
|
||||
{{ full_table_name }}.{{ input_column }} >= (
|
||||
SELECT
|
||||
MIN(
|
||||
{{ input_column }}
|
||||
)
|
||||
FROM
|
||||
{{ full_tmp_table_name }}
|
||||
)
|
||||
{%- endmacro %}
|
||||
@ -1,17 +1,26 @@
|
||||
{% test missing_decoded_logs(model) %}
|
||||
SELECT
|
||||
l.block_number,
|
||||
l._log_id
|
||||
CONCAT(
|
||||
l.tx_hash,
|
||||
'-',
|
||||
l.event_index
|
||||
) AS _log_id
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
l
|
||||
LEFT JOIN {{ model }}
|
||||
d
|
||||
ON l.block_number = d.block_number
|
||||
AND l._log_id = d._log_id
|
||||
AND CONCAT(
|
||||
l.tx_hash,
|
||||
'-',
|
||||
l.event_index
|
||||
) = d._log_id
|
||||
WHERE
|
||||
l.contract_address = LOWER('0x4300000000000000000000000000000000000004') -- WETH
|
||||
AND l.topics [0] :: STRING = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' -- Transfer
|
||||
AND l.block_timestamp BETWEEN DATEADD('hour', -48, SYSDATE())
|
||||
AND DATEADD('hour', -6, SYSDATE())
|
||||
AND d._log_id IS NULL {% endtest %}
|
||||
AND d._log_id IS NULL
|
||||
{% endtest %}
|
||||
|
||||
95
models/doc_descriptions/fsc_evm/L1_submission_fields.md
Normal file
95
models/doc_descriptions/fsc_evm/L1_submission_fields.md
Normal file
@ -0,0 +1,95 @@
|
||||
{% docs evm_batch_size %}
|
||||
|
||||
Total transactions included within the batch on the OP stack L2 chain.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_max_block %}
|
||||
|
||||
The max block on the OP stack L2 chain this batch relates to.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_min_block %}
|
||||
|
||||
The min block on the OP stack L2 chain this batch relates to.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_batch_root %}
|
||||
|
||||
Root of the batch, either for submission or state on the OP stack L2 chain.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_l1_block_no %}
|
||||
|
||||
The Ethereum block number that contained the batch from the OP stack L2 chain.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_l1_block_time %}
|
||||
|
||||
The timestamp of the Ethereum block that contained this batch from the OP stack L2 chain.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_l1_fee %}
|
||||
|
||||
The L1 portion of fees paid.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_l1_fee_scalar %}
|
||||
|
||||
This value covers the change in L1 gas price between the time the transaction is submitted and when it is published from the OP stack L2 chain.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_l1_gas_price %}
|
||||
|
||||
The gas price for L1 transactions when the transaction was processed from the OP stack L2 chain.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_l1_gas_used %}
|
||||
|
||||
The gas used on L1 to publish the transaction from the OP stack L2 chain.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_l1_state_batch %}
|
||||
|
||||
The batch index of when this block was included in the Ethereum state root. This column will be deprecated 8/7 and will be consolidated into an array column consisting of all L1 submission details from the OP stack L2 chain.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_l1_state_tx_hash %}
|
||||
|
||||
The L1 tx hash of when this block was included in the Ethereum state root. This column will be deprecated 8/7 and will be consolidated into an array column consisting of all L1 submission details from the OP stack L2 chain.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_l1_sub_batch %}
|
||||
|
||||
The batch index of when this block was submitted to L1. This column will be deprecated 8/7 and will be consolidated into an array column consisting of all L1 submission details from the OP stack L2 chain.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_l1_sub_tx_hash %}
|
||||
|
||||
The L1 tx hash of when this block was submitted to L1. This column will be deprecated 8/7 and will be consolidated into an array column consisting of all L1 submission details from the OP stack L2 chain.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_prev_total_elements %}
|
||||
|
||||
Confirmed blocks prior to this batch on the OP stack L2 chain.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_l1_fee_precise %}
|
||||
|
||||
The precise amount of the L1 fee. This is returned as a string to avoid precision loss.
|
||||
|
||||
{% enddocs %}
|
||||
158
models/doc_descriptions/fsc_evm/blocks.md
Normal file
158
models/doc_descriptions/fsc_evm/blocks.md
Normal file
@ -0,0 +1,158 @@
|
||||
{% docs evm_blocks_table_doc %}
|
||||
|
||||
This table contains block level data for this EVM blockchain. This table can be used to analyze trends at a block level, for example gas fees vs. total transactions over time. For more information, please see [Etherscan Resources](https://etherscan.io/directory/Learning_Resources/Ethereum) or [The Ethereum Organization](https://ethereum.org/en/developers/docs/blocks/)
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_block_header_json %}
|
||||
|
||||
This JSON column contains the block header details.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_blockchain %}
|
||||
|
||||
The blockchain on which transactions are being confirmed.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_blocks_hash %}
|
||||
|
||||
The hash of the block header for a given block.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_blocks_nonce %}
|
||||
|
||||
Block nonce is a value used during mining to demonstrate proof of work for a given block.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_difficulty %}
|
||||
|
||||
The effort required to mine the block.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_extra_data %}
|
||||
|
||||
Any data included by the miner for a given block.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_gas_limit %}
|
||||
|
||||
Total gas limit provided by all transactions in the block.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_gas_used %}
|
||||
|
||||
Total gas used in the block.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_network %}
|
||||
|
||||
The network on the blockchain used by a transaction.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_parent_hash %}
|
||||
|
||||
The hash of the block from which a given block is generated. Also known as the parent block.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_receipts_root %}
|
||||
|
||||
The root of the state trie.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_sha3_uncles %}
|
||||
|
||||
The mechanism which Ethereum Javascript RLP encodes an empty string.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_size %}
|
||||
|
||||
Block size, which is determined by a given block's gas limit.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_total_difficulty %}
|
||||
|
||||
Total difficulty of the chain at a given block.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_tx_count %}
|
||||
|
||||
Total number of transactions within a block.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_uncle_blocks %}
|
||||
|
||||
Uncle blocks occur when two blocks are mined and broadcasted at the same time, with the same block number. The block validated across the most nodes will be added to the primary chain, and the other one becomes an uncle block. Miners do receive rewards for uncle blocks.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_miner %}
|
||||
|
||||
The address of the beneficiary to whom the mining rewards were given
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_state_root %}
|
||||
|
||||
The root of the final state trie of the block
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_transactions_root %}
|
||||
|
||||
The root of the transaction trie of the block
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_logs_bloom %}
|
||||
|
||||
The bloom filter for the logs of the block.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_mix_hash %}
|
||||
|
||||
A string of a 256-bit hash encoded as a hexadecimal
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_base_fee_per_gas %}
|
||||
|
||||
A string of the base fee encoded in hexadecimal format. Please note that this response field will not be included in a block requested before the EIP-1559 upgrade
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_withdrawals_root %}
|
||||
|
||||
The root of the withdrawals trie.
|
||||
|
||||
{% enddocs %}
|
||||
65
models/doc_descriptions/fsc_evm/complete_general.md
Normal file
65
models/doc_descriptions/fsc_evm/complete_general.md
Normal file
@ -0,0 +1,65 @@
|
||||
{% docs evm_block_number %}
|
||||
|
||||
Also known as block height. The block number, which indicates the length of the blockchain, increases after the addition of each new block.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_block_timestamp %}
|
||||
|
||||
The date and time at which the block was produced.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_from_address %}
|
||||
|
||||
The sending address of this transaction.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_ingested_at %}
|
||||
|
||||
Internal column.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_to_address %}
|
||||
|
||||
The receiving address of this transaction. This can be a contract address.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_pk %}
|
||||
|
||||
The unique identifier for each row in the table.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_inserted_timestamp %}
|
||||
|
||||
The UTC timestamp at which the row was inserted into the table.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_modified_timestamp %}
|
||||
|
||||
The UTC timestamp at which the row was last modified.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_precise_amount_unadjusted %}
|
||||
|
||||
The precise, unadjusted amount of the transaction. This is returned as a string to avoid precision loss.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_precise_amount_adjusted %}
|
||||
|
||||
The precise, adjusted amount of the transaction. This is returned as a string to avoid precision loss.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_value_hex %}
|
||||
|
||||
The value of the transaction in hexadecimal format.
|
||||
|
||||
{% enddocs %}
|
||||
95
models/doc_descriptions/fsc_evm/event_logs.md
Normal file
95
models/doc_descriptions/fsc_evm/event_logs.md
Normal file
@ -0,0 +1,95 @@
|
||||
{% docs evm_logs_table_doc %}
|
||||
|
||||
This table contains flattened event logs from transactions on this EVM blockchain. Transactions may have multiple events, which are denoted by the event index for a transaction hash. Therefore, this table is unique on the combination of transaction hash and event index. Please see `fact_decoded_event_logs` or `ez_decoded_event_logs` for the decoded event logs.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_event_index %}
|
||||
|
||||
Event number within a transaction.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_event_inputs %}
|
||||
|
||||
The decoded event inputs for a given event.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_event_removed %}
|
||||
|
||||
Whether the event has been removed from the transaction.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_log_id_events %}
|
||||
|
||||
This is the primary key for this table. This is a concatenation of the transaction hash and the event index at which the event occurred. This field can be used within other event based tables such as ```fact_transfers``` & ```ez_token_transfers```.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_logs_contract_address %}
|
||||
|
||||
The address interacted with for a given event.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_logs_contract_name %}
|
||||
|
||||
The name of the contract or token, where possible.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_logs_data %}
|
||||
|
||||
The un-decoded event data.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_logs_tx_hash %}
|
||||
|
||||
Transaction hash is a unique 66-character identifier that is generated when a transaction is executed. This field will not be unique in this table, as a given transaction can include multiple events.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_topics %}
|
||||
|
||||
The un-decoded event input topics.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_topic_0 %}
|
||||
|
||||
The first topic of the event, which is a unique identifier for the event.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_topic_1 %}
|
||||
|
||||
The second topic of the event, if applicable.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_topic_2 %}
|
||||
|
||||
The third topic of the event, if applicable.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_topic_3 %}
|
||||
|
||||
The fourth topic of the event, if applicable.
|
||||
|
||||
{% enddocs %}
|
||||
240
models/doc_descriptions/fsc_evm/evm_deprecations.md
Normal file
240
models/doc_descriptions/fsc_evm/evm_deprecations.md
Normal file
@ -0,0 +1,240 @@
|
||||
{% docs evm_column_deprecation_notice %}
|
||||
|
||||
This column is being deprecated for standardization purposes. Please update your queries by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_hash %}
|
||||
|
||||
This column is being deprecated for standardization purposes. Please update your queries to use the `block_hash` column instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_block_hash %}
|
||||
|
||||
This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_column_deprecation_notice_position %}
|
||||
|
||||
This column is being deprecated for standardization purposes. Please update your queries to use the `tx_position` column instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_tx_status %}
|
||||
|
||||
This column is being deprecated for standardization purposes. Please update your queries to use the `tx_succeeded` column instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_chain_id %}
|
||||
|
||||
This column is being removed for standardization purposes. Please remove from your queries by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_identifier %}
|
||||
|
||||
This column is being deprecated for standardization purposes. Please update your queries to use the `trace_address` column instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_trace_status %}
|
||||
|
||||
This column is being deprecated for standardization purposes. Please update your queries to use the `trace_succeeded` column instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_log_id %}
|
||||
|
||||
This column is being removed for standardization purposes. Please remove or update your queries with `CONCAT(tx_hash, '_', event_index)` to reconstruct `_log_id` by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_blockchain %}
|
||||
|
||||
This column is being removed for standardization purposes. Please remove from your queries by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_block_header_json %}
|
||||
|
||||
This column is being removed for standardization purposes and will be replaced with new columns associated with the keys extracted from this json. Please remove from your queries by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_table_deprecation_notice %}
|
||||
|
||||
This table is being deprecated for standardization purposes. Please update your queries by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_table_deprecation_notice_fact_decoded_event_logs %}
|
||||
|
||||
This table is being deprecated for standardization purposes. Please update your queries to use `ez_decoded_event_logs` instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_table_deprecation_notice_fact_decoded_traces %}
|
||||
|
||||
This table is being deprecated for standardization purposes. Please update your queries to use `ez_decoded_traces` instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_table_deprecation_notice_fact_token_transfers %}
|
||||
|
||||
This table is being deprecated for standardization purposes. Please update your queries to use `ez_token_transfers` instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_l1_state_root_tx_hash %}
|
||||
|
||||
This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_l1_state_root_batch_index %}
|
||||
|
||||
This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_l1_submission_tx_hash %}
|
||||
|
||||
This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_l1_submission_batch_index %}
|
||||
|
||||
This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_l1_submission_details %}
|
||||
|
||||
This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_data %}
|
||||
|
||||
This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_deposit_nonce %}
|
||||
|
||||
This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_deposit_receipt_version %}
|
||||
|
||||
This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_token_price %}
|
||||
|
||||
This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_has_price %}
|
||||
|
||||
This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_has_decimal %}
|
||||
|
||||
This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_nft_address %}
|
||||
|
||||
This column is being removed for standardization purposes. Please update your queries to use the `contract_address` column instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_tokenid %}
|
||||
|
||||
This column is being removed for standardization purposes. Please update your queries to use the `token_id` column instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_erc1155_value %}
|
||||
|
||||
This column is being removed for standardization purposes. Please update your queries to use the `quantity` column instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_project_name %}
|
||||
|
||||
This column is being removed for standardization purposes. Please update your queries to use the `name` column instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_loanid %}
|
||||
|
||||
This column is being removed for standardization purposes. Please update your queries to use the `loan_id` column instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_tokenid_name %}
|
||||
|
||||
This column is being removed for standardization purposes. Please update your queries to use the `token_id_name` column instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_tokenid_description %}
|
||||
|
||||
This column is being removed for standardization purposes. Please update your queries to use the `token_id_description` column instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_tokenid_image_url %}
|
||||
|
||||
This column is being removed for standardization purposes. Please update your queries to use the `token_id_image_url` column instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_nft_address_tokenid %}
|
||||
|
||||
This column is being removed for standardization purposes. Please update your queries to use the `nft_address_token_id` column instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_nft_from_address %}
|
||||
|
||||
This column is being removed for standardization purposes. Please update your queries to use the `from_address` column instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_nft_to_address %}
|
||||
|
||||
This column is being removed for standardization purposes. Please update your queries to use the `to_address` column instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_mint_price_eth %}
|
||||
|
||||
This column is being removed for standardization purposes. Please update your queries to use the `mint_price_native` column instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_event_type %}
|
||||
|
||||
This column is being removed for standardization purposes. Please remove from your queries by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_column_deprecation_notice_inserted_timestamp %}
|
||||
|
||||
This column is being removed for standardization purposes. Please update your queries to use the `modified_timestamp` column instead by March 10, 2025.
|
||||
|
||||
{% enddocs %}
|
||||
136
models/doc_descriptions/fsc_evm/traces.md
Normal file
136
models/doc_descriptions/fsc_evm/traces.md
Normal file
@ -0,0 +1,136 @@
|
||||
{% docs evm_traces_table_doc %}
|
||||
|
||||
This table contains flattened trace data for internal contract calls. User-defined functions (UDFs) are available to decode hex encoded fields, including `utils.udf_hex_to_int()`.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_traces_block_no %}
|
||||
|
||||
The block number of this transaction.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_traces_blocktime %}
|
||||
|
||||
The block timestamp of this transaction.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_traces_call_data %}
|
||||
|
||||
The raw JSON data for this trace.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_traces_value %}
|
||||
|
||||
The amount of the native asset transferred in this trace.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_traces_from %}
|
||||
|
||||
The sending address of this trace. This is not necessarily the from address of the transaction.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_traces_gas %}
|
||||
|
||||
The gas supplied for this trace.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_traces_gas_used %}
|
||||
|
||||
The gas used for this trace.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_traces_identifier %}
|
||||
|
||||
This field represents the position and type of the trace within the transaction.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_trace_index %}
|
||||
|
||||
The index of the trace within the transaction.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_traces_input %}
|
||||
|
||||
The input data for this trace.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_traces_output %}
|
||||
|
||||
The output data for this trace.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_sub_traces %}
|
||||
|
||||
The amount of nested sub traces for this trace.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_traces_to %}
|
||||
|
||||
The receiving address of this trace. This is not necessarily the to address of the transaction.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_traces_tx_hash %}
|
||||
|
||||
The transaction hash for the trace. Please note, this is not necessarily unique in this table as transactions frequently have multiple traces.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_traces_type %}
|
||||
|
||||
The type of internal transaction. Common trace types are `CALL`, `DELEGATECALL`, and `STATICCALL`.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_trace_succeeded %}
|
||||
|
||||
The boolean value representing if the trace succeeded.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_trace_error_reason %}
|
||||
|
||||
The reason for the trace failure, if any.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_trace_address %}
|
||||
|
||||
The trace address for this trace.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_revert_reason %}
|
||||
|
||||
The reason for the revert, if available.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
207
models/doc_descriptions/fsc_evm/transactions.md
Normal file
207
models/doc_descriptions/fsc_evm/transactions.md
Normal file
@ -0,0 +1,207 @@
|
||||
{% docs evm_tx_table_doc %}
|
||||
|
||||
This table contains transaction level data for this EVM blockchain. Each transaction will have a unique transaction hash, along with transaction fees and a value transferred in the native asset when applicable. Transactions may be native asset transfers or interactions with contract addresses. For more information, please see [The Ethereum Organization - Transactions](https://ethereum.org/en/developers/docs/transactions/)
|
||||
|
||||
Below are the specific native tokens that correspond to each EVM chain:
|
||||
|
||||
| Status | Description |
|
||||
|------------|-------------|
|
||||
| ETHEREUM | ETH |
|
||||
| BINANCE | BNB |
|
||||
| POLYGON | POL |
|
||||
| AVALANCHE | AVAX |
|
||||
| ARBITRUM | ETH |
|
||||
| OPTIMISM | ETH |
|
||||
| GNOSIS | xDAI |
|
||||
| KAIA | KLAY |
|
||||
| SEI | SEI |
|
||||
| CORE | CORE |
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_cumulative_gas_used %}
|
||||
|
||||
The total amount of gas used when this transaction was executed in the block.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_tx_block_hash %}
|
||||
|
||||
Block hash is a unique 66-character identifier that is generated when a block is produced.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_tx_fee %}
|
||||
|
||||
Amount paid to validate the transaction in the native asset.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_tx_gas_limit %}
|
||||
|
||||
Maximum amount of gas allocated for the transaction.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_tx_gas_price %}
|
||||
|
||||
Cost per unit of gas in Gwei.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_tx_gas_used %}
|
||||
|
||||
Gas used by the transaction.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_tx_hash %}
|
||||
|
||||
Transaction hash is a unique 66-character identifier that is generated when a transaction is executed.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_tx_input_data %}
|
||||
|
||||
This column contains additional data for this transaction, and is commonly used as part of a contract interaction or as a message to the recipient.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_tx_json %}
|
||||
|
||||
This JSON column contains the transaction details, including event logs.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_tx_nonce %}
|
||||
|
||||
The number of transactions sent from a given address.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_tx_origin_sig %}
|
||||
|
||||
The function signature of the call that triggered this transaction.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_origin_sig %}
|
||||
|
||||
The function signature of the contract call that triggered this transaction.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_tx_position %}
|
||||
|
||||
The position of the transaction within the block.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_tx_status %}
|
||||
|
||||
Status of the transaction.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_value %}
|
||||
|
||||
The value transacted in the native asset.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_effective_gas_price %}
|
||||
|
||||
The total base charge plus tip paid for each unit of gas, in Gwei.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_max_fee_per_gas %}
|
||||
|
||||
The maximum fee per gas of the transaction, in Gwei.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_max_priority_fee_per_gas %}
|
||||
|
||||
The maximum priority fee per gas of the transaction, in Gwei.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_r %}
|
||||
|
||||
The r value of the transaction signature.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_s %}
|
||||
|
||||
The s value of the transaction signature.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_v %}
|
||||
|
||||
The v value of the transaction signature.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_tx_succeeded %}
|
||||
|
||||
Whether the transaction was successful, returned as a boolean.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_tx_fee_precise %}
|
||||
|
||||
The precise amount of the transaction fee. This is returned as a string to avoid precision loss.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_tx_type %}
|
||||
|
||||
The type of transaction.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_mint %}
|
||||
|
||||
The minting event associated with the transaction
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_source_hash %}
|
||||
|
||||
The hash of the source transaction that created this transaction
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_eth_value %}
|
||||
|
||||
The eth value for the transaction
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_chain_id %}
|
||||
|
||||
The unique identifier for the chain the transaction was executed on.
|
||||
|
||||
{% enddocs %}
|
||||
167
models/doc_descriptions/fsc_evm/transfers.md
Normal file
167
models/doc_descriptions/fsc_evm/transfers.md
Normal file
@ -0,0 +1,167 @@
|
||||
{% docs evm_transfers_table_doc %}
|
||||
|
||||
This table contains all native asset transfers, including equivalent USD amounts. The origin addresses correspond to the to and from addresses from the `fact_transactions` table. The `identifier` and `tx_hash` columns relate this table back to `fact_traces`, which contains more details on the transfers.
|
||||
|
||||
Below are the specific native tokens that correspond to each EVM chain:
|
||||
|
||||
| Status | Description |
|
||||
|------------|-------------|
|
||||
| ETHEREUM | ETH |
|
||||
| BINANCE | BNB |
|
||||
| POLYGON | POL |
|
||||
| AVALANCHE | AVAX |
|
||||
| ARBITRUM | ETH |
|
||||
| OPTIMISM | ETH |
|
||||
| GNOSIS | xDAI |
|
||||
| KAIA | KLAY |
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_transfer_table_doc %}
|
||||
|
||||
This table contains all events in the `fact_token_transfers` table, along with joined columns such as token price, symbol, and decimals where possible that allow for easier analysis of token transfer events. Please note native asset transfers are not included here.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_fact_token_transfers_table_doc %}
|
||||
|
||||
This fact-based table contains emitted event logs for ERC-20 Token Transfers (e.g. `Transfer`: topic_0 = `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef`). The contract address is the token transferred, and the raw amount field is the amount of tokens transferred. The values in this table are not decimal adjusted, instead please use `core.dim_contracts` or `core.ez_token_transfers` to reference decimals or decimal adjusted values. This table does not contain ERC-721 and ERC-1155 token transfers, instead please use `nft.ez_nft_transfers`. Additionally, this table does not contain transfers of the chain's native asset, instead please use `core.ez_native_transfers`.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_ez_token_transfers_table_doc %}
|
||||
|
||||
This convenience table contains emitted event logs for ERC-20 Token Transfers (e.g. `Transfer`: topic_0 = `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef`), including decimal adjusted values, USD values, and other helpful token metadata where available for each transfer event. The contract address is the token transferred, and the raw amount field is the amount of tokens transferred. Note, this table does not contain ERC-721 and ERC-1155 token transfers, instead please use `nft.ez_nft_transfers`. Additionally, this table does not contain transfers of the chain's native asset, instead please use `core.ez_native_transfers`.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_ez_native_transfers_table_doc %}
|
||||
|
||||
This convenience table contains all transfers for the chain's native asset, sourced from internal traces (`core.fact_traces`), and includes decimal adjusted and USD values where available. The origin addresses correspond to the to and from addresses in the `core.fact_transactions` table. Note, this table does not contain ERC-721 and ERC-1155 token transfers, instead please use `nft.ez_nft_transfers`.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_amount %}
|
||||
|
||||
Native asset value transferred, this is imported from the fsc-evm package.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_amount_usd %}
|
||||
|
||||
Native asset value transferred, in USD.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_log_id_transfers %}
|
||||
|
||||
This is the primary key for this table. This is a concatenation of the transaction hash and the event index at which the transfer event occurred. This field can be used to find more details on the event within the `fact_event_logs` table.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_origin_from %}
|
||||
|
||||
The from address at the transaction level.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_origin_to %}
|
||||
|
||||
The to address at the transaction level.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_transfer_amount %}
|
||||
|
||||
The decimal transformed amount for this token. Tokens without a decimal adjustment will be nulled out here.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_transfer_amount_precise %}
|
||||
|
||||
The decimal transformed amount for this token returned as a string to preserve precision. Tokens without a decimal adjustment will be nulled out here.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_transfer_amount_usd %}
|
||||
|
||||
The amount in US dollars for this transfer at the time of the transfer. Tokens without a decimal adjustment or price will be nulled out here.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_transfer_contract_address %}
|
||||
|
||||
Contract address of the token being transferred.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_transfer_from_address %}
|
||||
|
||||
The sending address of this transfer.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_transfer_has_decimal %}
|
||||
|
||||
Whether or not our contracts model contains the necessary decimal adjustment for this token.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_transfer_has_price %}
|
||||
|
||||
Whether or not our prices model contains this hourly token price.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_transfer_raw_amount %}
|
||||
|
||||
The amount of tokens transferred. This value is not decimal adjusted.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_transfer_raw_amount_precise %}
|
||||
|
||||
The amount of tokens transferred returned as a string to preserve precision. This value is not decimal adjusted.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_transfer_to_address %}
|
||||
|
||||
The receiving address of this transfer. This can be a contract address.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_transfer_token_price %}
|
||||
|
||||
The price, if available, for this token at the transfer time.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
{% docs evm_transfer_tx_hash %}
|
||||
|
||||
Transaction hash is a unique 66-character identifier that is generated when a transaction is executed. This will not be unique in this table as a transaction could include multiple transfer events.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
{% docs evm_fact_token_transfers_table_doc %}
|
||||
|
||||
This fact-based table contains emitted event logs for ERC-20 Token Transfers (e.g. `Transfer`: topic_0 = `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef`). The contract address is the token transferred, and the raw amount field is the amount of tokens transferred. The values in this table are not decimal adjusted, instead please use `core.dim_contracts` or `core.ez_token_transfers` to reference decimals or decimal adjusted values. This table does not contain ERC-721 and ERC-1155 token transfers, instead please use `nft.ez_nft_transfers`. Additionally, this table does not contain transfers of the chain's native asset, instead please use `core.ez_native_transfers`.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_ez_token_transfers_table_doc %}
|
||||
|
||||
This convenience table contains emitted event logs for ERC-20 Token Transfers (e.g. `Transfer`: topic_0 = `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef`), including decimal adjusted values, usd values, and other helpful token metadata where available for each transfer event. The contract address is the token transferred, and the raw amount field is the amount of tokens transferred. Note, this table does not contain ERC-721 and ERC-1155 token transfers, instead please use `nft.ez_nft_transfers`. Additionally, this table does not contain transfers of the chain's native asset, instead please use `core.ez_native_transfers`.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs evm_ez_native_transfers_table_doc %}
|
||||
|
||||
This convenience table contains all transfers for the chain's native asset, sourced from internal traces (`core.fact_traces`), and includes decimal adjusted and usd values where available. The origin addresses correspond to the to and from addresses in the `core.fact_transactions` table. Note, this table does not contain ERC-721 and ERC-1155 token transfers, instead please use `nft.ez_nft_transfers`.
|
||||
|
||||
{% enddocs %}
|
||||
@ -1,30 +1,70 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
persist_docs ={ "relation": true,
|
||||
"columns": true }
|
||||
{{ config (
|
||||
materialized = "incremental",
|
||||
unique_key = "ez_decoded_event_logs_id",
|
||||
incremental_strategy = 'delete+insert',
|
||||
cluster_by = "block_timestamp::date",
|
||||
incremental_predicates = [standard_predicate()],
|
||||
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(ez_decoded_event_logs_id, contract_name, contract_address)",
|
||||
tags = ['decoded_logs']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
block_number,
|
||||
block_timestamp,
|
||||
tx_hash,
|
||||
{# tx_position, #} -- new column
|
||||
event_index,
|
||||
contract_address,
|
||||
token_name AS contract_name,
|
||||
event_name,
|
||||
decoded_flat AS decoded_log,
|
||||
decoded_data AS full_decoded_log,
|
||||
origin_function_signature,
|
||||
origin_from_address,
|
||||
origin_to_address,
|
||||
topics,
|
||||
topics [0] :: STRING AS topic_0,
|
||||
--new column
|
||||
topics [1] :: STRING AS topic_1,
|
||||
--new column
|
||||
topics [2] :: STRING AS topic_2,
|
||||
--new column
|
||||
topics [3] :: STRING AS topic_3,
|
||||
--new column
|
||||
DATA,
|
||||
event_removed,
|
||||
tx_status,
|
||||
decoded_logs_id AS ez_decoded_event_logs_id,
|
||||
GREATEST(COALESCE(l.inserted_timestamp, '2000-01-01'), COALESCE(C.inserted_timestamp, '2000-01-01')) AS inserted_timestamp,
|
||||
GREATEST(COALESCE(l.modified_timestamp, '2000-01-01'), COALESCE(C.modified_timestamp, '2000-01-01')) AS modified_timestamp
|
||||
origin_from_address,
|
||||
origin_to_address,
|
||||
origin_function_signature,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
event_name,
|
||||
decoded_data AS full_decoded_log,
|
||||
decoded_flat AS decoded_log,
|
||||
token_name AS contract_name,
|
||||
COALESCE (
|
||||
decoded_logs_id,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['tx_hash', 'event_index']
|
||||
) }}
|
||||
) AS ez_decoded_event_logs_id,
|
||||
{% if is_incremental() %}
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
{% else %}
|
||||
GREATEST(block_timestamp, dateadd('day', -10, SYSDATE())) AS inserted_timestamp,
|
||||
GREATEST(block_timestamp, dateadd('day', -10, SYSDATE())) AS modified_timestamp,
|
||||
{% endif %}
|
||||
tx_status --deprecate
|
||||
FROM
|
||||
{{ ref('silver__decoded_logs') }}
|
||||
l
|
||||
LEFT JOIN {{ ref('silver__contracts') }} C USING (contract_address)
|
||||
LEFT JOIN {{ ref('silver__contracts') }} C USING (contract_address)
|
||||
WHERE 1=1
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND l.modified_timestamp > (
|
||||
SELECT
|
||||
COALESCE(
|
||||
MAX(modified_timestamp),
|
||||
'2000-01-01'::TIMESTAMP
|
||||
)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% endif %}
|
||||
@ -51,11 +51,21 @@ models:
|
||||
description: '{{ doc("blast_origin_to") }}'
|
||||
- name: TOPICS
|
||||
description: '{{ doc("blast_topics") }}'
|
||||
- name: TOPIC_0
|
||||
description: '{{ doc("evm_topic_0") }}'
|
||||
- name: TOPIC_1
|
||||
description: '{{ doc("evm_topic_1") }}'
|
||||
- name: TOPIC_2
|
||||
description: '{{ doc("evm_topic_2") }}'
|
||||
- name: TOPIC_3
|
||||
description: '{{ doc("evm_topic_3") }}'
|
||||
- name: DATA
|
||||
description: '{{ doc("blast_logs_data") }}'
|
||||
- name: EVENT_REMOVED
|
||||
description: '{{ doc("blast_event_removed") }}'
|
||||
- name: TX_STATUS
|
||||
description: '{{ doc("evm_column_deprecation_notice_tx_status") }}'
|
||||
- name: TX_SUCCEEDED
|
||||
description: '{{ doc("blast_tx_status") }}'
|
||||
- name: EZ_DECODED_EVENT_LOGS_ID
|
||||
description: '{{ doc("pk") }}'
|
||||
|
||||
@ -10,7 +10,6 @@ SELECT
|
||||
block_timestamp,
|
||||
tx_position,
|
||||
trace_index,
|
||||
identifier,
|
||||
origin_from_address,
|
||||
origin_to_address,
|
||||
origin_function_signature,
|
||||
@ -22,6 +21,7 @@ SELECT
|
||||
amount_usd,
|
||||
native_transfers_id AS ez_native_transfers_id,
|
||||
inserted_timestamp,
|
||||
modified_timestamp
|
||||
modified_timestamp,
|
||||
identifier --deprecate
|
||||
FROM
|
||||
{{ ref('silver__native_transfers') }}
|
||||
{{ ref('silver__native_transfers') }}
|
||||
@ -15,7 +15,7 @@ models:
|
||||
- name: TRACE_INDEX
|
||||
description: '{{ doc("blast_trace_index") }}'
|
||||
- name: IDENTIFIER
|
||||
description: '{{ doc("blast_traces_identifier") }}'
|
||||
description: '{{ doc("evm_column_deprecation_notice_identifier") }}'
|
||||
- name: ORIGIN_FROM_ADDRESS
|
||||
description: '{{ doc("blast_origin_from") }}'
|
||||
- name: ORIGIN_TO_ADDRESS
|
||||
|
||||
@ -22,10 +22,10 @@ SELECT
|
||||
amount_usd,
|
||||
decimals,
|
||||
symbol,
|
||||
token_price,
|
||||
_inserted_timestamp,
|
||||
transfers_id AS ez_token_transfers_id,
|
||||
inserted_timestamp,
|
||||
modified_timestamp
|
||||
modified_timestamp,
|
||||
_inserted_timestamp, --deprecate
|
||||
token_price --deprecate
|
||||
FROM
|
||||
{{ ref('silver__transfers') }}
|
||||
{{ ref('silver__transfers') }}
|
||||
@ -39,9 +39,9 @@ models:
|
||||
- name: SYMBOL
|
||||
description: '{{ doc("blast_symbol") }}'
|
||||
- name: TOKEN_PRICE
|
||||
description: '{{ doc("blast_transfer_token_price") }}'
|
||||
description: '{{ doc("evm_column_deprecation_notice_token_price") }}'
|
||||
- name: _INSERTED_TIMESTAMP
|
||||
description: '{{ doc("internal_column") }}'
|
||||
description: '{{ doc("evm_column_deprecation_notice_inserted_timestamp") }}'
|
||||
- name: EZ_TOKEN_TRANSFERS_ID
|
||||
description: '{{ doc("pk") }}'
|
||||
- name: INSERTED_TIMESTAMP
|
||||
|
||||
@ -6,22 +6,38 @@
|
||||
|
||||
SELECT
|
||||
A.block_number AS block_number,
|
||||
HASH AS block_hash, --new column
|
||||
block_timestamp,
|
||||
'mainnet' AS network,
|
||||
'blast' AS blockchain,
|
||||
d.tx_count,
|
||||
SIZE,
|
||||
miner, --new column
|
||||
extra_data,
|
||||
parent_hash,
|
||||
gas_used,
|
||||
gas_limit,
|
||||
difficulty,
|
||||
total_difficulty,
|
||||
extra_data,
|
||||
gas_limit,
|
||||
gas_used,
|
||||
HASH,
|
||||
parent_hash,
|
||||
receipts_root,
|
||||
sha3_uncles,
|
||||
SIZE,
|
||||
uncles AS uncle_blocks,
|
||||
nonce, --new column
|
||||
receipts_root,
|
||||
state_root, --new column
|
||||
transactions_root, --new column
|
||||
logs_bloom, --new column
|
||||
base_fee_per_gas, --new column
|
||||
withdrawals_root,
|
||||
blocks_id AS fact_blocks_id,
|
||||
GREATEST(
|
||||
A.inserted_timestamp,
|
||||
d.inserted_timestamp
|
||||
) AS inserted_timestamp,
|
||||
GREATEST(
|
||||
A.modified_timestamp,
|
||||
d.modified_timestamp
|
||||
) AS modified_timestamp,
|
||||
'blast' AS blockchain, --deprecate
|
||||
HASH, --deprecate
|
||||
OBJECT_CONSTRUCT(
|
||||
'baseFeePerGas',
|
||||
base_fee_per_gas,
|
||||
@ -61,16 +77,7 @@ SELECT
|
||||
transactions_root,
|
||||
'uncles',
|
||||
uncles
|
||||
) AS block_header_json,
|
||||
blocks_id AS fact_blocks_id,
|
||||
GREATEST(
|
||||
A.inserted_timestamp,
|
||||
d.inserted_timestamp
|
||||
) AS inserted_timestamp,
|
||||
GREATEST(
|
||||
A.modified_timestamp,
|
||||
d.modified_timestamp
|
||||
) AS modified_timestamp
|
||||
) AS block_header_json --deprecate
|
||||
FROM
|
||||
{{ ref('silver__blocks') }} A
|
||||
LEFT JOIN {{ ref('silver__tx_count') }}
|
||||
|
||||
@ -1,48 +1,62 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_blocks
|
||||
description: '{{ doc("blast_blocks_table_doc") }}'
|
||||
description: '{{ doc("evm_blocks_table_doc") }}'
|
||||
|
||||
columns:
|
||||
- name: BLOCK_NUMBER
|
||||
description: '{{ doc("blast_block_number") }}'
|
||||
description: '{{ doc("evm_block_number") }}'
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: '{{ doc("blast_block_timestamp") }}'
|
||||
description: '{{ doc("evm_block_timestamp") }}'
|
||||
- name: NETWORK
|
||||
description: '{{ doc("blast_network") }}'
|
||||
description: '{{ doc("evm_network") }}'
|
||||
- name: BLOCKCHAIN
|
||||
description: '{{ doc("blast_blockchain") }}'
|
||||
description: '{{ doc("evm_column_deprecation_notice_blockchain") }}'
|
||||
- name: TX_COUNT
|
||||
description: '{{ doc("blast_tx_count") }}'
|
||||
description: '{{ doc("evm_tx_count") }}'
|
||||
- name: DIFFICULTY
|
||||
description: '{{ doc("blast_difficulty") }}'
|
||||
description: '{{ doc("evm_difficulty") }}'
|
||||
- name: TOTAL_DIFFICULTY
|
||||
description: '{{ doc("blast_total_difficulty") }}'
|
||||
description: '{{ doc("evm_total_difficulty") }}'
|
||||
- name: EXTRA_DATA
|
||||
description: '{{ doc("blast_extra_data") }}'
|
||||
description: '{{ doc("evm_extra_data") }}'
|
||||
- name: GAS_LIMIT
|
||||
description: '{{ doc("blast_gas_limit") }}'
|
||||
description: '{{ doc("evm_gas_limit") }}'
|
||||
- name: GAS_USED
|
||||
description: '{{ doc("blast_gas_used") }}'
|
||||
description: '{{ doc("evm_gas_used") }}'
|
||||
- name: BLOCK_HASH
|
||||
description: '{{ doc("evm_blocks_hash") }}'
|
||||
- name: HASH
|
||||
description: '{{ doc("blast_blocks_hash") }}'
|
||||
description: '{{ doc("evm_column_deprecation_notice_hash") }}'
|
||||
- name: PARENT_HASH
|
||||
description: '{{ doc("blast_parent_hash") }}'
|
||||
description: '{{ doc("evm_parent_hash") }}'
|
||||
- name: RECEIPTS_ROOT
|
||||
description: '{{ doc("blast_receipts_root") }}'
|
||||
description: '{{ doc("evm_receipts_root") }}'
|
||||
- name: SHA3_UNCLES
|
||||
description: '{{ doc("blast_sha3_uncles") }}'
|
||||
description: '{{ doc("evm_sha3_uncles") }}'
|
||||
- name: SIZE
|
||||
description: '{{ doc("blast_size") }}'
|
||||
description: '{{ doc("evm_size") }}'
|
||||
- name: MINER
|
||||
description: '{{ doc("evm_miner") }}'
|
||||
- name: NONCE
|
||||
description: '{{ doc("evm_tx_nonce") }}'
|
||||
- name: STATE_ROOT
|
||||
description: '{{ doc("evm_state_root") }}'
|
||||
- name: TRANSACTIONS_ROOT
|
||||
description: '{{ doc("evm_transactions_root") }}'
|
||||
- name: LOGS_BLOOM
|
||||
description: '{{ doc("evm_logs_bloom") }}'
|
||||
- name: UNCLE_BLOCKS
|
||||
description: '{{ doc("blast_uncle_blocks") }}'
|
||||
description: '{{ doc("evm_uncle_blocks") }}'
|
||||
- name: BLOCK_HEADER_JSON
|
||||
description: '{{ doc("blast_block_header_json") }}'
|
||||
description: '{{ doc("evm_column_deprecation_notice_block_header_json") }}'
|
||||
- name: FACT_BLOCKS_ID
|
||||
description: '{{ doc("pk") }}'
|
||||
description: '{{ doc("evm_pk") }}'
|
||||
- name: INSERTED_TIMESTAMP
|
||||
description: '{{ doc("inserted_timestamp") }}'
|
||||
description: '{{ doc("evm_inserted_timestamp") }}'
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
description: '{{ doc("modified_timestamp") }}'
|
||||
description: '{{ doc("evm_modified_timestamp") }}'
|
||||
- name: WITHDRAWALS_ROOT
|
||||
description: A hash of the withdrawals that occurred in this block.
|
||||
description: '{{ doc("evm_withdrawals_root") }}'
|
||||
- name: BASE_FEE_PER_GAS
|
||||
description: '{{ doc("evm_base_fee_per_gas") }}'
|
||||
|
||||
@ -1,28 +1,7 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_decoded_event_logs
|
||||
description: >
|
||||
'For information on how to submit a contract for decoding, as well as how ABIs are sourced, please visit [here](https://science.flipsidecrypto.xyz/abi-requestor/).
|
||||
This model contains decoded event logs for contracts that we have an ABI for. Please note, this table does not include all event logs, only those that we have an ABI for.
|
||||
This table will perform better than the `core__ez_decoded_event_logs` table, but does not include as many columns.
|
||||
The `decoded_log` column is the easiest place to query decoded data. It is a JSON object, where the keys are the names of the event parameters, and the values are the values of the event parameters.
|
||||
You can select from this column using the following sample format, `decoded_log:from::string` or more generally, `decoded_log:<event_param>::datatype`. See below for a full sample query.
|
||||
The `full_decoded_logs` column contains the same information, as well as additional fields such as the datatype of the decoded data. You may need to laterally flatten this column to query the data.
|
||||
|
||||
Sample query for USDC Transfer events:
|
||||
```sql
|
||||
select
|
||||
tx_hash,
|
||||
block_number,
|
||||
contract_address,
|
||||
decoded_log:from::string as from_address,
|
||||
decoded_log:to::string as to_address,
|
||||
decoded_log:value::integer as value
|
||||
from ethereum.core.fact_decoded_event_logs
|
||||
where contract_address = lower('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48')
|
||||
and block_number between 16400000 and 16405000
|
||||
and event_name = 'Transfer'
|
||||
limit 50```'
|
||||
description: '{{ doc("evm_table_deprecation_notice_fact_decoded_event_logs") }}'
|
||||
|
||||
columns:
|
||||
- name: BLOCK_NUMBER
|
||||
|
||||
@ -8,18 +8,26 @@ SELECT
|
||||
block_number,
|
||||
block_timestamp,
|
||||
tx_hash,
|
||||
origin_function_signature,
|
||||
origin_from_address,
|
||||
origin_to_address,
|
||||
event_index,
|
||||
contract_address,
|
||||
topics,
|
||||
topics[0]::STRING AS topic_0, --new column
|
||||
topics[1]::STRING AS topic_1, --new column
|
||||
topics[2]::STRING AS topic_2, --new column
|
||||
topics[3]::STRING AS topic_3, --new column
|
||||
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, --new column
|
||||
logs_id AS fact_event_logs_id,
|
||||
inserted_timestamp,
|
||||
modified_timestamp
|
||||
modified_timestamp,
|
||||
tx_status, --deprecate
|
||||
_log_id --deprecate
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
|
||||
@ -1,38 +1,48 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_event_logs
|
||||
description: '{{ doc("blast_logs_table_doc") }}'
|
||||
description: '{{ doc("evm_logs_table_doc") }}'
|
||||
|
||||
columns:
|
||||
- name: BLOCK_NUMBER
|
||||
description: '{{ doc("blast_block_number") }}'
|
||||
description: '{{ doc("evm_block_number") }}'
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: '{{ doc("blast_block_timestamp") }}'
|
||||
description: '{{ doc("evm_block_timestamp") }}'
|
||||
- name: TX_HASH
|
||||
description: '{{ doc("blast_logs_tx_hash") }}'
|
||||
description: '{{ doc("evm_logs_tx_hash") }}'
|
||||
- name: EVENT_INDEX
|
||||
description: '{{ doc("blast_event_index") }}'
|
||||
description: '{{ doc("evm_event_index") }}'
|
||||
- name: CONTRACT_ADDRESS
|
||||
description: '{{ doc("blast_logs_contract_address") }}'
|
||||
description: '{{ doc("evm_logs_contract_address") }}'
|
||||
- name: TOPICS
|
||||
description: '{{ doc("blast_topics") }}'
|
||||
description: '{{ doc("evm_topics") }}'
|
||||
- name: TOPIC_0
|
||||
description: '{{ doc("evm_topic_0") }}'
|
||||
- name: TOPIC_1
|
||||
description: '{{ doc("evm_topic_1") }}'
|
||||
- name: TOPIC_2
|
||||
description: '{{ doc("evm_topic_2") }}'
|
||||
- name: TOPIC_3
|
||||
description: '{{ doc("evm_topic_3") }}'
|
||||
- name: DATA
|
||||
description: '{{ doc("blast_logs_data") }}'
|
||||
description: '{{ doc("evm_logs_data") }}'
|
||||
- name: EVENT_REMOVED
|
||||
description: '{{ doc("blast_event_removed") }}'
|
||||
description: '{{ doc("evm_event_removed") }}'
|
||||
- name: _LOG_ID
|
||||
description: '{{ doc("internal_column") }}'
|
||||
description: '{{ doc("evm_column_deprecation_notice_log_id") }}'
|
||||
- name: TX_STATUS
|
||||
description: '{{ doc("blast_tx_status") }}'
|
||||
description: '{{ doc("evm_column_deprecation_notice_tx_status") }}'
|
||||
- name: TX_SUCCEEDED
|
||||
description: '{{ doc("evm_tx_succeeded") }}'
|
||||
- name: ORIGIN_FUNCTION_SIGNATURE
|
||||
description: '{{ doc("blast_origin_sig") }}'
|
||||
description: '{{ doc("evm_origin_sig") }}'
|
||||
- name: ORIGIN_FROM_ADDRESS
|
||||
description: '{{ doc("blast_origin_from") }}'
|
||||
description: '{{ doc("evm_origin_from") }}'
|
||||
- name: ORIGIN_TO_ADDRESS
|
||||
description: '{{ doc("blast_origin_to") }}'
|
||||
description: '{{ doc("evm_origin_to") }}'
|
||||
- name: FACT_EVENT_LOGS_ID
|
||||
description: '{{ doc("pk") }}'
|
||||
description: '{{ doc("evm_pk") }}'
|
||||
- name: INSERTED_TIMESTAMP
|
||||
description: '{{ doc("inserted_timestamp") }}'
|
||||
description: '{{ doc("evm_inserted_timestamp") }}'
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
description: '{{ doc("modified_timestamp") }}'
|
||||
description: '{{ doc("evm_modified_timestamp") }}'
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_token_transfers
|
||||
description: '{{ doc("evm_fact_token_transfers_table_doc") }}'
|
||||
description: '{{ doc("evm_table_deprecation_notice_fact_token_transfers") }}'
|
||||
|
||||
columns:
|
||||
- name: BLOCK_NUMBER
|
||||
|
||||
@ -471,10 +471,10 @@ SELECT
|
||||
error_reason,
|
||||
revert_reason,
|
||||
tx_succeeded,
|
||||
identifier,
|
||||
DATA,
|
||||
tx_status,
|
||||
trace_status,
|
||||
identifier, --deprecate
|
||||
DATA, --deprecate
|
||||
tx_status, --deprecate
|
||||
trace_status, --deprecate
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['tx_hash', 'trace_index']
|
||||
) }} AS fact_traces_id,
|
||||
|
||||
@ -1,68 +1,67 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_traces
|
||||
description: '{{ doc("blast_traces_table_doc") }}'
|
||||
description: '{{ doc("evm_traces_table_doc") }}'
|
||||
|
||||
columns:
|
||||
- name: BLOCK_NUMBER
|
||||
description: '{{ doc("blast_traces_block_no") }}'
|
||||
description: '{{ doc("evm_traces_block_no") }}'
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: '{{ doc("blast_traces_blocktime") }}'
|
||||
description: '{{ doc("evm_traces_blocktime") }}'
|
||||
- name: TX_HASH
|
||||
description: '{{ doc("blast_traces_tx_hash") }}'
|
||||
description: '{{ doc("evm_traces_tx_hash") }}'
|
||||
- name: TX_POSITION
|
||||
description: The position of the transaction within the block.
|
||||
- name: TRACE_INDEX
|
||||
description: The index of the trace within the transaction.
|
||||
description: '{{ doc("evm_tx_position") }}'
|
||||
- name: FROM_ADDRESS
|
||||
description: '{{ doc("blast_traces_from") }}'
|
||||
description: '{{ doc("evm_traces_from") }}'
|
||||
- name: TO_ADDRESS
|
||||
description: '{{ doc("blast_traces_to") }}'
|
||||
- name: INPUT
|
||||
description: '{{ doc("blast_traces_input") }}'
|
||||
- name: OUTPUT
|
||||
description: '{{ doc("blast_traces_output") }}'
|
||||
- name: TYPE
|
||||
description: '{{ doc("blast_traces_type") }}'
|
||||
- name: TRACE_ADDRESS
|
||||
description: This field represents the position of the trace within the transaction.
|
||||
- name: SUB_TRACES
|
||||
description: '{{ doc("blast_traces_sub") }}'
|
||||
- name: IDENTIFIER
|
||||
description: '{{ doc("blast_traces_identifier") }}'
|
||||
- name: DATA
|
||||
description: '{{ doc("blast_traces_call_data") }}'
|
||||
description: '{{ doc("evm_traces_to") }}'
|
||||
- name: VALUE
|
||||
description: '{{ doc("blast_traces_value") }}'
|
||||
description: '{{ doc("evm_traces_value") }}'
|
||||
- name: VALUE_PRECISE_RAW
|
||||
description: '{{ doc("precise_amount_unadjusted") }}'
|
||||
description: '{{ doc("evm_precise_amount_unadjusted") }}'
|
||||
- name: VALUE_PRECISE
|
||||
description: '{{ doc("precise_amount_adjusted") }}'
|
||||
description: '{{ doc("evm_precise_amount_adjusted") }}'
|
||||
- name: VALUE_HEX
|
||||
description: '{{ doc("evm_value_hex") }}'
|
||||
- name: GAS
|
||||
description: '{{ doc("blast_traces_gas") }}'
|
||||
description: '{{ doc("evm_traces_gas") }}'
|
||||
- name: GAS_USED
|
||||
description: '{{ doc("blast_traces_gas_used") }}'
|
||||
- name: ORIGIN_FROM_ADDRESS
|
||||
description: The from address at the transaction level.
|
||||
- name: ORIGIN_TO_ADDRESS
|
||||
description: The to address at the transaction level.
|
||||
- name: ORIGIN_FUNCTION_SIGNATURE
|
||||
description: The function signature at the transaction level.
|
||||
- name: TRACE_STATUS
|
||||
description: The status of the trace, either `SUCCESS` or `FAIL`
|
||||
- name: TRACE_SUCCEEDED
|
||||
description: Whether the trace succeeded or failed
|
||||
- name: ERROR_REASON
|
||||
description: The reason for the trace failure, if any.
|
||||
- name: REVERT_REASON
|
||||
description: The reason for the trace revert, if any.
|
||||
description: '{{ doc("evm_traces_gas_used") }}'
|
||||
- name: INPUT
|
||||
description: '{{ doc("evm_traces_input") }}'
|
||||
- name: OUTPUT
|
||||
description: '{{ doc("evm_traces_output") }}'
|
||||
- name: TYPE
|
||||
description: '{{ doc("evm_traces_type") }}'
|
||||
- name: IDENTIFIER
|
||||
description: '{{ doc("evm_column_deprecation_notice_identifier") }}'
|
||||
- name: TRACE_ADDRESS
|
||||
description: '{{ doc("evm_trace_address") }}'
|
||||
- name: DATA
|
||||
description: '{{ doc("evm_column_deprecation_notice_data") }}'
|
||||
- name: TX_STATUS
|
||||
description: '{{ doc("blast_tx_status") }}'
|
||||
description: '{{ doc("evm_column_deprecation_notice_tx_status") }}'
|
||||
- name: TX_SUCCEEDED
|
||||
description: Whether the transaction succeeded or failed
|
||||
description: '{{ doc("evm_tx_succeeded") }}'
|
||||
- name: TRACE_SUCCEEDED
|
||||
description: '{{ doc("evm_trace_succeeded") }}'
|
||||
- name: SUB_TRACES
|
||||
description: '{{ doc("evm_sub_traces") }}'
|
||||
- name: TRACE_STATUS
|
||||
description: '{{ doc("evm_column_deprecation_notice_trace_status") }}'
|
||||
- name: ERROR_REASON
|
||||
description: '{{ doc("evm_trace_error_reason") }}'
|
||||
- name: REVERT_REASON
|
||||
description: '{{ doc("evm_revert_reason") }}'
|
||||
- name: TRACE_INDEX
|
||||
description: The index of the trace within the transaction.
|
||||
- name: FACT_TRACES_ID
|
||||
description: '{{ doc("pk") }}'
|
||||
description: '{{ doc("evm_pk") }}'
|
||||
- name: INSERTED_TIMESTAMP
|
||||
description: '{{ doc("inserted_timestamp") }}'
|
||||
description: '{{ doc("evm_inserted_timestamp") }}'
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
description: '{{ doc("modified_timestamp") }}'
|
||||
description: '{{ doc("evm_modified_timestamp") }}'
|
||||
|
||||
|
||||
|
||||
|
||||
@ -7,39 +7,46 @@
|
||||
SELECT
|
||||
block_number,
|
||||
block_timestamp,
|
||||
block_hash,
|
||||
tx_hash,
|
||||
nonce,
|
||||
POSITION,
|
||||
origin_function_signature,
|
||||
from_address,
|
||||
to_address,
|
||||
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, --new column
|
||||
tx_type,
|
||||
nonce,
|
||||
POSITION AS tx_position, --new column
|
||||
input_data,
|
||||
gas_price,
|
||||
effective_gas_price,
|
||||
gas AS gas_limit,
|
||||
gas_used,
|
||||
gas AS gas_limit,
|
||||
cumulative_gas_used,
|
||||
effective_gas_price,
|
||||
max_fee_per_gas,
|
||||
max_priority_fee_per_gas,
|
||||
l1_gas_price,
|
||||
l1_gas_used,
|
||||
l1_fee_scalar,
|
||||
l1_fee,
|
||||
l1_fee_precise,
|
||||
cumulative_gas_used,
|
||||
max_fee_per_gas,
|
||||
max_priority_fee_per_gas,
|
||||
input_data,
|
||||
tx_status AS status,
|
||||
l1_fee,
|
||||
y_parity, --new column
|
||||
r,
|
||||
s,
|
||||
v,
|
||||
deposit_nonce,
|
||||
deposit_receipt_version,
|
||||
transactions_id AS fact_transactions_id,
|
||||
inserted_timestamp,
|
||||
modified_timestamp
|
||||
modified_timestamp,
|
||||
block_hash, --deprecate
|
||||
tx_status AS status, --deprecate
|
||||
POSITION, --deprecate
|
||||
deposit_nonce, --deprecate, may be separate table
|
||||
deposit_receipt_version --deprecate, may be separate table
|
||||
FROM
|
||||
{{ ref('silver__transactions') }}
|
||||
|
||||
@ -1,65 +1,71 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_transactions
|
||||
description: '{{ doc("blast_tx_table_doc") }}'
|
||||
description: '{{ doc("evm_tx_table_doc") }}'
|
||||
|
||||
columns:
|
||||
- name: BLOCK_NUMBER
|
||||
description: '{{ doc("blast_block_number") }}'
|
||||
description: '{{ doc("evm_block_number") }}'
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: '{{ doc("blast_block_timestamp") }}'
|
||||
description: '{{ doc("evm_block_timestamp") }}'
|
||||
- name: BLOCK_HASH
|
||||
description: '{{ doc("blast_tx_block_hash") }}'
|
||||
description: '{{ doc("evm_column_deprecation_notice_block_hash") }}'
|
||||
- name: TX_HASH
|
||||
description: '{{ doc("blast_tx_hash") }}'
|
||||
description: '{{ doc("evm_tx_hash") }}'
|
||||
- name: NONCE
|
||||
description: '{{ doc("blast_tx_nonce") }}'
|
||||
description: '{{ doc("evm_tx_nonce") }}'
|
||||
- name: POSITION
|
||||
description: '{{ doc("blast_tx_position") }}'
|
||||
description: '{{ doc("evm_column_deprecation_notice_position") }}'
|
||||
- name: TX_POSITION
|
||||
description: '{{ doc("evm_tx_position") }}'
|
||||
- name: FROM_ADDRESS
|
||||
description: '{{ doc("blast_from_address") }}'
|
||||
description: '{{ doc("evm_from_address") }}'
|
||||
- name: TO_ADDRESS
|
||||
description: '{{ doc("blast_to_address") }}'
|
||||
description: '{{ doc("evm_to_address") }}'
|
||||
- name: VALUE
|
||||
description: '{{ doc("blast_value") }}'
|
||||
description: '{{ doc("evm_value") }}'
|
||||
- name: VALUE_PRECISE_RAW
|
||||
description: '{{ doc("precise_amount_unadjusted") }}'
|
||||
description: '{{ doc("evm_precise_amount_unadjusted") }}'
|
||||
- name: VALUE_PRECISE
|
||||
description: '{{ doc("precise_amount_adjusted") }}'
|
||||
description: '{{ doc("evm_precise_amount_adjusted") }}'
|
||||
- name: TX_FEE
|
||||
description: '{{ doc("blast_tx_fee") }}'
|
||||
description: '{{ doc("evm_tx_fee") }}'
|
||||
- name: TX_FEE_PRECISE
|
||||
description: '{{ doc("tx_fee_precise") }}'
|
||||
description: '{{ doc("evm_tx_fee_precise") }}'
|
||||
- name: GAS_PRICE
|
||||
description: '{{ doc("blast_tx_gas_price") }}'
|
||||
description: '{{ doc("evm_tx_gas_price") }}'
|
||||
- name: EFFECTIVE_GAS_PRICE
|
||||
description: The total base charge plus tip paid for each unit of gas, in Gwei.
|
||||
- name: GAS_LIMIT
|
||||
description: '{{ doc("blast_tx_gas_limit") }}'
|
||||
description: '{{ doc("evm_tx_gas_limit") }}'
|
||||
- name: GAS_USED
|
||||
description: '{{ doc("blast_tx_gas_used") }}'
|
||||
description: '{{ doc("evm_tx_gas_used") }}'
|
||||
- name: L1_GAS_PRICE
|
||||
description: '{{ doc("blast_l1_gas_price") }}'
|
||||
description: '{{ doc("evm_l1_gas_price") }}'
|
||||
- name: L1_GAS_USED
|
||||
description: '{{ doc("blast_l1_gas_used") }}'
|
||||
description: '{{ doc("evm_l1_gas_used") }}'
|
||||
- name: L1_FEE_SCALAR
|
||||
description: '{{ doc("blast_l1_fee_scalar") }}'
|
||||
description: '{{ doc("evm_l1_fee_scalar") }}'
|
||||
- name: L1_FEE
|
||||
description: The L1 portion of fees paid.
|
||||
- name: L1_FEE_PRECISE
|
||||
description: '{{ doc("tx_fee_precise") }}'
|
||||
description: '{{ doc("evm_l1_fee_precise") }}'
|
||||
- name: CUMULATIVE_GAS_USED
|
||||
description: '{{ doc("blast_cumulative_gas_used") }}'
|
||||
description: '{{ doc("evm_cumulative_gas_used") }}'
|
||||
- name: MAX_FEE_PER_GAS
|
||||
description: The maximum fee per gas of the transaction, in Gwei.
|
||||
- name: MAX_PRIORITY_FEE_PER_GAS
|
||||
description: The maximum priority fee per gas of the transaction, in Gwei.
|
||||
- name: STATUS
|
||||
description: '{{ doc("blast_tx_status") }}'
|
||||
description: '{{ doc("evm_column_deprecation_notice_tx_status") }}'
|
||||
- name: TX_SUCCEEDED
|
||||
description: '{{ doc("evm_tx_succeeded") }}'
|
||||
- name: INPUT_DATA
|
||||
description: '{{ doc("blast_tx_input_data") }}'
|
||||
description: '{{ doc("evm_tx_input_data") }}'
|
||||
- name: ORIGIN_FUNCTION_SIGNATURE
|
||||
description: '{{ doc("blast_tx_origin_sig") }}'
|
||||
description: '{{ doc("evm_tx_origin_sig") }}'
|
||||
- name: Y_PARITY
|
||||
description: The y parity of the transaction signature.
|
||||
- name: R
|
||||
description: The r value of the transaction signature.
|
||||
- name: S
|
||||
@ -67,12 +73,12 @@ models:
|
||||
- name: V
|
||||
description: The v value of the transaction signature.
|
||||
- name: FACT_TRANSACTIONS_ID
|
||||
description: '{{ doc("pk") }}'
|
||||
description: '{{ doc("evm_pk") }}'
|
||||
- name: INSERTED_TIMESTAMP
|
||||
description: '{{ doc("inserted_timestamp") }}'
|
||||
description: '{{ doc("evm_inserted_timestamp") }}'
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
description: '{{ doc("modified_timestamp") }}'
|
||||
description: '{{ doc("evm_modified_timestamp") }}'
|
||||
- name: DEPOSIT_NONCE
|
||||
description: The nonce of the deposit transaction.
|
||||
description: '{{ doc("evm_column_deprecation_notice_deposit_nonce") }}'
|
||||
- name: DEPOSIT_RECEIPT_VERSION
|
||||
description: The version of the deposit receipt.
|
||||
description: '{{ doc("evm_column_deprecation_notice_deposit_receipt_version") }}'
|
||||
@ -53,9 +53,9 @@ SELECT
|
||||
token_out,
|
||||
symbol_in,
|
||||
symbol_out,
|
||||
_log_id,
|
||||
complete_dex_swaps_id AS ez_dex_swaps_id,
|
||||
inserted_timestamp,
|
||||
modified_timestamp
|
||||
modified_timestamp,
|
||||
_log_id --deprecate
|
||||
FROM
|
||||
{{ ref('silver_dex__complete_dex_swaps') }}
|
||||
{{ ref('silver_dex__complete_dex_swaps') }}
|
||||
@ -56,5 +56,7 @@ models:
|
||||
description: '{{ doc("inserted_timestamp") }}'
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
description: '{{ doc("modified_timestamp") }}'
|
||||
- name: _LOG_ID
|
||||
description: '{{ doc("evm_column_deprecation_notice_log_id") }}'
|
||||
|
||||
|
||||
|
||||
@ -16,8 +16,8 @@ WITH base AS (
|
||||
{{ ref('core__fact_traces') }}
|
||||
WHERE
|
||||
TYPE = 'DELEGATECALL'
|
||||
AND trace_status = 'SUCCESS'
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND trace_succeeded
|
||||
AND tx_succeeded
|
||||
AND from_address != to_address -- exclude self-calls
|
||||
|
||||
{% if is_incremental() %}
|
||||
|
||||
@ -506,7 +506,7 @@ valid_traces AS (
|
||||
SELECT
|
||||
base_address
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
l
|
||||
JOIN event_mapping ia
|
||||
ON ia.contract_address = l.contract_address
|
||||
|
||||
@ -27,8 +27,8 @@ 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 >= (
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
incremental_strategy = 'delete+insert',
|
||||
unique_key = 'block_number',
|
||||
cluster_by = ['block_timestamp::DATE'],
|
||||
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION",
|
||||
tags = ['non_realtime','reorg']
|
||||
) }}
|
||||
|
||||
@ -13,31 +12,31 @@ WITH eth_base AS (
|
||||
tx_hash,
|
||||
block_number,
|
||||
block_timestamp,
|
||||
identifier,
|
||||
identifier, --deprecate
|
||||
from_address,
|
||||
to_address,
|
||||
VALUE AS eth_value,
|
||||
value,
|
||||
concat_ws(
|
||||
'-',
|
||||
block_number,
|
||||
tx_position,
|
||||
CONCAT(
|
||||
TYPE,
|
||||
type,
|
||||
'_',
|
||||
trace_address
|
||||
)
|
||||
) AS _call_id,
|
||||
modified_timestamp AS _inserted_timestamp,
|
||||
value_precise_raw AS eth_value_precise_raw,
|
||||
value_precise AS eth_value_precise,
|
||||
value_precise_raw,
|
||||
value_precise,
|
||||
tx_position,
|
||||
trace_index
|
||||
FROM
|
||||
{{ ref('core__fact_traces') }}
|
||||
WHERE
|
||||
eth_value > 0
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND trace_status = 'SUCCESS'
|
||||
value > 0
|
||||
AND tx_succeeded
|
||||
AND trace_succeeded
|
||||
AND TYPE NOT IN (
|
||||
'DELEGATECALL',
|
||||
'STATICCALL'
|
||||
@ -60,7 +59,7 @@ tx_table AS (
|
||||
to_address AS origin_to_address,
|
||||
origin_function_signature
|
||||
FROM
|
||||
{{ ref('silver__transactions') }}
|
||||
{{ ref('core__fact_transactions') }}
|
||||
WHERE
|
||||
tx_hash IN (
|
||||
SELECT
|
||||
@ -70,7 +69,7 @@ tx_table AS (
|
||||
)
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
AND modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp) - INTERVAL '72 hours'
|
||||
FROM
|
||||
@ -79,20 +78,20 @@ AND _inserted_timestamp >= (
|
||||
{% endif %}
|
||||
)
|
||||
SELECT
|
||||
tx_hash AS tx_hash,
|
||||
block_number AS block_number,
|
||||
block_timestamp AS block_timestamp,
|
||||
identifier AS identifier,
|
||||
tx_hash,
|
||||
block_number,
|
||||
block_timestamp,
|
||||
identifier, --deprecate
|
||||
origin_from_address,
|
||||
origin_to_address,
|
||||
origin_function_signature,
|
||||
from_address,
|
||||
to_address,
|
||||
eth_value AS amount,
|
||||
eth_value_precise_raw AS amount_precise_raw,
|
||||
eth_value_precise AS amount_precise,
|
||||
value AS amount,
|
||||
value_precise_raw AS amount_precise_raw,
|
||||
value_precise AS amount_precise,
|
||||
ROUND(
|
||||
eth_value * price,
|
||||
value * price,
|
||||
2
|
||||
) AS amount_usd,
|
||||
_call_id,
|
||||
|
||||
@ -10,14 +10,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__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
|
||||
{% if is_incremental() %}
|
||||
WHERE
|
||||
_inserted_timestamp > (
|
||||
modified_timestamp > (
|
||||
SELECT
|
||||
MAX(max_inserted_timestamp_logs)
|
||||
FROM
|
||||
@ -36,8 +36,8 @@ function_calls AS (
|
||||
FROM
|
||||
{{ ref('core__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'
|
||||
|
||||
@ -11,7 +11,11 @@
|
||||
WITH logs AS (
|
||||
|
||||
SELECT
|
||||
_log_id,
|
||||
CONCAT(
|
||||
tx_hash,
|
||||
'-',
|
||||
event_index
|
||||
) AS _log_id,
|
||||
block_number,
|
||||
tx_hash,
|
||||
block_timestamp,
|
||||
@ -24,12 +28,12 @@ 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__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
topics [0] :: STRING = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
|
||||
@ -9,16 +9,16 @@ WITH base AS (
|
||||
|
||||
SELECT
|
||||
block_number,
|
||||
MIN(_inserted_timestamp) AS _inserted_timestamp,
|
||||
MIN(modified_timestamp) AS _inserted_timestamp,
|
||||
COUNT(*) AS tx_count
|
||||
FROM
|
||||
{{ ref('silver__transactions') }}
|
||||
{{ ref('core__fact_transactions') }}
|
||||
|
||||
{% if is_incremental() %}
|
||||
WHERE
|
||||
_inserted_timestamp >= (
|
||||
modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp) _inserted_timestamp
|
||||
MAX(_inserted_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
|
||||
@ -49,10 +49,7 @@ WITH base_evt AS (
|
||||
CONCAT('0x', SUBSTR(segmented_data [7] :: STRING, 25, 40)) AS recipient,
|
||||
CONCAT('0x', SUBSTR(segmented_data [8] :: STRING, 25, 40)) AS exclusiveRelayer,
|
||||
segmented_data [9] :: STRING AS message,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
|
||||
@ -35,10 +35,7 @@ WITH base_evt AS (
|
||||
decoded_log :"symbol" :: STRING AS symbol,
|
||||
decoded_log,
|
||||
event_removed,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
@ -92,10 +89,7 @@ native_gas_paid AS (
|
||||
decoded_log :"symbol" :: STRING AS symbol,
|
||||
decoded_log,
|
||||
event_removed,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
@ -125,10 +119,14 @@ transfers AS (
|
||||
tx_hash,
|
||||
event_index,
|
||||
contract_address AS token_address,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__transfers') }}
|
||||
{{ ref('core__ez_token_transfers') }}
|
||||
WHERE
|
||||
from_address = '0x492751ec3c57141deb205ec2da8bfcb410738630'
|
||||
AND to_address IN (
|
||||
|
||||
@ -24,10 +24,7 @@ WITH dispatch AS (
|
||||
CONCAT('0x', SUBSTR(topics [3] :: STRING, 27, 40)) AS dst_bridge_token,
|
||||
-- dst bridge token address, not recipient address
|
||||
DATA,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
@ -58,10 +55,7 @@ dispatch_id AS (
|
||||
tx_hash,
|
||||
event_index,
|
||||
topics [1] :: STRING AS messageId,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
@ -96,10 +90,7 @@ gas_payment AS (
|
||||
regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
|
||||
TRY_TO_NUMBER(utils.udf_hex_to_int(segmented_data [0] :: STRING)) AS gasAmount,
|
||||
TRY_TO_NUMBER(utils.udf_hex_to_int(segmented_data [1] :: STRING)) AS payment,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
@ -133,10 +124,7 @@ sent_transfer_remote AS (
|
||||
CONCAT('0x', SUBSTR(topics [2] :: STRING, 27, 40)) AS recipient,
|
||||
-- actual recipient
|
||||
TRY_TO_NUMBER(utils.udf_hex_to_int(DATA :: STRING)) AS amount,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
@ -165,7 +153,7 @@ token_transfer AS (
|
||||
tx_hash,
|
||||
contract_address AS token_address
|
||||
FROM
|
||||
{{ ref('silver__transfers') }}
|
||||
{{ ref('core__ez_token_transfers') }}
|
||||
WHERE
|
||||
tx_hash IN (
|
||||
SELECT
|
||||
|
||||
@ -13,14 +13,8 @@ WITH oft_asset_contract_creation AS (
|
||||
block_timestamp,
|
||||
tx_hash,
|
||||
from_address AS oft_address,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
CASE
|
||||
WHEN trace_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS trace_succeeded,
|
||||
tx_succeeded,
|
||||
trace_succeeded,
|
||||
modified_timestamp
|
||||
FROM
|
||||
{{ ref('core__fact_traces') }}
|
||||
@ -57,14 +51,8 @@ oft_asset_base_token AS (
|
||||
tx_hash,
|
||||
from_address AS wrap_address,
|
||||
to_address AS underlying_address,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
CASE
|
||||
WHEN trace_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS trace_succeeded,
|
||||
tx_succeeded,
|
||||
trace_succeeded,
|
||||
modified_timestamp
|
||||
FROM
|
||||
{{ ref('core__fact_traces') }}
|
||||
|
||||
@ -27,12 +27,12 @@ WITH bridge_native AS (
|
||||
origin_from_address AS recipient,
|
||||
et.to_address AS bridge_address,
|
||||
trace_index,
|
||||
native_transfers_id,
|
||||
ez_native_transfers_id AS native_transfers_id,
|
||||
et.modified_timestamp
|
||||
FROM
|
||||
{{ ref('silver__native_transfers') }}
|
||||
{{ ref('core__ez_native_transfers') }}
|
||||
et
|
||||
INNER JOIN {{ ref('silver__transactions') }}
|
||||
INNER JOIN {{ ref('core__fact_transactions') }}
|
||||
tx
|
||||
ON et.block_number = tx.block_number
|
||||
AND et.tx_hash = tx.tx_hash
|
||||
|
||||
@ -36,10 +36,7 @@ WITH base_evt AS (
|
||||
CONCAT('0x', SUBSTR(topics [3] :: STRING, 27, 40)) AS revertableAddress,
|
||||
CONCAT('0x', SUBSTR(segmented_data [1] :: STRING, 25, 40)) AS to_address,
|
||||
CONCAT('0x', SUBSTR(segmented_data [3] :: STRING, 25, 40)) AS token,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
|
||||
@ -24,10 +24,7 @@ WITH base_evt AS (
|
||||
topics [3] :: STRING AS topic_3,
|
||||
DATA,
|
||||
regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
|
||||
@ -68,14 +68,18 @@ WITH swaps_base AS (
|
||||
WHEN quote_qty > 0 THEN base_token
|
||||
ELSE NULL
|
||||
END AS token_out,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
contract_address = '0xaaaaaaaaffe404ee9433eef0094b6382d81fb958' --CrocSwapDex
|
||||
AND topics [0] :: STRING = '0x5d7a6c346454f5c536b7f52655e780f6db27b15b489f80f2dbb288c9e4f366bd'
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
|
||||
@ -23,14 +23,18 @@ WITH created_pools AS (
|
||||
WHEN segmented_data [1] :: STRING = '000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' THEN '0x4300000000000000000000000000000000000004'
|
||||
ELSE CONCAT('0x', SUBSTR(segmented_data [1] :: STRING, 25, 40))
|
||||
END AS token1,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref ('silver__logs') }}
|
||||
{{ ref ('core__fact_event_logs') }}
|
||||
WHERE
|
||||
contract_address = LOWER('0x75cb3ec310d3d1e22637f79d61eab5d9abcd68bd') --XYKPoolFactory
|
||||
AND topics [0] :: STRING = '0x5f28326c23d3e7607ba7f55dcee451cc4dbb16e3f016b27f013c99fb1d7d4168' --PairCreated
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
|
||||
@ -18,14 +18,18 @@ WITH created_pools AS (
|
||||
LOWER(CONCAT('0x', SUBSTR(topics [1] :: STRING, 27, 40))) AS token0_address,
|
||||
LOWER(CONCAT('0x', SUBSTR(topics [2] :: STRING, 27, 40))) AS token1_address,
|
||||
CONCAT('0x', SUBSTR(segmented_data [0] :: STRING, 25, 40)) AS pool_address,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
topics [0] :: STRING = '0x91ccaa7a278130b65168c3a0c8d3bcae84cf5e43704342bd3ec0b59e59c036db'
|
||||
AND contract_address = '0xa87dbf5082af26c9a6ab2b854e378f704638cca5' --AlgebraFactory
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
@ -46,17 +50,21 @@ pool_info AS (
|
||||
topics [3] :: STRING AS topics_3,
|
||||
DATA,
|
||||
regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
topics [0] :: STRING IN (
|
||||
'0x98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c95',
|
||||
'0x598b9f043c813aa6be3426ca60d1c65d17256312890be5118dab55b0775ebe2a',
|
||||
'0x01413b1d5d4c359e9a0daa7909ecda165f6e8c51fe2ff529d74b22a5a7c02645'
|
||||
)
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
|
||||
@ -42,20 +42,24 @@ WITH swaps_base AS (
|
||||
CONCAT('0x', SUBSTR(topics [2] :: STRING, 27, 40)) AS tx_to,
|
||||
token0,
|
||||
token1,
|
||||
l._log_id,
|
||||
l._inserted_timestamp
|
||||
CONCAT(
|
||||
l.tx_hash :: STRING,
|
||||
'-',
|
||||
l.event_index :: STRING
|
||||
) AS _log_id,
|
||||
l.modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
l
|
||||
INNER JOIN {{ ref('silver_dex__bladeswap_pools') }}
|
||||
p
|
||||
ON p.pool_address = l.contract_address
|
||||
WHERE
|
||||
topics [0] :: STRING = '0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822'
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND l._inserted_timestamp >= (
|
||||
AND l.modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp) - INTERVAL '12 hours'
|
||||
FROM
|
||||
|
||||
@ -45,10 +45,14 @@ WITH swaps_base AS (
|
||||
pool_address,
|
||||
tick_spacing,
|
||||
fee,
|
||||
l._log_id,
|
||||
l._inserted_timestamp
|
||||
CONCAT(
|
||||
l.tx_hash :: STRING,
|
||||
'-',
|
||||
l.event_index :: STRING
|
||||
) AS _log_id,
|
||||
l.modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
l
|
||||
INNER JOIN {{ ref('silver_dex__bladeswap_pools_v3') }}
|
||||
p
|
||||
@ -56,10 +60,10 @@ WITH swaps_base AS (
|
||||
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._inserted_timestamp >= (
|
||||
AND l.modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(
|
||||
_inserted_timestamp
|
||||
|
||||
@ -22,14 +22,18 @@ WITH created_pools AS (
|
||||
segmented_data [1] :: STRING
|
||||
)
|
||||
) AS pool_id,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref ('silver__logs') }}
|
||||
{{ ref ('core__fact_event_logs') }}
|
||||
WHERE
|
||||
contract_address = LOWER('0x9cc1599d4378ea41d444642d18aa9be44f709ffd') --BlasterswapV2Factory
|
||||
AND topics [0] :: STRING = '0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9' --PairCreated
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
|
||||
@ -30,14 +30,18 @@ WITH created_pools AS (
|
||||
)
|
||||
) AS tick_spacing,
|
||||
CONCAT('0x', SUBSTR(segmented_data [1] :: STRING, 25, 40)) AS pool_address,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
topics [0] :: STRING = '0x783cca1c0412dd0d695e784568c96da2e9c22ff989357a2e8b1d9b2b4e6b7118'
|
||||
AND contract_address = '0x1a8027625c830aac43ad82a3f7cd6d5fdce89d78' --BlasterSwapV3Factory
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
@ -59,13 +63,17 @@ initial_info AS (
|
||||
1.0001,
|
||||
init_tick
|
||||
) AS init_price_1_0_unadj,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
topics [0] :: STRING = '0x98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c95'
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
|
||||
@ -42,20 +42,24 @@ WITH swaps_base AS (
|
||||
CONCAT('0x', SUBSTR(topics [2] :: STRING, 27, 40)) AS tx_to,
|
||||
token0,
|
||||
token1,
|
||||
l._log_id,
|
||||
l._inserted_timestamp
|
||||
CONCAT(
|
||||
l.tx_hash :: STRING,
|
||||
'-',
|
||||
l.event_index :: STRING
|
||||
) AS _log_id,
|
||||
l.modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
l
|
||||
INNER JOIN {{ ref('silver_dex__blaster_pools') }}
|
||||
p
|
||||
ON p.pool_address = l.contract_address
|
||||
WHERE
|
||||
topics [0] :: STRING = '0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822'
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND l._inserted_timestamp >= (
|
||||
AND l.modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp) - INTERVAL '12 hours'
|
||||
FROM
|
||||
|
||||
@ -45,10 +45,14 @@ WITH swaps_base AS (
|
||||
pool_address,
|
||||
tick_spacing,
|
||||
fee,
|
||||
l._log_id,
|
||||
l._inserted_timestamp
|
||||
CONCAT(
|
||||
l.tx_hash :: STRING,
|
||||
'-',
|
||||
l.event_index :: STRING
|
||||
) AS _log_id,
|
||||
l.modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
l
|
||||
INNER JOIN {{ ref('silver_dex__blaster_pools_v3') }}
|
||||
p
|
||||
@ -56,10 +60,10 @@ WITH swaps_base AS (
|
||||
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._inserted_timestamp >= (
|
||||
AND l.modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(
|
||||
_inserted_timestamp
|
||||
|
||||
@ -18,14 +18,18 @@ WITH created_pools AS (
|
||||
LOWER(CONCAT('0x', SUBSTR(topics [1] :: STRING, 27, 40))) AS token0_address,
|
||||
LOWER(CONCAT('0x', SUBSTR(topics [2] :: STRING, 27, 40))) AS token1_address,
|
||||
CONCAT('0x', SUBSTR(segmented_data [0] :: STRING, 25, 40)) AS pool_address,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
topics [0] :: STRING = '0x91ccaa7a278130b65168c3a0c8d3bcae84cf5e43704342bd3ec0b59e59c036db'
|
||||
AND contract_address = '0x7a44cd060afc1b6f4c80a2b9b37f4473e74e25df' --Fenix Finance : Algebra Factory
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
@ -46,17 +50,21 @@ pool_info AS (
|
||||
topics [3] :: STRING AS topics_3,
|
||||
DATA,
|
||||
regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
topics [0] :: STRING IN (
|
||||
'0x98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c95',
|
||||
'0x598b9f043c813aa6be3426ca60d1c65d17256312890be5118dab55b0775ebe2a',
|
||||
'0x01413b1d5d4c359e9a0daa7909ecda165f6e8c51fe2ff529d74b22a5a7c02645'
|
||||
)
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
|
||||
@ -45,10 +45,14 @@ WITH swaps_base AS (
|
||||
pool_address,
|
||||
tick_spacing,
|
||||
fee,
|
||||
l._log_id,
|
||||
l._inserted_timestamp
|
||||
CONCAT(
|
||||
l.tx_hash :: STRING,
|
||||
'-',
|
||||
l.event_index :: STRING
|
||||
) AS _log_id,
|
||||
l.modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
l
|
||||
INNER JOIN {{ ref('silver_dex__fenix_pools_v3') }}
|
||||
p
|
||||
@ -56,10 +60,10 @@ WITH swaps_base AS (
|
||||
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._inserted_timestamp >= (
|
||||
AND l.modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(
|
||||
_inserted_timestamp
|
||||
@ -67,7 +71,7 @@ AND l._inserted_timestamp >= (
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
AND l._inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
|
||||
AND l.modified_timestamp >= SYSDATE() - INTERVAL '7 day'
|
||||
{% endif %}
|
||||
)
|
||||
SELECT
|
||||
|
||||
@ -22,14 +22,18 @@ WITH created_pools AS (
|
||||
segmented_data [1] :: STRING
|
||||
)
|
||||
) AS pool_id,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref ('silver__logs') }}
|
||||
{{ ref ('core__fact_event_logs') }}
|
||||
WHERE
|
||||
contract_address = LOWER('0x24f5ac9a706de0cf795a8193f6ab3966b14ecfe6') --SwapV2Factory
|
||||
AND topics [0] :: STRING = '0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9' --PairCreated
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
|
||||
@ -16,14 +16,18 @@ SELECT
|
||||
utils.udf_hex_to_int(
|
||||
segmented_data [1] :: STRING
|
||||
) :: INTEGER AS asset_id,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash,
|
||||
'-',
|
||||
event_index
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
contract_address = '0x455b20131d59f01d082df1225154fda813e8cee9' --FewFactory
|
||||
AND topics [0] :: STRING = '0x940398321949af993516f7d144a2b9f43100b1de59365ba376e2b458d840c091' --WrappedTokenCreated
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
|
||||
@ -26,14 +26,18 @@ WITH created_pools AS (
|
||||
segmented_data [0] :: STRING
|
||||
) :: INTEGER AS tick_spacing,
|
||||
CONCAT('0x', SUBSTR(segmented_data [1] :: STRING, 25, 40)) AS pool_address,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
topics [0] :: STRING = '0x783cca1c0412dd0d695e784568c96da2e9c22ff989357a2e8b1d9b2b4e6b7118'
|
||||
AND contract_address = '0x890509fab3dd11d4ff57d8471b5eac74687e4c75' --Ring/UniswapV3Factory
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
@ -55,13 +59,17 @@ initial_info AS (
|
||||
1.0001,
|
||||
init_tick
|
||||
) AS init_price_1_0_unadj,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
topics [0] :: STRING = '0x98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c95'
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
|
||||
@ -42,20 +42,24 @@ WITH swaps_base AS (
|
||||
CONCAT('0x', SUBSTR(topics [2] :: STRING, 27, 40)) AS tx_to,
|
||||
token0,
|
||||
token1,
|
||||
l._log_id,
|
||||
l._inserted_timestamp
|
||||
CONCAT(
|
||||
l.tx_hash :: STRING,
|
||||
'-',
|
||||
l.event_index :: STRING
|
||||
) AS _log_id,
|
||||
l.modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
l
|
||||
INNER JOIN {{ ref('silver_dex__ring_pools') }}
|
||||
p
|
||||
ON p.pool_address = l.contract_address
|
||||
WHERE
|
||||
topics [0] :: STRING = '0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822'
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND l._inserted_timestamp >= (
|
||||
AND l.modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp) - INTERVAL '12 hours'
|
||||
FROM
|
||||
|
||||
@ -45,10 +45,14 @@ WITH swaps_base AS (
|
||||
pool_address,
|
||||
tick_spacing,
|
||||
fee,
|
||||
l._log_id,
|
||||
l._inserted_timestamp
|
||||
CONCAT(
|
||||
l.tx_hash :: STRING,
|
||||
'-',
|
||||
l.event_index :: STRING
|
||||
) AS _log_id,
|
||||
l.modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
l
|
||||
INNER JOIN {{ ref('silver_dex__ring_pools_v3') }}
|
||||
p
|
||||
@ -56,10 +60,10 @@ WITH swaps_base AS (
|
||||
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._inserted_timestamp >= (
|
||||
AND l.modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(
|
||||
_inserted_timestamp
|
||||
|
||||
@ -22,14 +22,18 @@ WITH created_pools AS (
|
||||
segmented_data [1] :: STRING
|
||||
)
|
||||
) AS pool_id,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref ('silver__logs') }}
|
||||
{{ ref ('core__fact_event_logs') }}
|
||||
WHERE
|
||||
contract_address = LOWER('0x42fa929fc636e657ac568c0b5cf38e203b67ac2b') --Sushi/UniswapV2Factory
|
||||
AND topics [0] :: STRING = '0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9' --PairCreated
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
|
||||
@ -26,14 +26,18 @@ WITH created_pools AS (
|
||||
segmented_data [0] :: STRING
|
||||
) :: INTEGER AS tick_spacing,
|
||||
CONCAT('0x', SUBSTR(segmented_data [1] :: STRING, 25, 40)) AS pool_address,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
topics [0] :: STRING = '0x783cca1c0412dd0d695e784568c96da2e9c22ff989357a2e8b1d9b2b4e6b7118'
|
||||
AND contract_address = '0x7680d4b43f3d1d54d6cfeeb2169463bfa7a6cf0d' --Sushi/UniswapV3Factory
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
@ -55,13 +59,17 @@ initial_info AS (
|
||||
1.0001,
|
||||
init_tick
|
||||
) AS init_price_1_0_unadj,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
topics [0] :: STRING = '0x98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c95'
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
|
||||
@ -42,20 +42,24 @@ WITH swaps_base AS (
|
||||
CONCAT('0x', SUBSTR(topics [2] :: STRING, 27, 40)) AS tx_to,
|
||||
token0,
|
||||
token1,
|
||||
l._log_id,
|
||||
l._inserted_timestamp
|
||||
CONCAT(
|
||||
l.tx_hash :: STRING,
|
||||
'-',
|
||||
l.event_index :: STRING
|
||||
) AS _log_id,
|
||||
l.modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
l
|
||||
INNER JOIN {{ ref('silver_dex__sushi_pools') }}
|
||||
p
|
||||
ON p.pool_address = l.contract_address
|
||||
WHERE
|
||||
topics [0] :: STRING = '0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822'
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND l._inserted_timestamp >= (
|
||||
AND l.modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp) - INTERVAL '12 hours'
|
||||
FROM
|
||||
|
||||
@ -45,10 +45,14 @@ WITH swaps_base AS (
|
||||
pool_address,
|
||||
tick_spacing,
|
||||
fee,
|
||||
l._log_id,
|
||||
l._inserted_timestamp
|
||||
CONCAT(
|
||||
l.tx_hash :: STRING,
|
||||
'-',
|
||||
l.event_index :: STRING
|
||||
) AS _log_id,
|
||||
l.modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
l
|
||||
INNER JOIN {{ ref('silver_dex__sushi_pools_v3') }}
|
||||
p
|
||||
@ -56,10 +60,10 @@ WITH swaps_base AS (
|
||||
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._inserted_timestamp >= (
|
||||
AND l.modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(
|
||||
_inserted_timestamp
|
||||
|
||||
@ -22,14 +22,18 @@ WITH created_pools AS (
|
||||
segmented_data [1] :: STRING
|
||||
)
|
||||
) AS pool_id,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref ('silver__logs') }}
|
||||
{{ ref ('core__fact_event_logs') }}
|
||||
WHERE
|
||||
contract_address = LOWER('0xb4a7d971d0adea1c73198c97d7ab3f9ce4aafa13') --Thruster: ThrusterRouter (0.30%)
|
||||
AND topics [0] :: STRING = '0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9' --PairCreated
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
|
||||
@ -26,14 +26,18 @@ WITH created_pools AS (
|
||||
segmented_data [0] :: STRING
|
||||
) :: INTEGER AS tick_spacing,
|
||||
CONCAT('0x', SUBSTR(segmented_data [1] :: STRING, 25, 40)) AS pool_address,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
topics [0] :: STRING = '0x783cca1c0412dd0d695e784568c96da2e9c22ff989357a2e8b1d9b2b4e6b7118'
|
||||
AND contract_address = '0x71b08f13b3c3af35aadeb3949afeb1ded1016127' --ThrusterPoolFactory
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
@ -55,13 +59,17 @@ initial_info AS (
|
||||
1.0001,
|
||||
init_tick
|
||||
) AS init_price_1_0_unadj,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
topics [0] :: STRING = '0x98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c95'
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
|
||||
@ -42,20 +42,24 @@ WITH swaps_base AS (
|
||||
CONCAT('0x', SUBSTR(topics [2] :: STRING, 27, 40)) AS tx_to,
|
||||
token0,
|
||||
token1,
|
||||
l._log_id,
|
||||
l._inserted_timestamp
|
||||
CONCAT(
|
||||
l.tx_hash :: STRING,
|
||||
'-',
|
||||
l.event_index :: STRING
|
||||
) AS _log_id,
|
||||
l.modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
l
|
||||
INNER JOIN {{ ref('silver_dex__thruster_pools') }}
|
||||
p
|
||||
ON p.pool_address = l.contract_address
|
||||
WHERE
|
||||
topics [0] :: STRING = '0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822'
|
||||
AND tx_status = 'SUCCESS'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND l._inserted_timestamp >= (
|
||||
AND l.modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp) - INTERVAL '12 hours'
|
||||
FROM
|
||||
|
||||
@ -45,10 +45,14 @@ WITH swaps_base AS (
|
||||
pool_address,
|
||||
tick_spacing,
|
||||
fee,
|
||||
l._log_id,
|
||||
l._inserted_timestamp
|
||||
CONCAT(
|
||||
l.tx_hash :: STRING,
|
||||
'-',
|
||||
l.event_index :: STRING
|
||||
) AS _log_id,
|
||||
l.modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
l
|
||||
INNER JOIN {{ ref('silver_dex__thruster_pools_v3') }}
|
||||
p
|
||||
@ -56,10 +60,10 @@ WITH swaps_base AS (
|
||||
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._inserted_timestamp >= (
|
||||
AND l.modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(
|
||||
_inserted_timestamp
|
||||
|
||||
@ -44,16 +44,17 @@ underlying AS (
|
||||
tx_hash,
|
||||
block_timestamp,
|
||||
block_number,
|
||||
CASE
|
||||
WHEN trace_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS trace_succeeded,
|
||||
trace_succeeded,
|
||||
from_address AS token_address,
|
||||
to_address AS underlying_asset_address
|
||||
FROM
|
||||
{{ ref('core__fact_traces') }}
|
||||
WHERE
|
||||
identifier = 'CALL_0_1'
|
||||
CONCAT(
|
||||
TYPE,
|
||||
'_',
|
||||
trace_address
|
||||
) = 'CALL_0_1'
|
||||
AND LEFT(
|
||||
input,
|
||||
10
|
||||
@ -70,14 +71,15 @@ unwrapped AS (
|
||||
SELECT
|
||||
from_address AS underlying_asset_address,
|
||||
to_address AS underlying_unwrap_address,
|
||||
CASE
|
||||
WHEN trace_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS trace_succeeded
|
||||
trace_succeeded
|
||||
FROM
|
||||
{{ ref('core__fact_traces') }}
|
||||
WHERE
|
||||
identifier = 'CALL_0_0'
|
||||
CONCAT(
|
||||
TYPE,
|
||||
'_',
|
||||
trace_address
|
||||
) = 'CALL_0_0'
|
||||
AND LEFT(
|
||||
input,
|
||||
10
|
||||
|
||||
@ -48,10 +48,7 @@ init_borrows AS (
|
||||
contract_address AS token,
|
||||
'INIT Capital' AS platform,
|
||||
modified_timestamp,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
@ -121,10 +118,7 @@ native_transfer AS (
|
||||
to_address,
|
||||
value_precise_raw AS eth_value,
|
||||
'WETH' AS eth_symbol,
|
||||
CASE
|
||||
WHEN trace_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS trace_succeeded,
|
||||
trace_succeeded,
|
||||
18 AS eth_decimals,
|
||||
'0x4300000000000000000000000000000000000004' AS eth_address
|
||||
FROM
|
||||
|
||||
@ -50,10 +50,7 @@ init_deposits AS (
|
||||
-- receipt token
|
||||
'INIT Capital' AS platform,
|
||||
modified_timestamp,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
@ -226,10 +223,7 @@ native_transfer AS (
|
||||
to_address,
|
||||
value_precise_raw AS eth_value,
|
||||
'WETH' AS eth_symbol,
|
||||
CASE
|
||||
WHEN trace_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS trace_succeeded,
|
||||
trace_succeeded,
|
||||
18 AS eth_decimals,
|
||||
'0x4300000000000000000000000000000000000004' AS eth_address
|
||||
FROM
|
||||
|
||||
@ -51,10 +51,7 @@ init_liquidations AS (
|
||||
contract_address AS token,
|
||||
'INIT Capital' AS platform,
|
||||
modified_timestamp,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
@ -132,10 +129,7 @@ position_owner AS (
|
||||
utils.udf_hex_to_int(
|
||||
topics [2] :: STRING
|
||||
) :: STRING AS posId, -- using string as it handles better than float
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
|
||||
@ -51,10 +51,7 @@ init_repayments AS (
|
||||
contract_address AS token,
|
||||
'INIT Capital' AS platform,
|
||||
modified_timestamp,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
@ -84,10 +81,7 @@ native_transfer AS (
|
||||
to_address AS wrapped_address,
|
||||
value_precise_raw AS eth_value,
|
||||
'WETH' AS eth_symbol,
|
||||
CASE
|
||||
WHEN trace_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS trace_succeeded,
|
||||
trace_succeeded,
|
||||
18 AS eth_decimals,
|
||||
'0x4300000000000000000000000000000000000004' AS eth_address
|
||||
FROM
|
||||
|
||||
@ -49,10 +49,7 @@ init_redemption AS (
|
||||
) :: FLOAT AS redeemed_token_raw,
|
||||
'INIT Capital' AS platform,
|
||||
modified_timestamp,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
@ -232,10 +229,7 @@ native_transfer AS (
|
||||
from_address AS wrapped_address,
|
||||
to_address,
|
||||
value_precise_raw AS eth_value,
|
||||
CASE
|
||||
WHEN trace_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS trace_succeeded,
|
||||
trace_succeeded,
|
||||
'WETH' AS eth_symbol,
|
||||
18 AS eth_decimals,
|
||||
'0x4300000000000000000000000000000000000004' AS eth_address
|
||||
|
||||
@ -78,10 +78,7 @@ tx_pull AS (
|
||||
topics,
|
||||
DATA,
|
||||
event_removed,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
@ -127,14 +124,14 @@ trace_pull AS (
|
||||
input,
|
||||
output,
|
||||
TYPE,
|
||||
identifier,
|
||||
CONCAT(
|
||||
TYPE,
|
||||
'_',
|
||||
trace_address
|
||||
) AS identifier,
|
||||
DATA,
|
||||
tx_status,
|
||||
sub_traces,
|
||||
CASE
|
||||
WHEN trace_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS trace_succeeded,
|
||||
trace_succeeded,
|
||||
error_reason,
|
||||
trace_index,
|
||||
fact_traces_id,
|
||||
@ -250,10 +247,7 @@ logs_pull AS (
|
||||
regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
|
||||
CONCAT('0x', SUBSTR(segmented_data [0], 25, 40)) AS contract_address,
|
||||
event_removed,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
@ -287,10 +281,7 @@ get_underlying AS (
|
||||
topics,
|
||||
DATA,
|
||||
event_removed,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
|
||||
@ -43,10 +43,7 @@ juice_borrows AS (
|
||||
contract_address AS pool_address,
|
||||
'Juice' AS platform,
|
||||
modified_timestamp,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
|
||||
@ -38,10 +38,7 @@ deposit_logs AS (
|
||||
topics,
|
||||
DATA,
|
||||
event_removed,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
|
||||
@ -51,10 +51,7 @@ juice_liquidations AS (
|
||||
) :: INTEGER AS debtamountneeded_raw,
|
||||
'Juice' AS platform,
|
||||
l.modified_timestamp,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
@ -87,10 +84,7 @@ token_transfer AS (
|
||||
tx_hash,
|
||||
utils.udf_hex_to_int(DATA) AS seizeTokens_raw,
|
||||
event_index,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
@ -130,10 +124,7 @@ debt_transfer AS (
|
||||
debt_name,
|
||||
debt_address AS debt_token,
|
||||
debt_symbol AS debt_token_symbol,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
|
||||
@ -43,10 +43,7 @@ juice_repayments AS (
|
||||
) :: INTEGER AS repayed_amount_raw,
|
||||
'Juice' AS platform,
|
||||
modified_timestamp,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
|
||||
@ -37,12 +37,8 @@ withdraw_logs AS (
|
||||
contract_address,
|
||||
DATA,
|
||||
topics,
|
||||
tx_status,
|
||||
modified_timestamp,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
|
||||
@ -14,10 +14,7 @@ WITH log_pull_1 AS (
|
||||
block_timestamp,
|
||||
contract_address,
|
||||
modified_timestamp,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
|
||||
@ -44,10 +44,7 @@ orbit_borrows AS (
|
||||
contract_address AS token,
|
||||
'Orbit' AS platform,
|
||||
modified_timestamp,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
|
||||
@ -41,10 +41,7 @@ orbit_deposits AS (
|
||||
CONCAT('0x', SUBSTR(segmented_data [0] :: STRING, 25, 40)) AS supplier,
|
||||
'Orbit' AS platform,
|
||||
modified_timestamp,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
|
||||
@ -43,10 +43,7 @@ orbit_liquidations AS (
|
||||
CONCAT('0x', SUBSTR(segmented_data [3] :: STRING, 25, 40)) AS tokenCollateral,
|
||||
'Orbit' AS platform,
|
||||
modified_timestamp,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
|
||||
@ -38,10 +38,7 @@ orbit_repayments AS (
|
||||
) :: INTEGER AS repayed_amount_raw,
|
||||
'Orbit' AS platform,
|
||||
modified_timestamp,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
|
||||
@ -41,10 +41,7 @@ orbit_redemptions AS (
|
||||
CONCAT('0x', SUBSTR(segmented_data [0] :: STRING, 25, 40)) AS redeemer,
|
||||
'Orbit' AS platform,
|
||||
modified_timestamp,
|
||||
CASE
|
||||
WHEN tx_status = 'SUCCESS' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS tx_succeeded,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
|
||||
@ -31,10 +31,14 @@ WITH logs_pull AS (
|
||||
utils.udf_hex_to_int(
|
||||
segmented_data [1] :: STRING
|
||||
) :: INT AS product_id,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
topics [0] :: STRING = '0xfe53084a731040f869d38b1dcd00fbbdbc14e10d7d739160559d77f5bc80cf05'
|
||||
AND contract_address = '0xc748532c202828969b2ee68e0f8487e69cc1d800' --clearing house
|
||||
|
||||
@ -15,10 +15,14 @@ WITH logs_pull AS (
|
||||
tx_hash,
|
||||
block_number,
|
||||
block_timestamp,
|
||||
_inserted_timestamp,
|
||||
_log_id
|
||||
modified_timestamp AS _inserted_timestamp,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
topics [0] :: STRING IN (
|
||||
'0x3286b0394bf1350245290b7226c92ed186bd716f28938e62dbb895298f018172',
|
||||
|
||||
@ -19,9 +19,26 @@ WITH health_groups AS (
|
||||
),
|
||||
logs AS (
|
||||
SELECT
|
||||
*
|
||||
block_number,
|
||||
block_timestamp,
|
||||
tx_hash,
|
||||
event_index,
|
||||
contract_address,
|
||||
topics,
|
||||
DATA,
|
||||
event_removed,
|
||||
origin_from_address,
|
||||
origin_to_address,
|
||||
origin_function_signature,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
topics [0] :: STRING = '0x494f937f5cc892f798248aa831acfb4ad7c4bf35edd8498c5fb431ce1e38b035'
|
||||
AND contract_address = LOWER('0xC748532C202828969b2Ee68E0F8487E69cC1d800')
|
||||
|
||||
@ -24,9 +24,26 @@ WITH blitz_products AS (
|
||||
),
|
||||
logs AS (
|
||||
SELECT
|
||||
*
|
||||
block_number,
|
||||
block_timestamp,
|
||||
tx_hash,
|
||||
event_index,
|
||||
contract_address,
|
||||
topics,
|
||||
DATA,
|
||||
event_removed,
|
||||
origin_from_address,
|
||||
origin_to_address,
|
||||
origin_function_signature,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
topics [0] :: STRING = '0x7c57459d6f4f0fb2fc5b1e298c8c0eb238422944964aa1e249eaa78747f0cca9'
|
||||
AND contract_address = LOWER('0x6983B339922B5B35994B038e6e74ddd115e292f1')
|
||||
|
||||
@ -25,9 +25,26 @@ WITH blitz_products AS (
|
||||
),
|
||||
logs AS (
|
||||
SELECT
|
||||
*
|
||||
block_number,
|
||||
block_timestamp,
|
||||
tx_hash,
|
||||
event_index,
|
||||
contract_address,
|
||||
topics,
|
||||
DATA,
|
||||
event_removed,
|
||||
origin_from_address,
|
||||
origin_to_address,
|
||||
origin_function_signature,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
topics [0] :: STRING = '0x7c57459d6f4f0fb2fc5b1e298c8c0eb238422944964aa1e249eaa78747f0cca9'
|
||||
AND contract_address = LOWER('0x6983B339922B5B35994B038e6e74ddd115e292f1')
|
||||
|
||||
@ -14,9 +14,9 @@
|
||||
SELECT
|
||||
MIN(DATE_TRUNC('hour', block_timestamp)) block_timestamp_hour
|
||||
FROM
|
||||
{{ ref('silver__transactions') }}
|
||||
{{ ref('core__fact_transactions') }}
|
||||
WHERE
|
||||
_inserted_timestamp >= (
|
||||
modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp)
|
||||
FROM
|
||||
@ -40,12 +40,12 @@ SELECT
|
||||
) AS transaction_count,
|
||||
COUNT(
|
||||
DISTINCT CASE
|
||||
WHEN tx_success THEN tx_hash
|
||||
WHEN tx_succeeded THEN tx_hash
|
||||
END
|
||||
) AS transaction_count_success,
|
||||
COUNT(
|
||||
DISTINCT CASE
|
||||
WHEN NOT tx_success THEN tx_hash
|
||||
WHEN NOT tx_succeeded THEN tx_hash
|
||||
END
|
||||
) AS transaction_count_failed,
|
||||
COUNT(
|
||||
@ -55,7 +55,7 @@ SELECT
|
||||
DISTINCT to_address
|
||||
) AS unique_to_count,
|
||||
SUM(tx_fee_precise) AS total_fees,
|
||||
MAX(_inserted_timestamp) AS _inserted_timestamp,
|
||||
MAX(modified_timestamp) AS _inserted_timestamp,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['block_timestamp_hour']
|
||||
) }} AS core_metrics_hourly_id,
|
||||
@ -63,7 +63,7 @@ SELECT
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
{{ ref('silver__transactions') }}
|
||||
{{ ref('core__fact_transactions') }}
|
||||
WHERE
|
||||
block_timestamp_hour < DATE_TRUNC(
|
||||
'hour',
|
||||
@ -77,4 +77,4 @@ AND DATE_TRUNC(
|
||||
) >= '{{ min_block_timestamp_hour }}'
|
||||
{% endif %}
|
||||
GROUP BY
|
||||
1
|
||||
1
|
||||
@ -50,7 +50,7 @@ candidate_logs AS (
|
||||
INNER JOIN {{ ref('core__fact_event_logs') }}
|
||||
l USING (block_number)
|
||||
WHERE
|
||||
l.tx_status = 'SUCCESS'
|
||||
l.tx_succeeded
|
||||
AND l.inserted_timestamp :: DATE >= DATEADD('day', -5, SYSDATE())
|
||||
)
|
||||
SELECT
|
||||
|
||||
Loading…
Reference in New Issue
Block a user