An 5338/avax dexalot standardization (#302)

* compile

* dexalot

* curated models

* updates

* refs

* seaport

* seaport

* nft

* mega

* logs

* timestamps

* predicate

* warehouse

* add

* predicate

* updates

---------

Co-authored-by: sam <sam@flipsidecrypto.com>
This commit is contained in:
Austin 2025-02-12 07:57:53 -05:00 committed by GitHub
parent 01c4902d73
commit 0836ea404a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
126 changed files with 3304 additions and 1140 deletions

View File

@ -22,6 +22,7 @@ on:
- DBT
- DBT_CLOUD
- DBT_EMERGENCY
- DBT_MEGA
default: DBT
dbt_command:
type: string

View 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 %}

View File

@ -1,14 +1,22 @@
{% 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('0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7') -- WAVAX
AND l.topics [0] :: STRING = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' -- Transfer

View File

@ -10,21 +10,27 @@
SELECT
A.block_number AS block_number,
hash AS block_hash,
block_timestamp,
'mainnet' AS network,
'dexalot' AS blockchain,
tx_count,
size,
miner,
extra_data,
parent_hash,
gas_used,
gas_limit,
base_fee_per_gas,
difficulty,
total_difficulty,
extra_data,
gas_limit,
gas_used,
HASH,
parent_hash,
receipts_root,
uncles as uncle_blocks,
nonce,
number,
sha3_uncles,
SIZE,
uncles AS uncle_blocks,
receipts_root,
state_root,
transactions_root,
logs_bloom,
OBJECT_CONSTRUCT(
'baseFeePerGas',
base_fee_per_gas,
@ -68,6 +74,8 @@ SELECT
blocks_id AS fact_blocks_id,
inserted_timestamp,
modified_timestamp,
'dexalot' AS blockchain,
hash
FROM
{{ ref('silver_dexalot__blocks') }} A

View File

@ -1,46 +1,62 @@
version: 2
models:
- name: dexalot__fact_blocks
description: '{{ doc("dexalot_blocks_table_doc") }}'
description: '{{ doc("evm_blocks_table_doc") }}'
columns:
- name: BLOCK_NUMBER
description: '{{ doc("dexalot_block_number") }}'
description: '{{ doc("evm_block_number") }}'
- name: BLOCK_TIMESTAMP
description: '{{ doc("dexalot_block_timestamp") }}'
description: '{{ doc("evm_block_timestamp") }}'
- name: NETWORK
description: '{{ doc("dexalot_network") }}'
description: '{{ doc("evm_network") }}'
- name: BLOCKCHAIN
description: '{{ doc("dexalot_blockchain") }}'
description: '{{ doc("evm_column_deprecation_notice_blockchain") }}'
- name: MINER
description: '{{ doc("evm_miner") }}'
- name: NONCE
description: '{{ doc("evm_blocks_nonce") }}'
- name: TX_COUNT
description: '{{ doc("dexalot_tx_count") }}'
description: '{{ doc("evm_tx_count") }}'
- name: DIFFICULTY
description: '{{ doc("dexalot_difficulty") }}'
description: '{{ doc("evm_difficulty") }}'
- name: TOTAL_DIFFICULTY
description: '{{ doc("dexalot_total_difficulty") }}'
description: '{{ doc("evm_total_difficulty") }}'
- name: EXTRA_DATA
description: '{{ doc("dexalot_extra_data") }}'
description: '{{ doc("evm_extra_data") }}'
- name: GAS_LIMIT
description: '{{ doc("dexalot_gas_limit") }}'
description: '{{ doc("evm_gas_limit") }}'
- name: GAS_USED
description: '{{ doc("dexalot_gas_used") }}'
description: '{{ doc("evm_gas_used") }}'
- name: BASE_FEE_PER_GAS
description: '{{ doc("evm_base_fee_per_gas") }}'
- name: BLOCK_HASH
description: '{{ doc("evm_blocks_hash") }}'
- name: HASH
description: '{{ doc("dexalot_blocks_hash") }}'
description: '{{ doc("evm_column_deprecation_notice_hash") }}'
- name: PARENT_HASH
description: '{{ doc("dexalot_parent_hash") }}'
description: '{{ doc("evm_parent_hash") }}'
- name: RECEIPTS_ROOT
description: '{{ doc("dexalot_receipts_root") }}'
description: '{{ doc("evm_receipts_root") }}'
- name: SHA3_UNCLES
description: '{{ doc("dexalot_sha3_uncles") }}'
description: '{{ doc("evm_sha3_uncles") }}'
- name: SIZE
description: '{{ doc("dexalot_size") }}'
description: '{{ doc("evm_size") }}'
- name: UNCLE_BLOCKS
description: '{{ doc("dexalot_uncle_blocks") }}'
description: '{{ doc("evm_uncle_blocks") }}'
- 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: BLOCK_HEADER_JSON
description: '{{ doc("dexalot_block_header_json") }}'
description: '{{ doc("evm_column_deprecation_notice_block_header_json") }}'
- name: BASE_FEE_PER_GAS
description: '{{ doc("evm_base_fee_per_gas") }}'
- 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") }}'

View File

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

View File

@ -1,38 +1,48 @@
version: 2
models:
- name: dexalot__fact_event_logs
description: '{{ doc("dexalot_logs_table_doc") }}'
description: '{{ doc("evm_logs_table_doc") }}'
columns:
- name: BLOCK_NUMBER
description: '{{ doc("dexalot_block_number") }}'
description: '{{ doc("evm_block_number") }}'
- name: BLOCK_TIMESTAMP
description: '{{ doc("dexalot_block_timestamp") }}'
description: '{{ doc("evm_block_timestamp") }}'
- name: TX_HASH
description: '{{ doc("dexalot_logs_tx_hash") }}'
description: '{{ doc("evm_logs_tx_hash") }}'
- name: EVENT_INDEX
description: '{{ doc("dexalot_event_index") }}'
description: '{{ doc("evm_event_index") }}'
- name: CONTRACT_ADDRESS
description: '{{ doc("dexalot_logs_contract_address") }}'
description: '{{ doc("evm_logs_contract_address") }}'
- name: TOPICS
description: '{{ doc("dexalot_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("dexalot_logs_data") }}'
description: '{{ doc("evm_logs_data") }}'
- name: EVENT_REMOVED
description: '{{ doc("dexalot_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("evm_column_deprecation_notice_tx_status") }}'
- name: TX_SUCCEEDED
description: '{{ doc("dexalot_tx_status") }}'
description: '{{ doc("evm_tx_succeeded") }}'
- name: ORIGIN_FUNCTION_SIGNATURE
description: '{{ doc("dexalot_origin_sig") }}'
description: '{{ doc("evm_origin_sig") }}'
- name: ORIGIN_FROM_ADDRESS
description: '{{ doc("dexalot_origin_from") }}'
description: '{{ doc("evm_origin_from") }}'
- name: ORIGIN_TO_ADDRESS
description: '{{ doc("dexalot_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") }}'

View File

@ -10,18 +10,20 @@
SELECT
block_number,
block_timestamp,
block_hash,
tx_hash,
nonce,
POSITION,
origin_function_signature,
from_address,
to_address,
VALUE,
origin_function_signature,
value,
value_precise_raw,
value_precise,
tx_fee,
tx_fee_precise,
tx_status AS tx_succeeded,
tx_type,
nonce,
position as tx_position,
input_data,
gas_price,
effective_gas_price,
gas AS gas_limit,
@ -29,14 +31,15 @@ SELECT
cumulative_gas_used,
max_fee_per_gas,
max_priority_fee_per_gas,
input_data,
tx_status AS tx_succeeded,
r,
s,
v,
transactions_id AS fact_transactions_id,
inserted_timestamp,
modified_timestamp
modified_timestamp,
block_hash,
-- deprecate
position -- deprecate
FROM
{{ ref('silver_dexalot__transactions') }}

View File

@ -9,12 +9,14 @@ models:
- name: BLOCK_TIMESTAMP
description: '{{ doc("dexalot_block_timestamp") }}'
- name: BLOCK_HASH
description: '{{ doc("dexalot_tx_block_hash") }}'
description: '{{ doc("evm_column_deprecation_notice_block_hash") }}'
- name: TX_HASH
description: '{{ doc("dexalot_tx_hash") }}'
- name: NONCE
description: '{{ doc("dexalot_tx_nonce") }}'
- name: POSITION
description: '{{ doc("evm_column_deprecation_notice_position") }}'
- name: TX_POSITION
description: '{{ doc("dexalot_tx_position") }}'
- name: FROM_ADDRESS
description: '{{ doc("dexalot_from_address") }}'

View File

@ -0,0 +1,143 @@
{% 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 %}

View 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 %}

View File

@ -0,0 +1,83 @@
{% 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 %}

View File

@ -0,0 +1,203 @@
{% 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_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 %}
{% 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_decimal %}
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_tokenid %}
This column is being deprecated 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 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 deprecated for standardization purposes. Please update your queries to use the `contract_address` column instead by March 10, 2025.
{% enddocs %}
{%docs evm_column_deprecation_notice_project_name %}
This column is being deprecated for standardization purposes. Please update your queries to use the `name` column instead by March 10, 2025.
{% enddocs %}
{%docs evm_column_deprecation_notice_event_type %}
This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025.
{% enddocs %}
{%docs evm_column_deprecation_notice_nft_from_address %}
This column is being deprecated 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 deprecated for standardization purposes. Please update your queries to use the `to_address` column instead by March 10, 2025.
{% enddocs %}

View File

