mirror of
https://github.com/FlipsideCrypto/kaia-models.git
synced 2026-02-06 14:11:45 +00:00
Merge pull request #63 from FlipsideCrypto/fix-native-transfers
updates
This commit is contained in:
commit
162123fade
@ -13,18 +13,14 @@ SELECT
|
||||
to_address AS created_contract_address,
|
||||
from_address AS creator_address,
|
||||
input AS created_contract_input,
|
||||
_inserted_timestamp,
|
||||
modified_timestamp as _inserted_timestamp,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['to_address']
|
||||
) }} AS created_contracts_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
{{ source(
|
||||
'klaytn_silver',
|
||||
'traces'
|
||||
) }}
|
||||
FROM {{ ref('core__fact_traces') }}
|
||||
WHERE
|
||||
TYPE ILIKE 'create%'
|
||||
AND to_address IS NOT NULL
|
||||
@ -44,4 +40,4 @@ AND _inserted_timestamp >= (
|
||||
|
||||
qualify(ROW_NUMBER() over(PARTITION BY created_contract_address
|
||||
ORDER BY
|
||||
block_number DESC, _inserted_timestamp DESC)) = 1
|
||||
_inserted_timestamp DESC)) = 1
|
||||
@ -17,14 +17,23 @@ WITH base AS (
|
||||
from_address,
|
||||
to_address,
|
||||
value,
|
||||
_call_id,
|
||||
_inserted_timestamp,
|
||||
concat_ws(
|
||||
'-',
|
||||
block_number,
|
||||
tx_position,
|
||||
CONCAT(
|
||||
TYPE,
|
||||
'_',
|
||||
trace_address
|
||||
)
|
||||
) AS _call_id,
|
||||
modified_timestamp AS _inserted_timestamp,
|
||||
value_precise_raw,
|
||||
value_precise,
|
||||
tx_position,
|
||||
trace_index
|
||||
FROM
|
||||
{{ ref('silver__traces') }}
|
||||
{{ ref('core__fact_traces') }}
|
||||
WHERE
|
||||
value > 0
|
||||
AND tx_status = TRUE
|
||||
@ -35,7 +44,7 @@ WITH base AS (
|
||||
)
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
AND modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp) - INTERVAL '72 hours'
|
||||
FROM
|
||||
@ -87,7 +96,7 @@ SELECT
|
||||
2
|
||||
) AS amount_usd,
|
||||
_call_id,
|
||||
_inserted_timestamp,
|
||||
a._inserted_timestamp,
|
||||
tx_position,
|
||||
trace_index,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user