mirror of
https://github.com/FlipsideCrypto/polygon-models.git
synced 2026-02-06 13:41:53 +00:00
id and timestamp columns
This commit is contained in:
parent
8670911772
commit
5526975ba9
16
models/gold/core/core__dim_contract_abis.sql
Normal file
16
models/gold/core/core__dim_contract_abis.sql
Normal file
@ -0,0 +1,16 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
persist_docs ={ "relation": true,
|
||||
"columns": true }
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
contract_address,
|
||||
DATA AS abi,
|
||||
abi_source,
|
||||
bytecode,
|
||||
abis_id AS dim_contract_abis_id,
|
||||
inserted_timestamp,
|
||||
modified_timestamp
|
||||
FROM
|
||||
{{ ref('silver__abis') }}
|
||||
19
models/gold/core/core__dim_contract_abis.yml
Normal file
19
models/gold/core/core__dim_contract_abis.yml
Normal file
@ -0,0 +1,19 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__dim_contract_abis
|
||||
description: >
|
||||
'This table contains the contract ABIs that we have sourced from Polygonscan, the community, or bytecode matched. This table is the source of ABIs used in the `core__ez_decoded_event_logs` and `core__fact_decoded_event_logs` tables.
|
||||
We first try to source ABIs from Polygonscan. If we cannot find an ABI on Polygonscan, we will rely on user submissions. To add a contract to this table, please visit [here](https://science.flipsidecrypto.xyz/abi-requestor/).
|
||||
If we are unable to locate an ABI for a contract from Polygonscan or the community, we will try to find an ABI to use by matching the contract bytecode to a known contract bytecode we do have an ABI for.'
|
||||
|
||||
columns:
|
||||
- name: CONTRACT_ADDRESS
|
||||
description: 'The address of the contract.'
|
||||
- name: ABI
|
||||
description: 'The JSON ABI for the contract.'
|
||||
- name: ABI_SOURCE
|
||||
description: 'The source of the ABI. This can be `Polygonscan`, `user_submitted`, or `bytecode_matched`.'
|
||||
- name: BYTECODE
|
||||
description: 'The deployed bytecode of the contract.'
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
{{ config (
|
||||
materialized = "incremental",
|
||||
unique_key = "contract_address",
|
||||
merge_exclude_columns = ["inserted_timestamp"],
|
||||
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION on equality(contract_address)",
|
||||
tags = ['abis']
|
||||
) }}
|
||||
@ -167,7 +168,13 @@ SELECT
|
||||
p.abi_source,
|
||||
p.discord_username,
|
||||
p.abi_hash,
|
||||
created_contract_input AS bytecode
|
||||
created_contract_input AS bytecode,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['contract_address']
|
||||
) }} AS abis_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
priority_abis p
|
||||
LEFT JOIN {{ ref('silver__created_contracts') }}
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
unique_key = ['block_number', 'event_index'],
|
||||
cluster_by = "block_timestamp::date",
|
||||
incremental_predicates = ["dynamic_range", "block_number"],
|
||||
merge_exclude_columns = ["inserted_timestamp"],
|
||||
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION",
|
||||
tags = ['decoded_logs2']
|
||||
) }}
|
||||
@ -207,7 +208,13 @@ SELECT
|
||||
DATA,
|
||||
event_removed,
|
||||
tx_status,
|
||||
is_pending
|
||||
is_pending,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['tx_hash','event_index']
|
||||
) }} AS decoded_logs_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
new_records
|
||||
|
||||
@ -232,7 +239,13 @@ SELECT
|
||||
DATA,
|
||||
event_removed,
|
||||
tx_status,
|
||||
is_pending
|
||||
is_pending,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['tx_hash','event_index']
|
||||
) }} AS decoded_logs_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
missing_data
|
||||
{% endif %}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user