@ -0,0 +1,587 @@
{% docs evm_nft_events_table_doc %}
This table contains NFT sales on this EVM blockchain. More NFT marketplaces will be added over time.
{% enddocs %}
{% docs evm_ez_nft_sales_table_doc %}
This table contains NFT sale events from various marketplaces.
{% enddocs %}
{% docs evm_ez_nft_mint_table_doc %}
This table contains NFT mint events, defined as NFT transfers from a burn address to an address, on this EVM blockchain.
{% enddocs %}
{% docs evm_ez_nft_transfer_table_doc %}
This table contains NFT transfer events on this EVM blockchain.
{% enddocs %}
{% docs evm_lending_repayments_table_doc %}
This table contains repayment events for loans backed by collateralized NFTs on this EVM blockchain. Events in this table can be a full repayment either by the borrower to get their collateral back or by a new lender to repay the borrower's previous loan. The latter is labeled as refinance where the same borrower takes on a new loan from a new lender and repays the past loan. The NFT collateral is still locked in this scenario.
{% enddocs %}
{% docs evm_nft_aggregator_name %}
The name of the aggregator platform where the sale took place. If the sale did not take place via an aggregator platform, then the value will be null.
{% enddocs %}
{% docs evm_nft_amount %}
The total amount, specified by the mint token address, used as payment to mint the specified number of NFTs corresponding to this token id.
{% enddocs %}
{% docs evm_nft_amount_usd %}
The USD value of amount.
{% enddocs %}
{% docs evm_nft_block_no %}
The block number at which the NFT event occurred.
{% enddocs %}
{% docs evm_nft_blocktime %}
The block timestamp at which the NFT event occurred.
{% enddocs %}
{% docs evm_nft_buyer_address %}
The address of the buyer of the NFT in the transaction.
{% enddocs %}
{% docs evm_nft_creator_fee %}
The decimal adjusted amount of fees paid to the NFT collection as royalty payments for this NFT event in the transaction's currency.
{% enddocs %}
{% docs evm_nft_creator_fee_usd %}
The amount of fees paid to the NFT collection as royalty payments for this NFT event in US dollars.
{% enddocs %}
{% docs evm_nft_currency_address %}
The token contract address for this NFT event. This will be the native asset for native transactions.
{% enddocs %}
{% docs evm_nft_currency_symbol %}
The token symbol for this NFT event.
{% enddocs %}
{% docs evm_nft_erc1155_value %}
If the NFT is an ERC-1155 contract, this field may be one or greater, representing the number of tokens. If it is not an ERC-1155 token, this value will be null.
{% enddocs %}
{% docs evm_nft_event_index %}
The event number within a transaction.
{% enddocs %}
{% docs evm_nft_event_type %}
The type of NFT event in this transaction, either sale, bid_won, redeem, or mint.
{% enddocs %}
{% docs evm_nft_from_address %}
The sending address of the NFT in the transaction.
{% enddocs %}
{% docs evm_nft_intra_event_index %}
The order of events within a single event index. This is primarily used for ERC1155 NFT batch transfer events.
{% enddocs %}
{% docs evm_nft_metadata %}
The token metadata for this NFT. This may be blank for many NFTs. We are working to expand this field.
{% enddocs %}
{% docs evm_nft_mint_count %}
The number of NFTs minted in this event.
{% enddocs %}
{% docs evm_nft_mint_price %}
The price paid in the native asset to mint the NFT(s).
{% enddocs %}
{% docs evm_nft_mint_price_usd %}
The price paid in US dollars to mint the NFT(s).
{% enddocs %}
{% docs evm_nft_mints_symbol %}
The symbol of the token supplied to mint the NFT, if applicable. This field may not handle all edge cases.
{% enddocs %}
{% docs evm_nft_mints_token_address %}
The contract address of the token supplied to mint the NFT, if applicable. This field may not handle all edge cases.
{% enddocs %}
{% docs evm_nft_mints_token_price %}
The decimal adjusted amount of tokens supplied within the same transaction to mint the NFT. This field may not handle all edge cases.
{% enddocs %}
{% docs evm_nft_mints_token_price_usd %}
The amount of tokens supplied in US dollars within the same transaction to mint the NFT. This field may not handle all edge cases.
{% enddocs %}
{% docs evm_nft_nft_address %}
The contract address of the NFT.
{% enddocs %}
{% docs evm_nft_origin_from %}
The from address of this transaction. In most cases, this is the NFT buyer. However, for some more complex transactions, it may not be the NFT buyer.
{% enddocs %}
{% docs evm_nft_origin_sig %}
The function signature of this transaction.
{% enddocs %}
{% docs evm_nft_origin_to %}
The to address of this transaction. In most cases, this is the exchange contract. However, for some more complex NFT events, such as aggregate buys with tools, this may not be the exchange address.
{% enddocs %}
{% docs evm_nft_platform_address %}
The address of the exchange used for the transaction.
{% enddocs %}
{% docs evm_nft_platform_exchange_version %}
The version of the exchange contract used for the transaction.
{% enddocs %}
{% docs evm_nft_platform_fee %}
The decimal adjusted amount of fees paid to the platform for this NFT event in the transaction's currency. There are cases where there are fees paid to multiple marketplaces. In those cases, the fee in the platform_fee column will only reflect the platform fee related to the platform exchange contract.
{% enddocs %}
{% docs evm_nft_platform_fee_usd %}
The amount of fees paid to the platform for this NFT event in US dollars. There are cases where there are fees paid to multiple marketplaces. In those cases, the fee in the platform_fee column will only reflect the platform fee related to the platform exchange contract.
{% enddocs %}
{% docs evm_nft_platform_name %}
The name of the exchange used for the trade.
{% enddocs %}
{% docs evm_nft_price %}
The total price of the NFT, in the currency in which the transaction occurred and decimal adjusted where possible. Please note that the price of the NFT, after subtracting total fees, may not represent the net amount paid to the seller in all cases. You may refer to the platform fee description for more info.
{% enddocs %}
{% docs evm_nft_price_usd %}
The total price of the NFT in US dollars. This will be 0 for tokens without a decimal adjustment or hourly price. Please note that the price of the NFT, after subtracting total fees, may not represent the net amount paid to the seller in all cases. You may refer to the platform fee description for more info.
{% enddocs %}
{% docs evm_nft_project_name %}
The name of the NFT project. This field, along with metadata, will be filled in over time.
{% enddocs %}
{% docs evm_nft_seller_address %}
The address of the seller of the NFT in the transaction.
{% enddocs %}
{% docs evm_nft_to_address %}
The receiving address of the NFT in the transaction.
{% enddocs %}
{% docs evm_nft_tokenid %}
The token ID for this NFT contract.
{% enddocs %}
{% docs evm_nft_total_fees %}
The total amount of fees paid relating to the NFT purchase in the transaction currency. This includes royalty payments to creators and platform fees. Please note, this does not include the gas fee.
{% enddocs %}
{% docs evm_nft_total_fees_usd %}
The total amount of fees paid relating to the NFT purchase in US dollars. This includes royalty payments to creators and platform fees. Please note, this does not include the gas fee.
{% enddocs %}
{% docs evm_nft_tx_fee %}
The gas fee for this transaction in the native asset.
{% enddocs %}
{% docs evm_nft_tx_fee_usd %}
The gas fee for this transaction in US dollars.
{% enddocs %}
{% docs evm_nft_tx_hash %}
The transaction hash for the NFT event. This is not necessarily unique in this table as a transaction may contain multiple NFT events.
{% enddocs %}
{% docs evm_nft_lending_liquidations_table_doc %}
This table contains liquidation events for loans backed by collateralized NFTs on this EVM blockchain. This typically means the lender of the loan closes the loan and receives the NFT collateral.
{% enddocs %}
{% docs evm_platform_address %}
The contract address of the platform's lending contract.
{% enddocs %}
{% docs evm_platform_name %}
The name of the platform.
{% enddocs %}
{% docs evm_platform_exchange_version %}
The version of the platform's lending contract.
{% enddocs %}
{% docs evm_loanid %}
The ID associated with the loan, often times tied to the borrower's address and collateral. This ID can be used as a unique identifier when tracking active loans. However, note that refinances can happen while still maintaining the same loanId. For some platforms, loanids of previously paid loans are reused hence they can't be reliably used as a unique identifier without appropriate timestamp filters. Instead, use the unique_loan_id column.
{% enddocs %}
{% docs evm_unique_loan_id %}
The unique ID that can be used to represent a loan within the same platform. For the same loan, the value of this ID will remain the same across the loans taken, liquidations and repayment tables. For some platforms where the lender is issued a promissory note, the lender can send this note to any address, making the receiver the new lender. However, the unique_loan_id still remains the same although the final lender is different. The unique_loan_id changes only if the loanId and lender changes which would also indicate the previous loan has been fully paid off.
{% enddocs %}
{% docs evm_lender_address %}
The address that gives out a loan to the borrower. When a loan is issued, a promissory note (an ERC721) is issued to the lender. The lender can transfer this note to any address which makes any receiving address the new lender.
{% enddocs %}
{% docs evm_borrower_address %}
The address that receives the loan and has an NFT locked as collateral.
{% enddocs %}
{% docs evm_nft_address %}
The address of the NFT used as collateral.
{% enddocs %}
{% docs evm_tokenid %}
The tokenId of the NFT used as collateral.
{% enddocs %}
{% docs evm_loan_token_address %}
The contract address of what the loan is denominated in. This could be either the native asset or other tokens.
{% enddocs %}
{% docs evm_loan_token_symbol %}
The symbol of the loan token address.
{% enddocs %}
{% docs evm_principal_unadj %}
The principal amount of the loan taken with unadjusted decimal places.
{% enddocs %}
{% docs evm_principal %}
The principal amount of the loan taken with adjusted decimal places.
{% enddocs %}
{% docs evm_principal_usd %}
The principal amount of the loan taken in USD terms.
{% enddocs %}
{% docs evm_interest_rate %}
The non-annualized rate charged by the lender on the principal amount of the loan denominated in percentage (%). For fixed term loans, it is calculated by taking the difference between total debt and principal amount divided by principal amount. For perpetual term loans, interest rate is usually on an annual basis and total debt is calculated prorated.
{% enddocs %}
{% docs evm_apr %}
The annualized interest rate denominated in percentage (%).
{% enddocs %}
{% docs evm_loan_term_type %}
The type of loan terms, could be either a fixed loan or a perpetual loan. A fixed term loan has a fixed repayment date while a perpetual loan does not.
{% enddocs %}
{% docs evm_loan_start_timestamp %}
The timestamp of when the loan offer is accepted.
{% enddocs %}
{% docs evm_loan_due_timestamp %}
The timestamp of when the loan is due. For perpetual term loan, the value will be null.
{% enddocs %}
{% docs evm_loan_tenure %}
The tenure of the loan denominated in seconds. For perpetual term loan, the value will be null.
{% enddocs %}
{% docs evm_lending_loans %}
This table contains NFT lending events for loans backed by collateralized NFTs on this EVM blockchain. This could be depositing an NFT and taking out a loan or using the Buy Now Pay Later (BNPL) feature to take a loan out of the newly bought NFT. This NFT will remain locked until the loan is cleared.
{% enddocs %}
{% docs evm_nft_lending_event_type %}
There are 2 types of loan creation events. It can either be a new loan or a refinance of an existing loan. Note that renegotiation events are categorized as refinance events in this table. Old loans are repaid and new loan ids are reissued so these would be new loan entries in this table.
{% enddocs %}
{% docs evm_debt_unadj %}
The total debt of the loan (principal amount plus interests) with unadjusted decimal places.
{% enddocs %}
{% docs evm_debt %}
The total debt of the loan (principal amount plus interests) with adjusted decimal places.
{% enddocs %}
{% docs evm_debt_usd %}
The total debt of the loan (principal amount plus interests) in USD terms.
{% enddocs %}
{% docs evm_platform_fee_unadj %}
The fee charged by the lending platform with unadjusted decimal places.
{% enddocs %}
{% docs evm_platform_fee %}
The fee charged by the lending platform with adjusted decimal places.
{% enddocs %}
{% docs evm_platform_fee_usd %}
The fee charged by the lending platform in USD terms.
{% enddocs %}
{% docs evm_mev_arbitrage %}
This table contains the financial metrics from NFT arbitrage transactions including cost, revenue and profits.
{% enddocs %}
{% docs evm_mev_searcher %}
The address of the MEV finder, taken from the origin address that initiated the transaction.
{% enddocs %}
{% docs evm_mev_contract %}
The contract address that the MEV searcher uses to execute mev transactions, taken from the origin to address of the transaction.
{% enddocs %}
{% docs evm_cost_usd %}
The total cost in USD to purchase the NFT(s) in the transaction.
{% enddocs %}
{% docs evm_revenue_usd %}
The total revenue in USD from selling the NFT(s) and other related tokens in the transaction.
{% enddocs %}
{% docs evm_miner_tip_usd %}
The total amount in USD sent to the block miner/builder as a tip to include the transaction in the block.
{% enddocs %}
{% docs evm_profit_usd %}
The remainder in USD after subtracting cost, miner tip and transaction fee from revenue.
{% enddocs %}
{% docs evm_funding_source %}
The source of the funds used to perform the arbitrage. Currently there are three sources. Existing funds indicate that the user uses funds that are already in their balance while flash loan and flash swaps indicate that the user took a flash loan in the transaction.
{% enddocs %}
{% docs evm_arbitrage_direction %}
The direction in which the arbitrage is performed. There are two possibilities of origin and destination: pool and marketplace. Pool represents marketplaces where users swap from a pool whereas marketplace represents regular marketplaces that are not pool-based.
{% enddocs %}
{% docs evm_fact_mev_arbitrage_events %}
This table contains information about the NFTs involved in arbitrage transactions, documenting events from both the buy and sell sides.
{% enddocs %}
{% docs evm_trade_side %}
The side of the trade that this event represents. This can be either buy or sell. Buy would represent the events where NFTs are bought while sell would present the events where the bought NFTs are sold. Note that the number of events for buy and sell may not be the same for a given transaction.
{% enddocs %}
{% docs evm_dim_nft_collection_metadata %}
This table contains the metadata for popular NFT collections on this EVM blockchain.
{% enddocs %}
{% docs evm_nft_blockchain %}
Blockchain where the NFT metadata is retrieved from.
{% enddocs %}
{% docs evm_collection_name %}
The name for this NFT collection.
{% enddocs %}
{% docs evm_tokenid_name %}
The name for this specific tokenId. This may be the same for all tokenIds within the same collection.
{% enddocs %}
{% docs evm_traits %}
The traits for this tokenId in a key-value pair format.
{% enddocs %}
{% docs evm_tokenid_description %}
The description for this specific tokenId. This may be the same for all tokenIds within the same collection.
{% enddocs %}
{% docs evm_tokenid_image_url %}
The url of the image for this tokenId.
{% enddocs %}
{% docs evm_nft_address_tokenid %}
The concatenation of NFT address and tokenId.
{% enddocs %}
{% docs evm_nft_quantity %}
The number of NFTs transferred in this transaction. If it is an ERC1155, there can be multiple NFTs transferred in a single transaction. If it is an ERC721, this will be 1.
{% enddocs %}
{% docs evm_nft_token_standard %}
The token standard of the NFT.
{% enddocs %}

View File

@ -0,0 +1,125 @@
{% 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_revert_reason %}
The reason for the revert, if available.
{% enddocs %}
{% docs evm_trace_address %}
The trace address for this trace.
{% enddocs %}
{% docs evm_trace_type %}
The type of internal transaction. Common trace types are `CALL`, `DELEGATECALL`, and `STATICCALL`.
{% enddocs %}

View File

@ -0,0 +1,188 @@
{% 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 %}

View File

@ -0,0 +1,144 @@
{% 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 %}

View File

@ -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 %}

View File

@ -1,35 +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,
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,
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
{% 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)
WHERE 1=1
{% if is_incremental() %}
AND l.modified_timestamp > (
SELECT
COALESCE(
MAX(modified_timestamp),
'2000-01-01'::TIMESTAMP
)
FROM
{{ this }}
)
{% endif %}

View File

@ -51,6 +51,14 @@ models:
description: '{{ doc("avax_origin_to") }}'
- name: TOPICS
description: '{{ doc("avax_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("avax_logs_data") }}'
- name: EVENT_REMOVED
@ -58,7 +66,7 @@ models:
- name: TX_STATUS
description: '{{ doc("avax_tx_status") }}'
- name: EZ_DECODED_EVENT_LOGS_ID
description: '{{ doc("pk") }}'
description: '{{ doc("evm_pk") }}'
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP

View File

