-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* stash * typo * name * spacing * event_index * date * fixes * typo --------- Co-authored-by: sam <[email protected]>
- Loading branch information
1 parent
4084865
commit 2b92ed5
Showing
102 changed files
with
1,881 additions
and
549 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
{% docs deprecation %} | ||
{% docs internal_column %} | ||
|
||
Deprecating soon: This is a notice that we're only removing the below columns. Please migrate queries using these columns to `fact_decoded_event_logs`, `ez_decoded_event_logs` or use manual parsing of topics and data. The following columns will be deprecated on 7/16/23: | ||
Deprecated. This column is no longer used. Please remove from your query by Jan. 31 2024.' | ||
|
||
`Fact_event_logs` Columns: | ||
- `event_name` | ||
- `event_inputs` | ||
- `contract_name` | ||
{% enddocs %} | ||
|
||
{% docs amount_deprecation %} | ||
|
||
This column is being deprecated for standardization purposes on Jan. 31 2024. Please use the equivalent column without the native asset prefix. For example, use `amount` instead of `eth_amount`. | ||
|
||
`Fact_transactions` Columns: | ||
- `tx_json` | ||
{% enddocs %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{% docs pk %} | ||
|
||
The unique identifier for each row in the table. | ||
|
||
{% enddocs %} | ||
|
||
{% docs inserted_timestamp %} | ||
|
||
The utc timestamp at which the row was inserted into the table. | ||
|
||
{% enddocs %} | ||
|
||
{% docs modified_timestamp %} | ||
|
||
The utc timestamp at which the row was last modified. | ||
|
||
{% enddocs %} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{% docs nft_intra_event_index %} | ||
|
||
The order of events within a single event index. This is primarily used for ERC1155 NFT batch transfer events. | ||
|
||
{% enddocs %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{% docs opt_trace_index %} | ||
|
||
The index of the trace within the transaction. | ||
|
||
{% enddocs %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,26 @@ | ||
{{ config( | ||
materialized = 'incremental', | ||
incremental_strategy = 'delete+insert', | ||
unique_key = 'block_number', | ||
cluster_by = ['block_timestamp::DATE'], | ||
tags = ['core','non_realtime','reorg'], | ||
materialized = 'view', | ||
persist_docs ={ "relation": true, | ||
"columns": true } | ||
) }} | ||
|
||
WITH eth_base AS ( | ||
|
||
SELECT | ||
tx_hash, | ||
block_number, | ||
block_timestamp, | ||
identifier, | ||
from_address, | ||
to_address, | ||
eth_value, | ||
_call_id, | ||
_inserted_timestamp, | ||
eth_value_precise_raw, | ||
eth_value_precise, | ||
tx_position, | ||
trace_index | ||
FROM | ||
{{ ref('silver__traces') }} | ||
WHERE | ||
eth_value > 0 | ||
AND tx_status = 'SUCCESS' | ||
AND trace_status = 'SUCCESS' | ||
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 | ||
eth_base | ||
) | ||
|
||
{% if is_incremental() %} | ||
AND _inserted_timestamp >= ( | ||
SELECT | ||
MAX(_inserted_timestamp) - INTERVAL '72 hours' | ||
FROM | ||
{{ this }} | ||
) | ||
{% 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, | ||
from_address AS eth_from_address, | ||
to_address AS eth_to_address, | ||
eth_value AS amount, | ||
eth_value_precise_raw AS amount_precise_raw, | ||
eth_value_precise AS amount_precise, | ||
ROUND( | ||
eth_value * price, | ||
2 | ||
) AS amount_usd, | ||
amount, | ||
amount_precise_raw, | ||
amount_precise, | ||
amount_usd, | ||
_call_id, | ||
_inserted_timestamp, | ||
tx_position, | ||
trace_index | ||
FROM | ||
eth_base A | ||
LEFT JOIN {{ ref('silver__hourly_prices_priority_eth') }} | ||
ON DATE_TRUNC( | ||
'hour', | ||
A.block_timestamp | ||
) = HOUR | ||
JOIN tx_table USING ( | ||
tx_hash, | ||
block_number | ||
) | ||
{{ ref('silver__native_transfers') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{{ config( | ||
materialized = 'view', | ||
persist_docs ={ "relation": true, | ||
"columns": true } | ||
) }} | ||
|
||
SELECT | ||
tx_hash, | ||
block_number, | ||
block_timestamp, | ||
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 | ||
FROM | ||
{{ ref('silver__native_transfers') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
version: 2 | ||
models: | ||
- name: core__ez_native_transfers | ||
description: '{{ doc("opt_ez_eth_transfers_table_doc") }}' | ||
|
||
columns: | ||
- name: TX_HASH | ||
description: '{{ doc("opt_transfer_tx_hash") }}' | ||
- name: BLOCK_NUMBER | ||
description: '{{ doc("opt_block_number") }}' | ||
- name: BLOCK_TIMESTAMP | ||
description: '{{ doc("opt_block_timestamp") }}' | ||
- name: TX_POSITION | ||
description: '{{ doc("opt_tx_position") }}' | ||
- name: TRACE_INDEX | ||
description: '{{ doc("opt_trace_index") }}' | ||
- name: IDENTIFIER | ||
description: '{{ doc("opt_traces_identifier") }}' | ||
- name: ORIGIN_FROM_ADDRESS | ||
description: '{{ doc("opt_origin_from") }}' | ||
- name: ORIGIN_TO_ADDRESS | ||
description: '{{ doc("opt_origin_to") }}' | ||
- name: ORIGIN_FUNCTION_SIGNATURE | ||
description: '{{ doc("opt_origin_sig") }}' | ||
- name: FROM_ADDRESS | ||
description: '{{ doc("opt_transfer_from_address") }}' | ||
- name: TO_ADDRESS | ||
description: '{{ doc("opt_transfer_to_address") }}' | ||
- name: AMOUNT | ||
description: '{{ doc("opt_eth_amount") }}' | ||
- name: AMOUNT_PRECISE_RAW | ||
description: '{{ doc("precise_amount_unadjusted") }}' | ||
- name: AMOUNT_PRECISE | ||
description: '{{ doc("precise_amount_adjusted") }}' | ||
- name: AMOUNT_USD | ||
description: '{{ doc("opt_eth_amount_usd") }}' | ||
- name: EZ_NATIVE_TRANSFERS_ID | ||
description: '{{ doc("pk") }}' | ||
- name: INSERTED_TIMESTAMP | ||
description: '{{ doc("inserted_timestamp") }}' | ||
- name: MODIFIED_TIMESTAMP | ||
description: '{{ doc("modified_timestamp") }}' |
Oops, something went wrong.