mirror of
https://github.com/FlipsideCrypto/gnosis-models.git
synced 2026-02-06 12:57:05 +00:00
* initial set up * macros and workflows * wh * defi and nft tags * protocol tags * streamline * docs * package * package * v59 * gitignore
59 lines
1.6 KiB
SQL
59 lines
1.6 KiB
SQL
{{ config(
|
|
materialized = 'incremental',
|
|
incremental_strategy = 'delete+insert',
|
|
unique_key = 'block_number',
|
|
cluster_by = ['block_timestamp::DATE'],
|
|
tags = ['silver_olas','curated','olas']
|
|
) }}
|
|
|
|
SELECT
|
|
block_number,
|
|
block_timestamp,
|
|
tx_hash,
|
|
origin_function_signature,
|
|
origin_from_address,
|
|
origin_to_address,
|
|
contract_address,
|
|
event_index,
|
|
topic_0,
|
|
topic_1,
|
|
topic_2,
|
|
topic_3,
|
|
'CreateMultisigWithAgents' AS event_name,
|
|
DATA,
|
|
regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
|
|
TRY_TO_NUMBER(
|
|
utils.udf_hex_to_int(
|
|
topic_1
|
|
)
|
|
) AS id,
|
|
CONCAT('0x', SUBSTR(topic_2, 27, 40)) AS multisig_address,
|
|
CONCAT(
|
|
tx_hash :: STRING,
|
|
'-',
|
|
event_index :: STRING
|
|
) AS _log_id,
|
|
modified_timestamp AS _inserted_timestamp,
|
|
{{ dbt_utils.generate_surrogate_key(
|
|
['tx_hash','event_index']
|
|
) }} AS create_service_multisigs_id,
|
|
SYSDATE() AS inserted_timestamp,
|
|
SYSDATE() AS modified_timestamp,
|
|
'{{ invocation_id }}' AS _invocation_id
|
|
FROM
|
|
{{ ref('core__fact_event_logs') }}
|
|
WHERE
|
|
contract_address = '0x9338b5153ae39bb89f50468e608ed9d764b755fd' --Service Registry (AUTONOLAS-SERVICE-V1)
|
|
AND topic_0 = '0x2d53f895cd5faf3cddba94a25c2ced2105885b5b37450ff430ffa3cbdf332c74' --CreateMultisigWithAgents
|
|
AND tx_succeeded
|
|
|
|
{% if is_incremental() %}
|
|
AND _inserted_timestamp >= (
|
|
SELECT
|
|
MAX(_inserted_timestamp) - INTERVAL '12 hours'
|
|
FROM
|
|
{{ this }}
|
|
)
|
|
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
|
|
{% endif %}
|