@ -5,34 +5,23 @@
) }}
SELECT
tx_hash,
block_number,
block_timestamp,
tx_hash,
tx_position,
trace_index,
identifier,
origin_from_address,
origin_to_address,
origin_function_signature,
from_address,
to_address,
amount,
amount_precise_raw,
amount_precise,
amount_usd,
COALESCE (
native_transfers_id,
{{ dbt_utils.generate_surrogate_key(
['tx_hash', 'trace_index']
) }}
) AS ez_native_transfers_id,
COALESCE(
inserted_timestamp,
'2000-01-01'
) AS inserted_timestamp,
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
origin_from_address,
origin_to_address,
origin_function_signature,
native_transfers_id AS ez_native_transfers_id,
inserted_timestamp,
modified_timestamp,
identifier -- deprecate
FROM
{{ ref('silver__native_transfers') }}

View File

@ -15,7 +15,7 @@ models:
- name: TRACE_INDEX
description: '{{ doc("avax_trace_index") }}'
- name: IDENTIFIER
description: '{{ doc("avax_traces_identifier") }}'
description: '{{ doc("evm_column_deprecation_notice_identifier") }}'
- name: ORIGIN_FROM_ADDRESS
description: '{{ doc("avax_origin_from") }}'
- name: ORIGIN_TO_ADDRESS

View File

