-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* new columns * remove internal columns from gold * amt * edits * SO * update pk * typo * tags * date * add event index and unique * tx fees * name * add contracts heal logic * add changes to gold * non null test * add non null test * add lookback * remove symbol * greatest date * coalesce * tx count * trade id * date --------- Co-authored-by: sam <[email protected]>
- Loading branch information
1 parent
c06f91a
commit 52b6b48
Showing
68 changed files
with
1,065 additions
and
258 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% docs internal_column %} | ||
|
||
Deprecated. This column is no longer used. Please remove from your query by Jan. 31 2024. | ||
|
||
{% 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`. | ||
|
||
{% 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 base_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("base_ez_eth_transfers_table_doc") }}' | ||
|
||
columns: | ||
- name: TX_HASH | ||
description: '{{ doc("base_transfer_tx_hash") }}' | ||
- name: BLOCK_NUMBER | ||
description: '{{ doc("base_block_number") }}' | ||
- name: BLOCK_TIMESTAMP | ||
description: '{{ doc("base_block_timestamp") }}' | ||
- name: TX_POSITION | ||
description: '{{ doc("base_tx_position") }}' | ||
- name: TRACE_INDEX | ||
description: '{{ doc("base_trace_index") }}' | ||
- name: IDENTIFIER | ||
description: '{{ doc("base_traces_identifier") }}' | ||
- name: ORIGIN_FROM_ADDRESS | ||
description: '{{ doc("base_origin_from") }}' | ||
- name: ORIGIN_TO_ADDRESS | ||
description: '{{ doc("base_origin_to") }}' | ||
- name: ORIGIN_FUNCTION_SIGNATURE | ||
description: '{{ doc("base_origin_sig") }}' | ||
- name: FROM_ADDRESS | ||
description: '{{ doc("base_transfer_from_address") }}' | ||
- name: TO_ADDRESS | ||
description: '{{ doc("base_transfer_to_address") }}' | ||
- name: AMOUNT | ||
description: '{{ doc("base_eth_amount") }}' | ||
- name: AMOUNT_PRECISE_RAW | ||
description: '{{ doc("precise_amount_unadjusted") }}' | ||
- name: AMOUNT_PRECISE | ||
description: '{{ doc("precise_amount_adjusted") }}' | ||
- name: AMOUNT_USD | ||
description: '{{ doc("base_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") }}' |
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
Oops, something went wrong.