@ -22,11 +22,6 @@ SELECT
amount_usd,
decimals,
symbol,
token_price,
has_decimal,
has_price,
_log_id,
_inserted_timestamp,
COALESCE (
transfers_id,
{{ dbt_utils.generate_surrogate_key(
@ -40,6 +35,15 @@ SELECT
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
) AS modified_timestamp,
token_price,
-- deprecate
has_decimal,
-- deprecate
has_price,
-- deprecate
_log_id,
-- deprecate
_inserted_timestamp -- deprecate
FROM
{{ ref('silver__transfers') }}
{{ ref('silver__transfers') }}

View File

@ -31,7 +31,7 @@ models:
- name: AMOUNT_PRECISE
description: '{{ doc("avax_transfer_amount_precise") }}'
- name: TOKEN_PRICE
description: '{{ doc("avax_transfer_token_price") }}'
description: '{{ doc("evm_column_deprecation_notice_token_price") }}'
- name: AMOUNT
description: '{{ doc("avax_transfer_amount") }}'
- name: AMOUNT_USD
@ -43,16 +43,16 @@ models:
- name: TOKEN_PRICE
description: '{{ doc("avax_transfer_token_price") }}'
- name: HAS_DECIMAL
description: '{{ doc("avax_transfer_has_decimal") }}'
description: '{{ doc("evm_column_deprecation_notice_has_decimal") }}'
- name: HAS_PRICE
description: '{{ doc("avax_transfer_has_price") }}'
description: '{{ doc("evm_column_deprecation_notice_has_price") }}'
- name: _LOG_ID
description: '{{ doc("internal_column") }}'
description: '{{ doc("evm_column_deprecation_notice_log_id") }}'
- name: _INSERTED_TIMESTAMP
description: '{{ doc("internal_column") }}'
description: '{{ doc("evm_column_deprecation_notice_inserted_timestamp") }}'
- name: EZ_TOKEN_TRANSFERS_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") }}'

View File

@ -6,21 +6,54 @@
SELECT
block_number,
hash as block_hash,
block_timestamp,
'mainnet' AS network,
'avalanche' AS blockchain,
tx_count,
size,
miner,
extra_data,
parent_hash,
gas_used,
gas_limit,
base_fee_per_gas,
difficulty,
total_difficulty,
extra_data,
gas_limit,
gas_used,
HASH,
parent_hash,
receipts_root,
sha3_uncles,
SIZE,
uncles AS uncle_blocks,
nonce,
receipts_root,
state_root,
transactions_root,
logs_bloom,
COALESCE (
blocks_id,
{{ dbt_utils.generate_surrogate_key(
['block_number']
) }}
) AS fact_blocks_id,
GREATEST(
COALESCE(
A.inserted_timestamp,
'2000-01-01'
),
COALESCE(
d.inserted_timestamp,
'2000-01-01'
)
) AS inserted_timestamp,
GREATEST(
COALESCE(
A.modified_timestamp,
'2000-01-01'
),
COALESCE(
d.modified_timestamp,
'2000-01-01'
)
) AS modified_timestamp,
'avalanche' AS blockchain,
hash,
OBJECT_CONSTRUCT(
'baseFeePerGas',
base_fee_per_gas,
@ -60,33 +93,7 @@ SELECT
transactions_root,
'uncles',
uncles
) AS block_header_json,
COALESCE (
blocks_id,
{{ dbt_utils.generate_surrogate_key(
['block_number']
) }}
) AS fact_blocks_id,
GREATEST(
COALESCE(
A.inserted_timestamp,
'2000-01-01'
),
COALESCE(
d.inserted_timestamp,
'2000-01-01'
)
) AS inserted_timestamp,
GREATEST(
COALESCE(
A.modified_timestamp,
'2000-01-01'
),
COALESCE(
d.modified_timestamp,
'2000-01-01'
)
) AS modified_timestamp
) AS block_header_json
FROM
{{ ref('silver__blocks') }} A
LEFT JOIN {{ ref('silver__tx_count') }}

View File

@ -1,46 +1,62 @@
version: 2
models:
- name: core__fact_blocks
description: '{{ doc("avax_blocks_table_doc") }}'
description: '{{ doc("evm_blocks_table_doc") }}'
columns:
- name: BLOCK_NUMBER
description: '{{ doc("avax_block_number") }}'
description: '{{ doc("evm_block_number") }}'
- name: BLOCK_TIMESTAMP
description: '{{ doc("avax_block_timestamp") }}'
description: '{{ doc("evm_block_timestamp") }}'
- name: NETWORK
description: '{{ doc("avax_network") }}'
description: '{{ doc("evm_network") }}'
- name: BLOCKCHAIN
description: '{{ doc("avax_blockchain") }}'
description: '{{ doc("evm_column_deprecation_notice_blockchain") }}'
- name: MINER
description: '{{ doc("evm_miner") }}'
- name: NONCE
description: '{{ doc("evm_blocks_nonce") }}'
- name: TX_COUNT
description: '{{ doc("avax_tx_count") }}'
description: '{{ doc("evm_tx_count") }}'
- name: DIFFICULTY
description: '{{ doc("avax_difficulty") }}'
description: '{{ doc("evm_difficulty") }}'
- name: TOTAL_DIFFICULTY
description: '{{ doc("avax_total_difficulty") }}'
description: '{{ doc("evm_total_difficulty") }}'
- name: EXTRA_DATA
description: '{{ doc("avax_extra_data") }}'
description: '{{ doc("evm_extra_data") }}'
- name: GAS_LIMIT
description: '{{ doc("avax_gas_limit") }}'
description: '{{ doc("evm_gas_limit") }}'
- name: GAS_USED
description: '{{ doc("avax_gas_used") }}'
description: '{{ doc("evm_gas_used") }}'
- name: BASE_FEE_PER_GAS
description: '{{ doc("evm_base_fee_per_gas") }}'
- name: BLOCK_HASH
description: '{{ doc("evm_blocks_hash") }}'
- name: HASH
description: '{{ doc("avax_blocks_hash") }}'
description: '{{ doc("evm_column_deprecation_notice_hash") }}'
- name: PARENT_HASH
description: '{{ doc("avax_parent_hash") }}'
description: '{{ doc("evm_parent_hash") }}'
- name: RECEIPTS_ROOT
description: '{{ doc("avax_receipts_root") }}'
description: '{{ doc("evm_receipts_root") }}'
- name: SHA3_UNCLES
description: '{{ doc("avax_sha3_uncles") }}'
description: '{{ doc("evm_sha3_uncles") }}'
- name: SIZE
description: '{{ doc("avax_size") }}'
description: '{{ doc("evm_size") }}'
- name: UNCLE_BLOCKS
description: '{{ doc("avax_uncle_blocks") }}'
description: '{{ doc("evm_uncle_blocks") }}'
- 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: BLOCK_HEADER_JSON
description: '{{ doc("avax_block_header_json") }}'
description: '{{ doc("evm_column_deprecation_notice_block_header_json") }}'
- name: BASE_FEE_PER_GAS
description: '{{ doc("evm_base_fee_per_gas") }}'
- 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") }}'

View File

@ -1,30 +1,8 @@
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:
description: '{{ doc("evm_table_deprecation_notice_fact_decoded_event_logs") }}'
```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```'
columns:
- name: BLOCK_NUMBER
description: '{{ doc("avax_block_number") }}'
@ -37,14 +15,14 @@ models:
- name: CONTRACT_ADDRESS
description: '{{ doc("avax_logs_contract_address") }}'
- name: EVENT_NAME
description: 'The name of the event, as defined in the contract ABI.'
description: "The name of the event, as defined in the contract ABI."
- name: DECODED_LOG
description: 'The flattened decoded log, where the keys are the names of the event parameters, and the values are the values of the event parameters.'
description: "The flattened decoded log, where the keys are the names of the event parameters, and the values are the values of the event parameters."
- name: FULL_DECODED_LOG
description: 'The full decoded log, including the event name, the event parameters, and the data type of the event parameters.'
description: "The full decoded log, including the event name, the event parameters, and the data type of the event parameters."
- name: FACT_DECODED_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") }}'

View File

@ -8,16 +8,28 @@ SELECT
block_number,
block_timestamp,
tx_hash,
origin_function_signature,
origin_from_address,
origin_to_address,
{# tx_position, -- new column #}
event_index,
contract_address,
topics,
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
COALESCE (
logs_id,
{{ dbt_utils.generate_surrogate_key(
@ -31,6 +43,9 @@ SELECT
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
) AS modified_timestamp,
tx_status,
-- deprecate
_log_id -- deprecate
FROM
{{ ref('silver__logs') }}

View File

@ -1,38 +1,48 @@
version: 2
models:
- name: core__fact_event_logs
description: '{{ doc("avax_logs_table_doc") }}'
description: '{{ doc("evm_logs_table_doc") }}'
columns:
- name: BLOCK_NUMBER
description: '{{ doc("avax_block_number") }}'
description: '{{ doc("evm_block_number") }}'
- name: BLOCK_TIMESTAMP
description: '{{ doc("avax_block_timestamp") }}'
description: '{{ doc("evm_block_timestamp") }}'
- name: TX_HASH
description: '{{ doc("avax_logs_tx_hash") }}'
description: '{{ doc("evm_logs_tx_hash") }}'
- name: EVENT_INDEX
description: '{{ doc("avax_event_index") }}'
description: '{{ doc("evm_event_index") }}'
- name: CONTRACT_ADDRESS
description: '{{ doc("avax_logs_contract_address") }}'
description: '{{ doc("evm_logs_contract_address") }}'
- name: TOPICS
description: '{{ doc("avax_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("avax_logs_data") }}'
description: '{{ doc("evm_logs_data") }}'
- name: EVENT_REMOVED
description: '{{ doc("avax_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("avax_tx_status") }}'
description: '{{ doc("evm_column_deprecation_notice_tx_status") }}'
- name: TX_SUCCEEDED
description: '{{ doc("evm_tx_succeeded") }}'
- name: ORIGIN_FUNCTION_SIGNATURE
description: '{{ doc("avax_origin_sig") }}'
description: '{{ doc("evm_origin_sig") }}'
- name: ORIGIN_FROM_ADDRESS
description: '{{ doc("avax_origin_from") }}'
description: '{{ doc("evm_origin_from") }}'
- name: ORIGIN_TO_ADDRESS
description: '{{ doc("avax_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") }}'

View File

@ -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

View File

@ -1,68 +1,64 @@
version: 2
models:
- name: core__fact_traces
description: '{{ doc("avax_traces_table_doc") }}'
description: '{{ doc("evm_traces_table_doc") }}'
columns:
- name: BLOCK_NUMBER
description: '{{ doc("avax_traces_block_no") }}'
description: '{{ doc("evm_traces_block_no") }}'
- name: BLOCK_TIMESTAMP
description: '{{ doc("avax_traces_blocktime") }}'
description: '{{ doc("evm_traces_blocktime") }}'
- name: TX_HASH
description: '{{ doc("avax_traces_tx_hash") }}'
description: '{{ doc("evm_traces_tx_hash") }}'
- name: TX_POSITION
description: The position of the transaction within the block.
description: '{{ doc("evm_tx_position") }}'
- name: FROM_ADDRESS
description: '{{ doc("evm_traces_from") }}'
- name: TO_ADDRESS
description: '{{ doc("evm_traces_to") }}'
- name: VALUE
description: '{{ doc("evm_traces_value") }}'
- name: VALUE_PRECISE_RAW
description: '{{ doc("evm_precise_amount_unadjusted") }}'
- name: VALUE_PRECISE
description: '{{ doc("evm_precise_amount_adjusted") }}'
- name: VALUE_HEX
description: '{{ doc("evm_value_hex") }}'
- name: GAS
description: '{{ doc("evm_traces_gas") }}'
- name: GAS_USED
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("evm_column_deprecation_notice_tx_status") }}'
- name: TX_SUCCEEDED
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: FROM_ADDRESS
description: '{{ doc("avax_traces_from") }}'
- name: TO_ADDRESS
description: '{{ doc("avax_traces_to") }}'
- name: INPUT
description: '{{ doc("avax_traces_input") }}'
- name: OUTPUT
description: '{{ doc("avax_traces_output") }}'
- name: TYPE
description: '{{ doc("avax_traces_type") }}'
- name: TRACE_ADDRESS
description: This field represents the position of the trace within the transaction.
- name: SUB_TRACES
description: '{{ doc("avax_traces_sub") }}'
- name: IDENTIFIER
description: '{{ doc("avax_traces_identifier") }}'
- name: DATA
description: '{{ doc("avax_traces_call_data") }}'
- name: VALUE
description: '{{ doc("avax_traces_value") }}'
- name: VALUE_PRECISE_RAW
description: '{{ doc("precise_amount_unadjusted") }}'
- name: VALUE_PRECISE
description: '{{ doc("precise_amount_adjusted") }}'
- name: GAS
description: '{{ doc("avax_traces_gas") }}'
- name: GAS_USED
description: '{{ doc("avax_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.
- name: TX_STATUS
description: '{{ doc("avax_tx_status") }}'
- name: TX_SUCCEEDED
description: Whether the transaction succeeded or failed
- 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") }}'

View File

@ -7,24 +7,27 @@
SELECT
block_number,
block_timestamp,
block_hash,
tx_hash,
nonce,
POSITION,
origin_function_signature,
from_address,
to_address,
VALUE,
origin_function_signature,
value,
value_precise_raw,
value_precise,
tx_fee,
tx_fee,
tx_fee_precise,
CASE
WHEN tx_status = 'SUCCESS' THEN TRUE
ELSE FALSE
END AS tx_succeeded,
tx_type,
nonce,
position as tx_position,
input_data,
gas_price,
gas AS gas_limit,
gas_used,
cumulative_gas_used,
input_data,
tx_status AS status,
effective_gas_price,
max_fee_per_gas,
max_priority_fee_per_gas,
@ -46,6 +49,9 @@ SELECT
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
) AS modified_timestamp,
block_hash,
tx_status as status,
position
FROM
{{ ref('silver__transactions') }}

View File

@ -1,57 +1,57 @@
version: 2
models:
- name: core__fact_transactions
description: '{{ doc("avax_tx_table_doc") }}'
description: '{{ doc("evm_tx_table_doc") }}'
columns:
- name: BLOCK_NUMBER
description: '{{ doc("avax_block_number") }}'
description: '{{ doc("evm_block_number") }}'
- name: BLOCK_TIMESTAMP
description: '{{ doc("avax_block_timestamp") }}'
description: '{{ doc("evm_block_timestamp") }}'
- name: BLOCK_HASH
description: '{{ doc("avax_tx_block_hash") }}'
description: '{{ doc("evm_column_deprecation_notice_block_hash") }}'
- name: TX_HASH
description: '{{ doc("avax_tx_hash") }}'
description: '{{ doc("evm_tx_hash") }}'
- name: NONCE
description: '{{ doc("avax_tx_nonce") }}'
description: '{{ doc("evm_tx_nonce") }}'
- name: POSITION
description: '{{ doc("avax_tx_position") }}'
description: '{{ doc("evm_column_deprecation_notice_position") }}'
- name: TX_POSITION
description: '{{ doc("evm_tx_position") }}'
- name: FROM_ADDRESS
description: '{{ doc("avax_from_address") }}'
description: '{{ doc("evm_from_address") }}'
- name: TO_ADDRESS
description: '{{ doc("avax_to_address") }}'
description: '{{ doc("evm_to_address") }}'
- name: VALUE
description: '{{ doc("avax_value") }}'
description: '{{ doc("evm_value") }}'
- name: VALUE_PRECISE_RAW
description: '{{ doc("precise_amount_unadjusted") }}'
- name: VALUE_PRECISE
description: '{{ doc("precise_amount_adjusted") }}'
- name: TX_FEE
description: '{{ doc("avax_tx_fee") }}'
description: '{{ doc("evm_tx_fee") }}'
- name: TX_FEE_PRECISE
description: '{{ doc("tx_fee_precise") }}'
description: '{{ doc("tx_fee_precise") }}'
- name: GAS_PRICE
description: '{{ doc("avax_tx_gas_price") }}'
description: '{{ doc("evm_tx_gas_price") }}'
- name: GAS_LIMIT
description: '{{ doc("avax_tx_gas_limit") }}'
description: '{{ doc("evm_tx_gas_limit") }}'
- name: GAS_USED
description: '{{ doc("avax_tx_gas_used") }}'
description: '{{ doc("evm_tx_gas_used") }}'
- name: CUMULATIVE_GAS_USED
description: '{{ doc("avax_cumulative_gas_used") }}'
- name: STATUS
description: '{{ doc("avax_tx_status") }}'
- name: INPUT_DATA
description: '{{ doc("avax_tx_input_data") }}'
- name: ORIGIN_FUNCTION_SIGNATURE
description: '{{ doc("avax_tx_origin_sig") }}'
- name: EFFECTIVE_GAS_PRICE
description: The effective gas price of the transaction, in nAVAX.
description: '{{ doc("evm_cumulative_gas_used") }}'
- name: MAX_FEE_PER_GAS
description: The maximum fee per gas of the transaction, in nAVAX.
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 nAVAX.
- name: CHAIN_ID
description: The chain ID of the transaction.
description: The maximum priority fee per gas of the transaction, in Gwei.
- name: STATUS
description: '{{ doc("evm_column_deprecation_notice_tx_status") }}'
- name: TX_SUCCEEDED
description: '{{ doc("evm_tx_succeeded") }}'
- name: INPUT_DATA
description: '{{ doc("evm_tx_input_data") }}'
- name: ORIGIN_FUNCTION_SIGNATURE
description: '{{ doc("evm_tx_origin_sig") }}'
- name: TX_TYPE
description: The type of the transaction, 2 for EIP-1559 transactions and 0 for legacy transactions.
- name: r
@ -61,8 +61,8 @@ 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") }}'

View File

@ -58,7 +58,6 @@ SELECT
token_out,
symbol_in,
symbol_out,
_log_id,
COALESCE (
complete_dex_swaps_id,
{{ dbt_utils.generate_surrogate_key(
@ -72,6 +71,7 @@ SELECT
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
) AS modified_timestamp,
_log_id
FROM {{ ref('silver_dex__complete_dex_swaps') }}

View File

@ -39,7 +39,7 @@ models:
- name: EVENT_INDEX
description: '{{ doc("avax_event_index") }}'
- name: _LOG_ID
description: '{{ doc("internal_column") }}'
description: '{{ doc("evm_column_deprecation_notice_log_id") }}'
- name: ORIGIN_FUNCTION_SIGNATURE
description: '{{ doc("avax_tx_origin_sig") }}'
- name: ORIGIN_FROM_ADDRESS
@ -51,9 +51,9 @@ models:
- name: AMOUNT_OUT_UNADJ
description: '{{ doc("eth_dex_swaps_amount_out_unadj") }}'
- name: EZ_DEX_SWAPS_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") }}'

View File

@ -19,11 +19,15 @@ SELECT
platform_exchange_version,
aggregator_name,
seller_address,
buyer_address,
nft_address,
project_name,
erc1155_value,
tokenId,
buyer_address,
nft_address as contract_address, -- new
project_name as name, -- new
tokenid as token_id, --new
COALESCE(erc1155_value, '1') :: STRING AS quantity, --new
CASE
WHEN erc1155_value IS NULL THEN 'erc721'
ELSE 'erc1155'
END AS token_standard, --new
currency_symbol,
currency_address,
price,
@ -34,7 +38,7 @@ SELECT
total_fees_usd,
platform_fee_usd,
creator_fee_usd,
tx_fee,
tx_fee,
tx_fee_usd,
origin_from_address,
origin_to_address,
@ -52,6 +56,9 @@ SELECT
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
FROM
{{ ref('silver__complete_nft_sales') }}
) AS modified_timestamp,
tokenId, -- deprecate
erc1155_value, -- deprecate
project_name, -- deprecate
nft_address -- deprecate
FROM {{ ref('silver__complete_nft_sales') }}

View File

@ -1,17 +1,17 @@
version: 2
models:
- name: nft__ez_nft_sales
description: This table contains NFT sales from Opensea Seaport 1.1, 1.4, 1.5 and 1.6, Joepegs, Salvor and Element on Avalanche.
description: '{{ doc("evm_ez_nft_sales_table_doc") }}'
columns:
- name: BLOCK_NUMBER
description: '{{ doc("nft_block_no") }}'
description: '{{ doc("nft_block_no") }}'
- name: BLOCK_TIMESTAMP
description: '{{ doc("nft_blocktime") }}'
- name: TX_HASH
description: '{{ doc("nft_tx_hash") }}'
- name: EVENT_INDEX
description: '{{ doc("nft_event_index") }}'
description: '{{ doc("nft_event_index") }}'
- name: EVENT_TYPE
description: '{{ doc("nft_event_type") }}'
- name: PLATFORM_ADDRESS
@ -27,13 +27,23 @@ models:
- name: BUYER_ADDRESS
description: '{{ doc("nft_buyer_address") }}'
- name: NFT_ADDRESS
description: '{{ doc("evm_column_deprecation_notice_nft_address") }}'
- name: CONTRACT_ADDRESS
description: '{{ doc("nft_nft_address") }}'
- name: PROJECT_NAME
description: '{{ doc("nft_project_name") }}'
- name: ERC1155_VALUE
description: '{{ doc("nft_erc1155_value") }}'
description: '{{ doc("evm_column_deprecation_notice_project_name") }}'
- name: NAME
description: '{{ doc("evm_nft_project_name") }}'
- name: TOKENID
description: '{{ doc("evm_column_deprecation_notice_tokenid") }}'
- name: TOKEN_ID
description: '{{ doc("nft_tokenid") }}'
- name: ERC1155_VALUE
description: '{{ doc("evm_column_deprecation_notice_erc1155_value") }}'
- name: QUANTITY
description: '{{ doc("evm_nft_quantity") }}'
- name: TOKEN_STANDARD
description: '{{ doc("evm_nft_token_standard") }}'
- name: CURRENCY_SYMBOL
description: '{{ doc("nft_currency_symbol") }}'
- name: CURRENCY_ADDRESS
@ -54,10 +64,6 @@ models:
description: '{{ doc("nft_platform_fee_usd") }}'
- name: CREATOR_FEE_USD
description: '{{ doc("nft_creator_fee_usd") }}'
- name: TX_FEE
description: '{{ doc("nft_tx_fee") }}'
- name: TX_FEE_USD
description: '{{ doc("nft_tx_fee_usd") }}'
- name: ORIGIN_FROM_ADDRESS
description: '{{ doc("nft_origin_from") }}'
- name: ORIGIN_TO_ADDRESS
@ -65,8 +71,8 @@ models:
- name: ORIGIN_FUNCTION_SIGNATURE
description: '{{ doc("nft_origin_sig") }}'
- name: EZ_NFT_SALES_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") }}'

View File

@ -12,15 +12,28 @@ SELECT
block_timestamp,
block_number,
tx_hash,
{#tx_position, -- new #}
event_index,
intra_event_index,
event_type,
contract_address as nft_address,
project_name,
from_address AS nft_from_address,
to_address AS nft_to_address,
tokenId,
erc1155_value,
token_transfer_type,
iff(from_address = '0x0000000000000000000000000000000000000000', TRUE, FALSE) AS is_mint, -- new
from_address, --new
to_address, --new
contract_address, --new
tokenId as token_id, --new
COALESCE(
erc1155_value,
'1'
) :: STRING AS quantity, --new
CASE
WHEN token_transfer_type = 'erc721_Transfer' THEN 'erc721'
WHEN token_transfer_type = 'erc1155_TransferSingle' THEN 'erc1155'
WHEN token_transfer_type = 'erc1155_TransferBatch' THEN 'erc1155'
END AS token_standard, --new
project_name as name, --new
{#origin_function_signature, --new
origin_from_address, --new
origin_to_address, #} -- new
COALESCE (
nft_transfers_id,
{{ dbt_utils.generate_surrogate_key(
@ -34,7 +47,13 @@ SELECT
COALESCE(
modified_timestamp,
'2000-01-01'
) AS modified_timestamp
) AS modified_timestamp,
event_type, -- deprecate
from_address AS nft_from_address, -- deprecate
to_address AS nft_to_address, -- deprecate
contract_address AS nft_address, --deprecate
tokenId, -- deprecate
erc1155_value, --deprecate
project_name --deprecate
FROM
{{ ref('silver__nft_transfers') }}
{{ ref('silver__nft_transfers') }}

View File

@ -1,8 +1,8 @@
version: 2
models:
- name: nft__ez_nft_transfers
description: '{{ doc("nft_transfer_doc") }}'
description: '{{ doc("evm_ez_nft_transfer_table_doc") }}'
columns:
- name: BLOCK_NUMBER
description: '{{ doc("nft_block_no") }}'
@ -15,22 +15,36 @@ models:
- name: INTRA_EVENT_INDEX
description: '{{ doc("nft_intra_event_index") }}'
- name: EVENT_TYPE
description: '{{ doc("nft_event_type") }}'
description: '{{ doc("evm_column_deprecation_notice_event_type") }}'
- name: NFT_ADDRESS
description: '{{ doc("evm_column_deprecation_notice_nft_address") }}'
- name: CONTRACT_ADDRESS
description: '{{ doc("nft_nft_address") }}'
- name: NAME
description: '{{ doc("evm_nft_project_name") }}'
- name: PROJECT_NAME
description: '{{ doc("nft_project_name") }}'
description: '{{ doc("evm_column_deprecation_notice_project_name") }}'
- name: NFT_FROM_ADDRESS
description: '{{ doc("evm_column_deprecation_notice_nft_from_address") }}'
- name: FROM_ADDRESS
description: '{{ doc("nft_nft_from_address") }}'
- name: NFT_TO_ADDRESS
description: '{{ doc("evm_column_deprecation_notice_nft_to_address") }}'
- name: TO_ADDRESS
description: '{{ doc("nft_nft_to_address") }}'
- name: TOKENID
description: '{{ doc("evm_column_deprecation_notice_tokenid") }}'
- name: TOKEN_ID
description: '{{ doc("nft_tokenid") }}'
- name: ERC1155_VALUE
description: '{{ doc("nft_erc1155_value") }}'
description: '{{ doc("evm_column_deprecation_notice_erc1155_value") }}'
- name: QUANTITY
description: '{{ doc("evm_nft_quantity") }}'
- name: TOKEN_STANDARD
description: '{{ doc("evm_nft_token_standard") }}'
- name: EZ_NFT_TRANSFERS_ID
description: '{{ doc("pk") }}'
description: '{{ doc("pk") }}'
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
description: '{{ doc("inserted_timestamp") }}'
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
description: '{{ doc("modified_timestamp") }}'

View File

@ -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() %}

View File

@ -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

View File

@ -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 >= (

View File

@ -16,6 +16,7 @@ WITH base AS (
from_address AS origin_from_address,
to_address AS origin_to_address,
tx_status,
{# position AS tx_position, --new column #}
logs,
_inserted_timestamp
FROM
@ -39,6 +40,7 @@ flat_logs AS (
origin_from_address,
origin_to_address,
tx_status,
{# position AS tx_position, --new column #}
VALUE :address :: STRING AS contract_address,
VALUE :blockHash :: STRING AS block_hash,
VALUE :data :: STRING AS DATA,
@ -63,6 +65,7 @@ new_records AS (
l.origin_to_address,
txs.origin_function_signature,
l.tx_status,
{# l.tx_position, --new column #}
l.contract_address,
l.block_hash,
l.data,
@ -107,6 +110,7 @@ missing_data AS (
t.origin_to_address,
txs.origin_function_signature,
t.tx_status,
{# t.tx_position, --new column #}
t.contract_address,
t.block_hash,
t.data,
@ -140,6 +144,7 @@ FINAL AS (
origin_to_address,
origin_function_signature,
tx_status,
{# tx_position, --new column #}
contract_address,
block_hash,
DATA,
@ -162,6 +167,7 @@ SELECT
origin_to_address,
origin_function_signature,
tx_status,
{# tx_position, --new column #}
contract_address,
block_hash,
DATA,

View File

@ -32,44 +32,21 @@ WITH avax_base AS (
value_precise_raw AS avax_value_precise_raw,
value_precise AS avax_value_precise,
tx_position,
trace_index
trace_index,
origin_from_address,
origin_to_address,
origin_function_signature
FROM
{{ ref('core__fact_traces') }}
WHERE
avax_value > 0
AND tx_status = 'SUCCESS'
AND trace_status = 'SUCCESS'
AND tx_succeeded
AND trace_succeeded
AND TYPE NOT IN (
'DELEGATECALL',
'STATICCALL'
)
{% if is_incremental() %}
AND _inserted_timestamp >= (
SELECT
MAX(_inserted_timestamp) - INTERVAL '72 hours'
FROM
{{ this }}
)
{% endif %}
),
tx_table AS (
SELECT
block_number,
tx_hash,
from_address AS origin_from_address,
to_address AS origin_to_address,
origin_function_signature
FROM
{{ ref('silver__transactions') }}
WHERE
tx_hash IN (
SELECT
DISTINCT tx_hash
FROM
avax_base
)
{% if is_incremental() %}
AND _inserted_timestamp >= (
SELECT
@ -80,10 +57,10 @@ 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,
origin_from_address,
origin_to_address,
origin_function_signature,
@ -97,7 +74,7 @@ SELECT
2
) AS amount_usd,
_call_id,
_inserted_timestamp,
a._inserted_timestamp,
tx_position,
trace_index,
{{ dbt_utils.generate_surrogate_key(
@ -113,8 +90,4 @@ FROM
'hour',
A.block_timestamp
) = HOUR
AND token_address = '0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7'
JOIN tx_table USING (
tx_hash,
block_number
)
AND token_address = '0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7'

View File

@ -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'

View File

@ -11,7 +11,11 @@
WITH logs AS (
SELECT
_log_id,
CONCAT(
tx_hash :: STRING,
'-',
event_index :: STRING
) 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 >= (

View File

@ -9,14 +9,14 @@ 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
FROM
@ -27,7 +27,9 @@ GROUP BY
block_number
)
SELECT
*,
block_number,
_inserted_timestamp,
tx_count,
{{ dbt_utils.generate_surrogate_key(
['block_number']
) }} AS tx_count_id,
@ -35,4 +37,4 @@ SELECT
SYSDATE() AS modified_timestamp,
'{{ invocation_id }}' AS _invocation_id
FROM
base
base

View File

@ -21,39 +21,47 @@ WITH base_evt AS (
topics [0] :: STRING AS topic_0,
event_name,
TRY_TO_NUMBER(
decoded_flat :"amount" :: STRING
decoded_log :"amount" :: STRING
) AS amount,
utils.udf_hex_to_string(
SUBSTRING(
decoded_flat :"destination" :: STRING,
decoded_log :"destination" :: STRING,
3
)
) AS destination_chain_symbol,
decoded_flat :"lockId" :: STRING AS lockId,
decoded_flat :"recipient" :: STRING AS recipient,
decoded_flat :"sender" :: STRING AS sender,
decoded_log :"lockId" :: STRING AS lockId,
decoded_log :"recipient" :: STRING AS recipient,
decoded_log :"sender" :: STRING AS sender,
utils.udf_hex_to_string(
SUBSTRING(
decoded_flat :"tokenSource" :: STRING,
decoded_log :"tokenSource" :: STRING,
3
)
) AS token_source,
REGEXP_REPLACE(
decoded_flat :"tokenSourceAddress" :: STRING,
decoded_log :"tokenSourceAddress" :: STRING,
'0+$',
''
) AS tokenSourceAddress,
decoded_flat,
decoded_log,
event_removed,
tx_status,
_log_id,
_inserted_timestamp
IFF(
tx_succeeded,
'SUCCESS',
'FAIL'
) AS tx_status,
CONCAT(
tx_hash :: STRING,
'-',
event_index :: STRING
) AS _log_id,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('silver__decoded_logs') }}
{{ ref('core__ez_decoded_event_logs') }}
WHERE
topics [0] :: STRING = '0x884a8def17f0d5bbb3fef53f3136b5320c9b39f75afb8985eeab9ea1153ee56d'
AND contract_address = '0xbbbd1bbb4f9b936c3604906d7592a644071de884'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -63,6 +71,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -26,10 +26,7 @@ WITH base_evt AS (
origin_from_address AS recipient,
TRY_TO_NUMBER(utils.udf_hex_to_int(segmented_data [4] :: STRING)) AS nonce,
TRY_TO_NUMBER(utils.udf_hex_to_int(segmented_data [5] :: STRING)) AS messenger,
CASE
WHEN tx_status = 'SUCCESS' THEN TRUE
ELSE FALSE
END AS tx_succeeded,
tx_succeeded,
CONCAT(
tx_hash,
'-',
@ -51,6 +48,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
lp_evt AS (
@ -69,10 +67,7 @@ lp_evt AS (
TRY_TO_NUMBER(utils.udf_hex_to_int(segmented_data [2] :: STRING)) AS amount,
TRY_TO_NUMBER(utils.udf_hex_to_int(segmented_data [3] :: STRING)) AS vUsdAmount,
TRY_TO_NUMBER(utils.udf_hex_to_int(segmented_data [4] :: STRING)) AS fee,
CASE
WHEN tx_status = 'SUCCESS' THEN TRUE
ELSE FALSE
END AS tx_succeeded,
tx_succeeded,
CONCAT(
tx_hash,
'-',
@ -104,6 +99,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -21,28 +21,36 @@ WITH base_evt AS (
topics [0] :: STRING AS topic_0,
event_name,
TRY_TO_NUMBER(
decoded_flat :"amount" :: STRING
decoded_log :"amount" :: STRING
) AS amount,
decoded_flat :"destinationChain" :: STRING AS destinationChain,
decoded_log :"destinationChain" :: STRING AS destinationChain,
LOWER(
decoded_flat :"destinationContractAddress" :: STRING
decoded_log :"destinationContractAddress" :: STRING
) AS destinationContractAddress,
decoded_flat :"payload" :: STRING AS payload,
decoded_log :"payload" :: STRING AS payload,
origin_from_address AS recipient,
decoded_flat :"payloadHash" :: STRING AS payloadHash,
decoded_flat :"sender" :: STRING AS sender,
decoded_flat :"symbol" :: STRING AS symbol,
decoded_flat,
decoded_log :"payloadHash" :: STRING AS payloadHash,
decoded_log :"sender" :: STRING AS sender,
decoded_log :"symbol" :: STRING AS symbol,
decoded_log,
event_removed,
tx_status,
_log_id,
_inserted_timestamp
IFF(
tx_succeeded,
'SUCCESS',
'FAIL'
) AS tx_status,
CONCAT(
tx_hash :: STRING,
'-',
event_index :: STRING
) AS _log_id,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('silver__decoded_logs') }}
{{ ref('core__ez_decoded_event_logs') }}
WHERE
topics [0] :: STRING = '0x7e50569d26be643bda7757722291ec66b1be66d8283474ae3fab5a98f878a7a2'
AND contract_address = LOWER('0x5029C0EFf6C34351a0CEc334542cDb22c7928f78')
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -52,6 +60,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
native_gas_paid AS (
@ -68,30 +77,34 @@ native_gas_paid AS (
topics [0] :: STRING AS topic_0,
event_name,
TRY_TO_NUMBER(
decoded_flat :"amount" :: STRING
decoded_log :"amount" :: STRING
) AS amount,
decoded_flat :"destinationChain" :: STRING AS destinationChain,
decoded_log :"destinationChain" :: STRING AS destinationChain,
LOWER(
decoded_flat :"destinationAddress" :: STRING
decoded_log :"destinationAddress" :: STRING
) AS destinationAddress,
TRY_TO_NUMBER(
decoded_flat :"gasFeeAmount" :: STRING
decoded_log :"gasFeeAmount" :: STRING
) AS gasFeeAmount,
decoded_flat :"payloadHash" :: STRING AS payloadHash,
decoded_flat :"refundAddress" :: STRING AS refundAddress,
decoded_flat :"sourceAddress" :: STRING AS sourceAddress,
decoded_flat :"symbol" :: STRING AS symbol,
decoded_flat,
decoded_log :"payloadHash" :: STRING AS payloadHash,
decoded_log :"refundAddress" :: STRING AS refundAddress,
decoded_log :"sourceAddress" :: STRING AS sourceAddress,
decoded_log :"symbol" :: STRING AS symbol,
decoded_log,
event_removed,
tx_status,
IFF(
tx_succeeded,
'SUCCESS',
'FAIL'
) AS tx_status,
_log_id,
_inserted_timestamp
FROM
{{ ref('silver__decoded_logs') }}
{{ ref('core__ez_decoded_event_logs') }}
WHERE
topics [0] :: STRING = '0x999d431b58761213cf53af96262b67a069cbd963499fd8effd1e21556217b841'
AND contract_address = '0x2d5d7d31f671f86c782533cc367f14109a082712'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -101,6 +114,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
transfers AS (
@ -109,10 +123,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 = '0xce16f69375520ab01377ce7b88f5ba8c48f8d666'
AND to_address IN (
@ -128,6 +146,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
FINAL AS (

View File

@ -21,28 +21,36 @@ WITH base_evt AS (
topics [0] :: STRING AS topic_0,
event_name,
TRY_TO_NUMBER(
decoded_flat :"amount" :: STRING
decoded_log :"amount" :: STRING
) AS amount,
TRY_TO_NUMBER(
decoded_flat :"dstChainId" :: STRING
decoded_log :"dstChainId" :: STRING
) AS dstChainId,
TRY_TO_NUMBER(
decoded_flat :"maxSlippage" :: STRING
decoded_log :"maxSlippage" :: STRING
) AS maxSlippage,
TRY_TO_NUMBER(
decoded_flat :"nonce" :: STRING
decoded_log :"nonce" :: STRING
) AS nonce,
decoded_flat :"receiver" :: STRING AS receiver,
decoded_flat :"sender" :: STRING AS sender,
decoded_flat :"token" :: STRING AS token,
decoded_flat :"transferId" :: STRING AS transferId,
decoded_flat,
decoded_log :"receiver" :: STRING AS receiver,
decoded_log :"sender" :: STRING AS sender,
decoded_log :"token" :: STRING AS token,
decoded_log :"transferId" :: STRING AS transferId,
decoded_log,
event_removed,
tx_status,
_log_id,
_inserted_timestamp
IFF(
tx_succeeded,
'SUCCESS',
'FAIL'
) AS tx_status,
CONCAT(
tx_hash :: STRING,
'-',
event_index :: STRING
) AS _log_id,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('silver__decoded_logs') }}
{{ ref('core__ez_decoded_event_logs') }}
WHERE
topics [0] :: STRING = '0x89d8051e597ab4178a863a5190407b98abfeff406aa8db90c59af76612e58f01'
AND contract_address IN (
@ -50,7 +58,7 @@ WITH base_evt AS (
'0x9b36f165bab9ebe611d491180418d8de4b8f3a1f',
'0xef3c714c9425a8f3697a9c969dc1af30ba82e5d4'
)
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -60,6 +68,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -23,54 +23,62 @@ WITH base_evt AS (
DATA,
regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
CONCAT('0x', SUBSTR(segmented_data [24] :: STRING, 1, 40)) AS token_address,
decoded_flat :"affiliateFee" :: STRING AS affiliateFee,
decoded_flat :"metadata" :: STRING AS metadata,
decoded_log :"affiliateFee" :: STRING AS affiliateFee,
decoded_log :"metadata" :: STRING AS metadata,
TRY_TO_NUMBER(
decoded_flat :"nativeFixFee" :: STRING
decoded_log :"nativeFixFee" :: STRING
) AS nativeFixFee,
decoded_flat :"order" AS order_obj,
decoded_flat :"order" :"allowedCancelBeneficiarySrc" :: STRING AS allowedCancelBeneficiarySrc,
decoded_flat :"order" :"allowedTakerDst" :: STRING AS allowedTakerDst,
decoded_flat :"order" :"externalCall" :: STRING AS externalCall,
decoded_log :"order" AS order_obj,
decoded_log :"order" :"allowedCancelBeneficiarySrc" :: STRING AS allowedCancelBeneficiarySrc,
decoded_log :"order" :"allowedTakerDst" :: STRING AS allowedTakerDst,
decoded_log :"order" :"externalCall" :: STRING AS externalCall,
TRY_TO_NUMBER(
decoded_flat :"order" :"giveAmount" :: STRING
decoded_log :"order" :"giveAmount" :: STRING
) AS giveAmount,
TRY_TO_NUMBER(
decoded_flat :"order" :"giveChainId" :: STRING
decoded_log :"order" :"giveChainId" :: STRING
) AS giveChainId,
decoded_flat :"order" :"givePatchAuthoritySrc" :: STRING AS givePatchAuthoritySrc,
decoded_flat :"order" :"giveTokenAddress" :: STRING AS giveTokenAddress,
decoded_log :"order" :"givePatchAuthoritySrc" :: STRING AS givePatchAuthoritySrc,
decoded_log :"order" :"giveTokenAddress" :: STRING AS giveTokenAddress,
TRY_TO_NUMBER(
decoded_flat :"order" :"makerOrderNonce" :: STRING
decoded_log :"order" :"makerOrderNonce" :: STRING
) AS makerOrderNonce,
decoded_flat :"order" :"makerSrc" :: STRING AS makerSrc,
decoded_flat :"order" :"orderAuthorityAddressDst" :: STRING AS orderAuthorityAddressDst,
decoded_log :"order" :"makerSrc" :: STRING AS makerSrc,
decoded_log :"order" :"orderAuthorityAddressDst" :: STRING AS orderAuthorityAddressDst,
CONCAT('0x', LEFT(segmented_data [28] :: STRING, 40)) AS receiverDst,
TRY_TO_NUMBER(
decoded_flat :"order" :"takeAmount" :: STRING
decoded_log :"order" :"takeAmount" :: STRING
) AS takeAmount,
TRY_TO_NUMBER(
decoded_flat :"order" :"takeChainId" :: STRING
decoded_log :"order" :"takeChainId" :: STRING
) AS takeChainId,
decoded_flat :"order" :"takeTokenAddress" :: STRING AS takeTokenAddress,
decoded_flat :"orderId" :: STRING AS orderId,
decoded_log :"order" :"takeTokenAddress" :: STRING AS takeTokenAddress,
decoded_log :"orderId" :: STRING AS orderId,
TRY_TO_NUMBER(
decoded_flat :"percentFee" :: STRING
decoded_log :"percentFee" :: STRING
) AS percentFee,
TRY_TO_NUMBER(
decoded_flat :"referralCode" :: STRING
decoded_log :"referralCode" :: STRING
) AS referralCode,
decoded_flat,
decoded_log,
event_removed,
tx_status,
_log_id,
_inserted_timestamp
IFF(
tx_succeeded,
'SUCCESS',
'FAIL'
) AS tx_status,
CONCAT(
tx_hash :: STRING,
'-',
event_index :: STRING
) AS _log_id,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('silver__decoded_logs') }}
{{ ref('core__ez_decoded_event_logs') }}
WHERE
topics [0] :: STRING = '0xfc8703fd57380f9dd234a89dce51333782d49c5902f307b02f03e014d18fe471' --CreatedOrder
AND contract_address = '0xef4fb24ad0916217251f553c0596f8edc630eb66' --Dln: Source
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -80,6 +88,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT
@ -112,7 +121,7 @@ SELECT
WHEN token_address = '0x0000000000000000000000000000000000000000' THEN LOWER('0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7')
ELSE token_address
END AS token_address,
decoded_flat,
decoded_log,
order_obj,
_log_id,
_inserted_timestamp

View File

@ -20,13 +20,21 @@ WITH base_evt AS (
event_index,
topics [0] :: STRING AS topic_0,
event_name,
decoded_flat,
decoded_log,
event_removed,
tx_status,
_log_id,
_inserted_timestamp
IFF(
tx_succeeded,
'SUCCESS',
'FAIL'
) AS tx_status,
CONCAT(
tx_hash :: STRING,
'-',
event_index :: STRING
) AS _log_id,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('silver__decoded_logs') }}
{{ ref('core__ez_decoded_event_logs') }}
WHERE
topics [0] :: STRING IN (
'0x5566d73d091d945ab32ea023cd1930c0d43aa43bef9aee4cb029775cfc94bdae',
@ -40,7 +48,7 @@ WITH base_evt AS (
--PortalV2
'0xbf0b5d561b986809924f88099c4ff0e6bcce60c9' --PortalV2
)
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -50,6 +58,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
requestsent AS (
@ -65,11 +74,11 @@ requestsent AS (
event_index,
topic_0,
event_name,
decoded_flat :"chainIdTo" :: STRING AS chainIdTo,
decoded_flat :"data" :: STRING AS data_requestsent,
decoded_flat :"requestId" :: STRING AS requestId,
decoded_flat :"to" :: STRING AS to_address,
decoded_flat,
decoded_log :"chainIdTo" :: STRING AS chainIdTo,
decoded_log :"data" :: STRING AS data_requestsent,
decoded_log :"requestId" :: STRING AS requestId,
decoded_log :"to" :: STRING AS to_address,
decoded_log,
event_removed,
tx_status,
_log_id,
@ -93,12 +102,12 @@ locked AS (
topic_0,
event_name,
TRY_TO_NUMBER(
decoded_flat :"amount" :: STRING
decoded_log :"amount" :: STRING
) AS amount,
decoded_flat :"from" :: STRING AS from_address,
decoded_flat :"to" :: STRING AS to_address,
decoded_flat :"token" :: STRING AS token,
decoded_flat,
decoded_log :"from" :: STRING AS from_address,
decoded_log :"to" :: STRING AS to_address,
decoded_log :"token" :: STRING AS token,
decoded_log,
event_removed,
tx_status,
_log_id,

View File

@ -20,22 +20,27 @@ WITH token_transfers AS (
from_address,
to_address,
raw_amount,
_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 <> '0x0000000000000000000000000000000000000000'
AND to_address = '0x25ab3efd52e6470681ce037cd546dc60726948d3'
{% if is_incremental() %}
AND _inserted_timestamp >= (
AND modified_timestamp >= (
SELECT
MAX(_inserted_timestamp) - INTERVAL '12 hours'
FROM
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
AND modified_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
native_transfers AS (
@ -50,12 +55,21 @@ native_transfers AS (
et.to_address,
amount_precise_raw,
identifier,
_call_id,
et._inserted_timestamp
concat_ws(
'-',
et.block_number,
et.tx_position,
CONCAT(
et.type,
'_',
et.trace_address
)
) AS _call_id,
et.modified_timestamp AS _inserted_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
@ -63,7 +77,7 @@ native_transfers AS (
et.to_address = '0x25ab3efd52e6470681ce037cd546dc60726948d3'
{% if is_incremental() %}
AND et._inserted_timestamp >= (
AND et.modified_timestamp >= (
SELECT
MAX(_inserted_timestamp) - INTERVAL '12 hours'
FROM
@ -120,14 +134,18 @@ dst_info AS (
tx_hash,
topics [1] :: STRING AS encoded_data,
SUBSTR(RIGHT(encoded_data, 12), 1, 4) AS destination_chain_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 = '0x25ab3efd52e6470681ce037cd546dc60726948d3'
AND topics [0] :: STRING = '0x5ce4019f772fda6cb703b26bce3ec3006eb36b73f1d3a0eb441213317d9f5e9d'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (

View File

@ -21,26 +21,34 @@ WITH base_evt AS (
topics [0] :: STRING AS topic_0,
event_name,
TRY_TO_NUMBER(
decoded_flat :"amount" :: STRING
decoded_log :"amount" :: STRING
) AS amount,
decoded_flat :"from" :: STRING AS from_address,
decoded_flat :"receiver" :: STRING AS receiver,
decoded_flat :"swapoutID" :: STRING AS swapoutID,
decoded_log :"from" :: STRING AS from_address,
decoded_log :"receiver" :: STRING AS receiver,
decoded_log :"swapoutID" :: STRING AS swapoutID,
TRY_TO_NUMBER(
decoded_flat :"toChainID" :: STRING
decoded_log :"toChainID" :: STRING
) AS toChainID,
decoded_flat :"token" :: STRING AS token,
decoded_flat,
decoded_log :"token" :: STRING AS token,
decoded_log,
event_removed,
tx_status,
_log_id,
_inserted_timestamp
IFF(
tx_succeeded,
'SUCCESS',
'FAIL'
) AS tx_status,
CONCAT(
tx_hash :: STRING,
'-',
event_index :: STRING
) AS _log_id,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('silver__decoded_logs') }}
{{ ref('core__ez_decoded_event_logs') }}
WHERE
topics [0] :: STRING = '0x0d969ae475ff6fcaf0dcfa760d4d8607244e8d95e9bf426f8d5d69f9a3e525af'
AND contract_address = '0x1633d66ca91ce4d81f63ea047b7b19beb92df7f3'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -50,6 +58,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -29,8 +29,8 @@ WITH base_contracts AS (
WHERE
from_address = LOWER('0x808d7c71ad2ba3FA531b068a2417C63106BC0949')
AND TYPE ILIKE 'create%'
AND tx_status = 'SUCCESS'
AND trace_status = 'SUCCESS'
AND tx_succeeded
AND trace_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (

View File

@ -28,45 +28,53 @@ base_evt AS (
topics [0] :: STRING AS topic_0,
event_name,
TRY_TO_NUMBER(
decoded_flat :"amountSD" :: STRING
decoded_log :"amountSD" :: STRING
) AS amountSD,
TRY_TO_NUMBER(
decoded_flat :"chainId" :: STRING
decoded_log :"chainId" :: STRING
) AS chainId,
CASE
WHEN chainId < 100 THEN chainId + 100
ELSE chainId
END AS destination_chain_id,
TRY_TO_NUMBER(
decoded_flat :"dstPoolId" :: STRING
decoded_log :"dstPoolId" :: STRING
) AS dstPoolId,
TRY_TO_NUMBER(
decoded_flat :"eqFee" :: STRING
decoded_log :"eqFee" :: STRING
) AS eqFee,
TRY_TO_NUMBER(
decoded_flat :"eqReward" :: STRING
decoded_log :"eqReward" :: STRING
) AS eqReward,
TRY_TO_NUMBER(
decoded_flat :"amountSD" :: STRING
decoded_log :"amountSD" :: STRING
) AS lpFee,
TRY_TO_NUMBER(
decoded_flat :"amountSD" :: STRING
decoded_log :"amountSD" :: STRING
) AS protocolFee,
decoded_flat :"from" :: STRING AS from_address,
decoded_flat,
decoded_log :"from" :: STRING AS from_address,
decoded_log,
token_address,
event_removed,
tx_status,
_log_id,
_inserted_timestamp
IFF(
tx_succeeded,
'SUCCESS',
'FAIL'
) AS tx_status,
CONCAT(
tx_hash :: STRING,
'-',
event_index :: STRING
) AS _log_id,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('silver__decoded_logs') }}
{{ ref('core__ez_decoded_event_logs') }}
d
INNER JOIN pools p
ON d.contract_address = p.pool_address
WHERE
topics [0] :: STRING = '0x34660fc8af304464529f48a778e03d03e4d34bcd5f9b6f0cfbf3cd238c642f7f'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -76,6 +84,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -21,27 +21,35 @@ WITH base_evt AS (
topics [0] :: STRING AS topic_0,
event_name,
TRY_TO_NUMBER(
decoded_flat :"amount" :: STRING
decoded_log :"amount" :: STRING
) AS amount,
TRY_TO_NUMBER(
decoded_flat :"chainID" :: STRING
decoded_log :"chainID" :: STRING
) AS chainID,
decoded_flat :"from" :: STRING AS from_address,
decoded_flat :"id" :: STRING AS id,
decoded_flat :"revertableAddress" :: STRING AS revertableAddress,
decoded_flat :"to" :: STRING AS to_address,
decoded_flat :"token" :: STRING AS token,
decoded_flat,
decoded_log :"from" :: STRING AS from_address,
decoded_log :"id" :: STRING AS id,
decoded_log :"revertableAddress" :: STRING AS revertableAddress,
decoded_log :"to" :: STRING AS to_address,
decoded_log :"token" :: STRING AS token,
decoded_log,
event_removed,
tx_status,
_log_id,
_inserted_timestamp
IFF(
tx_succeeded,
'SUCCESS',
'FAIL'
) AS tx_status,
CONCAT(
tx_hash :: STRING,
'-',
event_index :: STRING
) AS _log_id,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('silver__decoded_logs') }}
{{ ref('core__ez_decoded_event_logs') }}
WHERE
topics [0] :: STRING = '0x31325fe0a1a2e6a5b1e41572156ba5b4e94f0fae7e7f63ec21e9b5ce1e4b3eab'
AND contract_address = '0xe75c7e85fe6add07077467064ad15847e6ba9877'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -51,6 +59,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -21,20 +21,28 @@ WITH base_evt AS (
topics [0] :: STRING AS topic_0,
event_name,
TRY_TO_NUMBER(
decoded_flat :"amount" :: STRING
decoded_log :"amount" :: STRING
) AS amount,
TRY_TO_NUMBER(
decoded_flat :"chainId" :: STRING
decoded_log :"chainId" :: STRING
) AS chainId,
decoded_flat :"to" :: STRING AS to_address,
decoded_flat :"token" :: STRING AS token,
decoded_flat,
decoded_log :"to" :: STRING AS to_address,
decoded_log :"token" :: STRING AS token,
decoded_log,
event_removed,
tx_status,
_log_id,
_inserted_timestamp
IFF(
tx_succeeded,
'SUCCESS',
'FAIL'
) AS tx_status,
CONCAT(
tx_hash :: STRING,
'-',
event_index :: STRING
) AS _log_id,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('silver__decoded_logs') }}
{{ ref('core__ez_decoded_event_logs') }}
WHERE
topics [0] :: STRING IN (
'0xdc5bad4651c5fbe9977a696aadc65996c468cde1448dd468ec0d83bf61c4b57c',
@ -46,7 +54,7 @@ WITH base_evt AS (
'0xc05e61d0e7a63d27546389b7ad62fdff5a91aace'
)
AND origin_to_address IS NOT NULL
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -56,6 +64,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -21,32 +21,40 @@ WITH base_evt AS (
topics [0] :: STRING AS topic_0,
event_name,
TRY_TO_NUMBER(
decoded_flat :"amount" :: STRING
decoded_log :"amount" :: STRING
) AS amount,
TRY_TO_NUMBER(
decoded_flat :"chainId" :: STRING
decoded_log :"chainId" :: STRING
) AS chainId,
TRY_TO_TIMESTAMP(
decoded_flat :"deadline" :: STRING
decoded_log :"deadline" :: STRING
) AS deadline,
TRY_TO_NUMBER(
decoded_flat :"minDy" :: STRING
decoded_log :"minDy" :: STRING
) AS minDy,
decoded_flat :"to" :: STRING AS to_address,
decoded_flat :"token" :: STRING AS token,
decoded_log :"to" :: STRING AS to_address,
decoded_log :"token" :: STRING AS token,
TRY_TO_NUMBER(
decoded_flat :"tokenIndexFrom" :: STRING
decoded_log :"tokenIndexFrom" :: STRING
) AS tokenIndexFrom,
TRY_TO_NUMBER(
decoded_flat :"tokenIndexTo" :: STRING
decoded_log :"tokenIndexTo" :: STRING
) AS tokenIndexTo,
decoded_flat,
decoded_log,
event_removed,
tx_status,
_log_id,
_inserted_timestamp
IFF(
tx_succeeded,
'SUCCESS',
'FAIL'
) AS tx_status,
CONCAT(
tx_hash :: STRING,
'-',
event_index :: STRING
) AS _log_id,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('silver__decoded_logs') }}
{{ ref('core__ez_decoded_event_logs') }}
WHERE
topics [0] :: STRING IN (
'0x91f25e9be0134ec851830e0e76dc71e06f9dade75a9b84e9524071dbbc319425',
@ -54,7 +62,7 @@ WITH base_evt AS (
'0x79c15604b92ef54d3f61f0c40caab8857927ca3d5092367163b4562c1699eb5f' --depositandswap
)
AND contract_address = '0xc05e61d0e7a63d27546389b7ad62fdff5a91aace'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -64,6 +72,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -49,12 +49,16 @@ WITH token_transfers AS (
utils.udf_hex_to_int(
segmented_data [5] :: STRING
) AS nonce,
_log_id,
tr._inserted_timestamp
CONCAT(
tr.tx_hash :: STRING,
'-',
tr.event_index :: STRING
) AS _log_id,
tr.modified_timestamp AS _inserted_timestamp
FROM
{{ ref('silver__transfers') }}
{{ ref('core__ez_token_transfers') }}
tr
INNER JOIN {{ ref('silver__transactions') }}
INNER JOIN {{ ref('core__fact_transactions') }}
tx
ON tr.block_number = tx.block_number
AND tr.tx_hash = tx.tx_hash
@ -65,7 +69,7 @@ WITH token_transfers AS (
AND destination_chain_id <> 0
{% if is_incremental() %}
AND tr._inserted_timestamp >= (
AND tr.modified_timestamp >= (
SELECT
MAX(_inserted_timestamp) - INTERVAL '12 hours'
FROM
@ -112,12 +116,20 @@ native_transfers AS (
utils.udf_hex_to_int(
segmented_data [3] :: STRING
) AS nonce,
_call_id,
et._inserted_timestamp
concat_ws(
'-',
et.block_number,
et.tx_position,
CONCAT(
et.type,
'_',
et.trace_address
) AS _call_id,
et.modified_timestamp AS _inserted_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
@ -127,12 +139,13 @@ native_transfers AS (
AND destination_chain_id <> 0
{% if is_incremental() %}
AND et._inserted_timestamp >= (
AND et.modified_timestamp >= (
SELECT
MAX(_inserted_timestamp) - INTERVAL '12 hours'
FROM
{{ this }}
)
AND et.modified_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
all_transfers AS (

View File

@ -20,18 +20,22 @@ WITH pools_registered AS (
1,
42
) AS pool_address,
_log_id,
_inserted_timestamp,
CONCAT(
tx_hash :: STRING,
'-',
event_index :: STRING
) AS _log_id,
modified_timestamp AS _inserted_timestamp
ROW_NUMBER() over (
ORDER BY
pool_address
) AS row_num
FROM
{{ ref('silver__logs') }}
{{ ref('core__fact_event_logs') }}
WHERE
topics [0] :: STRING = '0x3c13bc30b8e878c53fd2a36b679409c073afd75950be43d8858768e956fbc20e' --PoolRegistered
AND contract_address = '0xba12222222228d8ba445958a75a0704d566bf2c8'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -41,6 +45,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
tokens_registered AS (
@ -50,8 +55,8 @@ tokens_registered AS (
event_index,
tx_hash,
contract_address,
decoded_flat :poolId :: STRING AS pool_id,
decoded_flat :tokens AS tokens,
decoded_log :poolId :: STRING AS pool_id,
decoded_log :tokens AS tokens,
tokens [0] :: STRING AS token0,
tokens [1] :: STRING AS token1,
tokens [2] :: STRING AS token2,
@ -60,11 +65,11 @@ tokens_registered AS (
tokens [5] :: STRING AS token5,
tokens [6] :: STRING AS token6,
tokens [7] :: STRING AS token7,
decoded_flat :assetManagers AS asset_managers,
decoded_log :assetManagers AS asset_managers,
_log_id,
_inserted_timestamp
FROM
{{ ref('silver__decoded_logs') }}
{{ ref('core__ez_decoded_event_logs') }}
WHERE
topics [0] :: STRING = '0xf5847d3f2197b16cdcd2098ec95d0905cd1abdaf415f07bb7cef2bba8ac5dec4' --TokensRegistered
AND contract_address = '0xba12222222228d8ba445958a75a0704d566bf2c8'
@ -74,7 +79,7 @@ tokens_registered AS (
FROM
pools_registered
)
AND tx_status = 'SUCCESS'
AND tx_succeeded
),
function_sigs AS (
SELECT

View File

@ -44,17 +44,21 @@ swaps_base AS (
1,
42
) AS pool_address,
_log_id,
_inserted_timestamp,
CONCAT(
tx_hash :: STRING,
'-',
event_index :: STRING
) AS _log_id,
modified_timestamp AS _inserted_timestamp,
'balancer' AS platform,
origin_from_address AS sender,
origin_from_address AS tx_to
FROM
{{ ref('silver__logs') }}
{{ ref('core__fact_event_logs') }}
WHERE
topics [0] :: STRING = '0x2170c741c41531aec20e7c107c24eecfdd15e69c9bb0a8dd37b1840b9e0b207b'
AND contract_address = '0xba12222222228d8ba445958a75a0704d566bf2c8'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -64,6 +68,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -42,8 +42,8 @@ WITH contract_deployments AS (
'0xb17b674d9c5cb2e441f8e196a2f048a81355d031'
)
AND TYPE ILIKE 'create%'
AND tx_status = 'SUCCESS'
AND trace_status = 'SUCCESS'
AND tx_succeeded
AND trace_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -53,6 +53,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
qualify(ROW_NUMBER() over(PARTITION BY to_address

View File

@ -57,10 +57,14 @@ curve_base AS (
TRY_TO_NUMBER(utils.udf_hex_to_int(
segmented_data [3] :: STRING
)) AS tokens_bought,
_log_id,
_inserted_timestamp
CONCAT(
tx_hash :: STRING,
'-',
event_index :: STRING
) AS _log_id,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('silver__logs') }} l
{{ ref('core__fact_event_logs') }} l
INNER JOIN pools p
ON p.pool_address = l.contract_address
WHERE
@ -69,7 +73,7 @@ curve_base AS (
'0xb2e76ae99761dc136e598d4a629bb347eccb9532a5f8bbd72e18467c3c34cc98', --TokenExchange
'0xd013ca23e77a65003c2c659c5442c00c805371b7fc1ebd4c206c41d1536bd90b' --TokenExchangeUnderlying
)
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -79,6 +83,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
@ -108,7 +113,7 @@ token_transfers AS (
CONCAT('0x', SUBSTR(topics [1] :: STRING, 27, 40)) AS from_address,
CONCAT('0x', SUBSTR(topics [2] :: STRING, 27, 40)) AS to_address
FROM
{{ ref('silver__logs') }}
{{ ref('core__fact_event_logs') }}
WHERE
topics [0] :: STRING = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
AND tx_hash IN (
@ -127,6 +132,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
from_transfers AS (

View File

@ -20,17 +20,21 @@ WITH pool_creation AS (
utils.udf_hex_to_int(
segmented_data [1] :: STRING
) :: INT 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 IN (
'0x5ca135cb8527d76e932f34b5145575f9d8cbe08e', --v1 factory
'0xf77ca9b635898980fb219b4f4605c50e4ba58aff' --v2 factory
)
AND topics [0] :: STRING = '0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9' --pairCreated
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -40,6 +44,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -50,16 +50,20 @@ swaps_base AS (
) AS amount1Out,
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 pools
ON l.contract_address = pool_address
WHERE
l.topics [0] :: STRING = '0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822' --Swap
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -69,6 +73,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -62,14 +62,18 @@ WITH swaps_base AS (
segmented_data [6] :: STRING
)
) AS feeBasisPoints,
_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 = '0x9ab2de34a33fb459b538c43f251eb825645e8595'
AND topics [0] :: STRING = '0x0874b2d545cb271cdbda4e093020c452328b24af12382ed62c4d00f5c26709db'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -79,6 +83,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -22,8 +22,8 @@ WITH contract_deployments AS (
'0x7677bf119654d1fbcb46cb9014949bf16180b6ae'
)
AND TYPE ILIKE 'create%'
AND tx_status = 'SUCCESS'
AND trace_status = 'SUCCESS'
AND tx_succeeded
AND trace_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -33,6 +33,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
qualify(ROW_NUMBER() over(PARTITION BY to_address

View File

@ -58,16 +58,20 @@ router_swaps_base AS (
l_segmented_data [6] :: STRING
)
) AS amountOut,
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 pools p
ON l.contract_address = p.pool_address
WHERE
l.topics [0] :: STRING = '0xb709ddcc6550418e9b89df1f4938071eeaa3f6376309904c77e15d46b16066f5' --swap
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -77,6 +81,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
swaps_base AS (
@ -124,25 +129,30 @@ swaps_base AS (
l_segmented_data [5] :: STRING
)
) AS amountOut,
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 pools p
ON l.contract_address = p.pool_address
WHERE
l.topics [0] :: STRING = '0x8cf3dec1929508e5677d7db003124e74802bfba7250a572205a9986d86ca9f1e' --swap
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
AND modified_timestamp >= (
SELECT
MAX(_inserted_timestamp) - INTERVAL '12 hours'
FROM
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
AND modified_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
FINAL AS (

View File

@ -14,14 +14,18 @@ WITH contract_deployments AS (
regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
origin_from_address AS deployer_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
contract_address = '0xde828fdc3f497f16416d1bb645261c7c6a62dab5'
AND topics [0] :: STRING = '0xdbd2a1ea6808362e6adbec4db4969cbc11e3b0b28fb6c74cb342defaaf1daada'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -31,6 +35,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -42,16 +42,20 @@ swaps AS (
segmented_data [6] :: STRING
)
) AS amountOut,
_log_id,
_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 pools p
ON l.contract_address = p.pool_address
WHERE
l.topics [0] :: STRING = '0x34f57786fb01682fb4eec88d340387ef01a168fe345ea5b76f709d4e560c10eb' --Trade
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -61,6 +65,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -27,14 +27,18 @@ WITH pool_creation AS (
segmented_data [2] :: STRING
)
) AS totalPool,
_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 = '0x10908c875d865c66f271f5d3949848971c9595c9' --dynamic fee factory
AND topics [0] :: STRING = '0xfc574402c445e75f2b79b67884ff9c662244dce454c5ae68935fcd0bebb7c8ff' --created pool
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
SELECT
@ -43,6 +47,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -55,16 +55,20 @@ swaps_base AS (
) AS feeInPrecision,
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 pools p
ON p.pool_address = l.contract_address
WHERE
l.topics [0] :: STRING = '0x606ecd02b3e3b4778f8e97b2e03351de14224efaa5fa64e62200afc9395c2499' --Dynamic Swap
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -74,6 +78,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -32,14 +32,18 @@ WITH pool_creation AS (
segmented_data [3] :: STRING
)
) AS totalPool,
_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('0x1c758aF0688502e49140230F6b0EBd376d429be5') --static pool factory
AND topics [0] :: STRING = '0xb6bce363b712c921bead4bcc977289440eb6172eb89e258e3a25bd49ca806de6' --create pool
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -49,6 +53,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -55,16 +55,20 @@ swaps_base AS (
) AS feeInPrecision,
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 pools p
ON p.pool_address = l.contract_address
WHERE
l.topics [0] :: STRING = '0x606ecd02b3e3b4778f8e97b2e03351de14224efaa5fa64e62200afc9395c2499' -- static swap
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -74,6 +78,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -23,14 +23,18 @@ WITH pool_creation AS (
)
) AS tickDistance,
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
contract_address = '0x5f1dddbf348ac2fbe22a163e30f99f9ece3dd50a' --Elastic Pool Deployer
AND topics [0] :: STRING = '0x783cca1c0412dd0d695e784568c96da2e9c22ff989357a2e8b1d9b2b4e6b7118' --Create pool
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -40,6 +44,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -68,16 +68,20 @@ swaps_base AS (
WHEN deltaQty0 > 0 THEN token0
ELSE token1
END AS token_out,
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 pools p
ON p.pool_address = l.contract_address
WHERE
topics [0] :: STRING = '0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67' -- elastic swap
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -87,6 +91,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -20,14 +20,18 @@ WITH pool_creation AS (
utils.udf_hex_to_int(
segmented_data [1] :: STRING
) :: INT 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 = '0xefa94de7a4656d787667c749f7e1223d71e9fd88' --factory
AND topics [0] :: STRING = '0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9' --create pool
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -37,6 +41,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -50,16 +50,20 @@ swaps_base AS (
) AS amount1Out,
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 pools
ON l.contract_address = pool_address
WHERE
topics [0] :: STRING = '0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822' --swap
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -69,6 +73,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -20,14 +20,18 @@ WITH pool_creation AS (
utils.udf_hex_to_int(
segmented_data [2] :: STRING
) :: INT 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('0xaaa16c016bf556fcd620328f0759252e29b1ab57')
AND topics [0] :: STRING = '0xc4805696c66d7cf352fc1d6bb633ad5ee82f6cb577c453024b6e0eb8306c6fc9' --PairCreated
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -37,6 +41,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -50,15 +50,19 @@ swaps_base AS (
CONCAT('0x', SUBSTR(topics [2] :: STRING, 27, 40)) AS tx_to,
token0,
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') }}
INNER JOIN pools p
ON p.pool_address = contract_address
WHERE
topics [0] :: STRING = '0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -68,6 +72,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -25,14 +25,18 @@ WITH created_pools AS (
segmented_data [0] :: STRING
)) 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] = '0x783cca1c0412dd0d695e784568c96da2e9c22ff989357a2e8b1d9b2b4e6b7118'
AND contract_address = '0xaaa32926fce6be95ea2c51cb4fcb60836d320c42'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -42,6 +46,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
initial_info AS (
@ -55,10 +60,10 @@ initial_info AS (
init_tick
) AS init_price_1_0_unadj
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 >= (
@ -68,6 +73,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),

View File

@ -34,11 +34,11 @@ WITH base_swaps AS (
segmented_data [4] :: STRING
) :: FLOAT AS tick
FROM
{{ ref('silver__logs') }}
{{ ref('core__fact_event_logs') }}
WHERE
block_timestamp :: DATE >= '2023-03-23'
AND topics [0] :: STRING = '0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67'
AND tx_status = 'SUCCESS'
AND tx_succeeded
AND event_removed = 'false'
{% if is_incremental() %}
@ -49,6 +49,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
pool_data AS (

View File

@ -19,8 +19,8 @@ WITH contract_deployments AS (
WHERE
from_address = '0x416a7989a964c9ed60257b064efc3a30fe6bf2ee'
AND TYPE ILIKE 'create%'
AND tx_status = 'SUCCESS'
AND trace_status = 'SUCCESS'
AND tx_succeeded
AND trace_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -30,6 +30,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
qualify(ROW_NUMBER() over(PARTITION BY to_address

View File

@ -54,16 +54,20 @@ swaps_base AS (
l_segmented_data [3] :: STRING
)
) AS toAmount,
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 pools p
ON l.contract_address = p.pool_address
WHERE
topics [0] :: STRING = '0x54787c404bb33c88e86f4baf88183a3b0141d0a848e6a9f7a13b66ae3a9b73d1'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -73,6 +77,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -20,14 +20,18 @@ WITH pool_creation AS (
utils.udf_hex_to_int(
segmented_data [1] :: STRING
) :: INT 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('0xc35DADB65012eC5796536bD9864eD8773aBc74C4')
AND topics [0] :: STRING = '0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9' --PairCreated
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -37,6 +41,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -50,15 +50,19 @@ swaps_base AS (
CONCAT('0x', SUBSTR(topics [2] :: STRING, 27, 40)) AS tx_to,
token0,
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') }}
INNER JOIN pools p
ON p.pool_address = contract_address
WHERE
topics [0] :: STRING = '0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -68,6 +72,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -20,14 +20,18 @@ WITH pool_creation AS (
utils.udf_hex_to_int(
segmented_data [1] :: STRING
) :: INT 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('0x9Ad6C38BE94206cA50bb0d90783181662f0Cfa10')
AND topics [0] :: STRING = '0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9' --PairCreated
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -37,6 +41,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -50,16 +50,20 @@ swaps_base AS (
) AS amount1Out,
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 pools p
ON p.pool_address = l.contract_address
WHERE
l.topics [0] :: STRING = '0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822' --Swap
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -69,6 +73,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -72,16 +72,20 @@ swaps_base AS (
tokenX,
tokenY,
p.version,
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 pools p
ON lb_pair = l.contract_address
WHERE
topics [0] :: STRING = '0xad7d6f97abf51ce18e17a38f4d70e975be9c0708474987bb3e26ad21bd93ca70' --Swap
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -91,6 +95,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -28,10 +28,14 @@ WITH pool_creation AS (
WHEN contract_address = '0x8e42f2f4101563bf679975178e880fd87d3efd4e' THEN 'v2.1'
WHEN contract_address = '0xb43120c4745967fa9b93e79c149e66b0f2d6fe0c' THEN 'v2.2'
END AS version,
_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 IN (
'0x8e42f2f4101563bf679975178e880fd87d3efd4e',
@ -41,7 +45,7 @@ WITH pool_creation AS (
'0xb43120c4745967fa9b93e79c149e66b0f2d6fe0c' --v2.2
)
AND topics [0] :: STRING = '0x2c8d104b27c6b7f4492017a6f5cf3803043688934ebcaa6a03540beeaf976aff' --LB PairCreated
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -51,6 +55,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -70,17 +70,21 @@ swaps_base AS (
WHEN swapForY THEN tokenX
ELSE tokenY
END AS token_in_address,
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 pools p
ON lb_pair = l.contract_address
WHERE
topics [0] :: STRING = '0xc528cda9e500228b16ce84fadae290d9a49aecb17483110004c5af0a07f6fd73' --Swap
AND version = 'v2'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -90,6 +94,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -20,14 +20,18 @@ WITH pool_creation AS (
utils.udf_hex_to_int(
segmented_data [1] :: STRING
) :: INT 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('0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C')
AND topics [0] :: STRING = '0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9' --PairCreated
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -37,6 +41,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -50,15 +50,19 @@ swaps_base AS (
CONCAT('0x', SUBSTR(topics [2] :: STRING, 27, 40)) AS tx_to,
token0,
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') }}
INNER JOIN pools p
ON p.pool_address = contract_address
WHERE
topics [0] :: STRING = '0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -68,6 +72,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -25,14 +25,18 @@ WITH created_pools AS (
segmented_data [0] :: STRING
)) 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] = '0x783cca1c0412dd0d695e784568c96da2e9c22ff989357a2e8b1d9b2b4e6b7118'
AND contract_address = '0x740b1c1de25031c31ff4fc9a62f554a55cdc1bad'
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -42,6 +46,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
initial_info AS (
@ -55,10 +60,10 @@ initial_info AS (
init_tick
) AS init_price_1_0_unadj
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 >= (
@ -68,6 +73,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),

View File

@ -34,11 +34,11 @@ WITH base_swaps AS (
segmented_data [4] :: STRING
) :: FLOAT AS tick
FROM
{{ ref('silver__logs') }}
{{ ref('core__fact_event_logs') }}
WHERE
block_timestamp :: DATE >= '2023-03-23'
AND topics [0] :: STRING = '0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67'
AND tx_status = 'SUCCESS'
AND tx_succeeded
AND event_removed = 'false'
{% if is_incremental() %}
@ -49,6 +49,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
pool_data AS (
@ -77,8 +78,12 @@ FINAL AS (
event_index,
token0_address,
token1_address,
_log_id,
_inserted_timestamp,
CONCAT(
tx_hash :: STRING,
'-',
event_index :: STRING
) AS _log_id,
modified_timestamp AS _inserted_timestamp,
origin_function_signature,
origin_from_address,
origin_to_address,

View File

@ -52,10 +52,14 @@ WITH router_swaps_base AS (
40
)
) AS rebateTo,
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
WHERE
contract_address IN (
@ -65,7 +69,7 @@ WITH router_swaps_base AS (
'0x4c4af8dbc524681930a27b2f1af5bcc8062e6fb7' --v2
)
AND topics [0] :: STRING = '0x27c98e911efdd224f4002f6cd831c3ad0d2759ee176f9ee8466d95826af22a1c' --WooRouterSwap
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -75,6 +79,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
),
swaps_base AS (
@ -117,10 +122,14 @@ swaps_base AS (
40
)
) AS rebateTo,
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
WHERE
contract_address IN (
@ -139,7 +148,7 @@ swaps_base AS (
FROM
router_swaps_base
)
AND tx_status = 'SUCCESS'
AND tx_succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= (
@ -149,6 +158,7 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
)
SELECT

View File

@ -61,10 +61,14 @@ borrow AS (
origin_to_address,
contract_address
) AS lending_pool_contract,
_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 (
'0xc6a898309e823ee50bac64e45ca8adba6690e99e7841c45d754e2a38e9019d9b',
@ -78,9 +82,10 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
AND contract_address IN (SELECT distinct(aave_version_pool) from atoken_meta)
AND tx_status = 'SUCCESS' --excludes failed txs
AND tx_succeeded --excludes failed txs
)
SELECT
tx_hash,

View File

@ -55,10 +55,14 @@ deposits AS(
origin_to_address,
contract_address
) AS lending_pool_contract,
_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 (
'0xde6857219544bb5b7746f48ed30be6386fefc61b2f864cacf559893bf50fd951',
@ -72,9 +76,10 @@ AND _inserted_timestamp >= (
{{ this }}
)
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
{% endif %}
AND contract_address IN (SELECT distinct(aave_version_pool) from atoken_meta)
AND tx_status = 'SUCCESS' --excludes failed txs
AND tx_succeeded --excludes failed txs
)
SELECT
tx_hash,

Some files were not shown because too many files have changed in this diff Show More