Merge branch 'main' into dat2-253-monad-staking-reads

This commit is contained in:
Eric Laurello 2026-01-26 12:55:14 -05:00
commit 24aad895df
5 changed files with 107 additions and 42 deletions

View File

@ -30,6 +30,9 @@
},
'v3': {
'uni_v3_pool_created': '0x1f98431c8ad98523631ae4a59f267346ea31f984'
},
'v4': {
'factory': '0x9a13f98cb987694c9f086b1f5eb990eea8264ec3'
}
},
'sushiswap': {

View File

@ -45,6 +45,7 @@ logs AS (
FROM
{{ ref('core__fact_event_logs') }}
WHERE
(
(
contract_address IN (
SELECT
@ -55,6 +56,7 @@ logs AS (
AND topic_0 = '0x15955c5a4cc61b8fbb05301bce47fd31c0e6f935e1ab97fdac9b134c887bb074' --busRode
)
OR topic_0 = '0x85496b760a4b7f8d66384b9df21b381f5d1b1e79f229a47aaf4c232edc2fe59a' --OFTSent
)
{% if is_incremental() %}
AND modified_timestamp >= (

View File

@ -13,27 +13,7 @@
tags = ['silver_dex','defi','dex','curated','heal','complete','lp_actions']
) }}
WITH contracts AS (
SELECT
address AS contract_address,
symbol AS token_symbol,
decimals AS token_decimals,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('core__dim_contracts') }}
UNION ALL
SELECT
'0x0000000000000000000000000000000000000000' AS contract_address,
'{{ vars.GLOBAL_NATIVE_ASSET_SYMBOL }}' AS token_symbol,
decimals AS token_decimals,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('core__dim_contracts') }}
WHERE
address = '{{ vars.GLOBAL_WRAPPED_NATIVE_ASSET_ADDRESS }}'
),
prices AS (
WITH prices AS (
SELECT
token_address,
price,
@ -65,6 +45,7 @@ poolcreated_evt_v3 AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -111,6 +92,7 @@ paircreated_evt_v2 AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -157,6 +139,7 @@ aerodrome AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -203,6 +186,7 @@ pharaoh_v1 AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -249,6 +233,7 @@ kyberswap_v1_dynamic AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -295,6 +280,7 @@ kyberswap_v2_elastic AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -341,6 +327,7 @@ dodo_v1 AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -387,6 +374,7 @@ pancakeswap_v3 AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -433,6 +421,7 @@ camelot_v2 AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -479,6 +468,7 @@ quickswap_v2 AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -526,6 +516,7 @@ quickswap_v4 AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -573,6 +564,7 @@ dackie AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -619,6 +611,7 @@ superchain_slipstream AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -665,6 +658,7 @@ sushiswap AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -711,6 +705,7 @@ trader_joe_v2 AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -757,6 +752,7 @@ zyberswap_v2 AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -803,6 +799,7 @@ uniswap_v1 AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -849,6 +846,7 @@ velodrome_v1 AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -895,6 +893,7 @@ velodrome_v2 AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -941,6 +940,7 @@ balancer AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
token2,
@ -987,6 +987,7 @@ curve AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
token2,
@ -1033,6 +1034,7 @@ fluid_v1 AS (
sender,
receiver,
pool_address,
'0x' AS pool_id,
token0,
token1,
NULL AS token2,
@ -1179,6 +1181,41 @@ all_pools AS (
FROM
fluid_v1
),
token_addresses AS (
SELECT DISTINCT token_address
FROM all_pools
UNPIVOT (token_address FOR token_position IN (token0, token1, token2, token3, token4, token5, token6, token7))
WHERE token_address IS NOT NULL
{% if is_incremental() and var('HEAL_MODEL') %}
UNION
SELECT DISTINCT value::STRING AS token_address
FROM {{ this }},
LATERAL FLATTEN(input => tokens)
WHERE value IS NOT NULL
{% endif %}
),
contracts AS (
SELECT
address AS contract_address,
symbol AS token_symbol,
decimals AS token_decimals,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('core__dim_contracts') }}
WHERE
address IN (SELECT token_address FROM token_addresses)
UNION ALL
SELECT
'0x0000000000000000000000000000000000000000' AS contract_address,
'{{ vars.GLOBAL_NATIVE_ASSET_SYMBOL }}' AS token_symbol,
decimals AS token_decimals,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('core__dim_contracts') }}
WHERE
address = '{{ vars.GLOBAL_WRAPPED_NATIVE_ASSET_ADDRESS }}'
AND '0x0000000000000000000000000000000000000000' IN (SELECT token_address FROM token_addresses)
),
complete_lps AS (
SELECT
A.block_number,
@ -1190,6 +1227,7 @@ complete_lps AS (
sender,
receiver,
A.pool_address,
A.pool_id,
lp.pool_name,
A.token0,
A.token1,
@ -1306,6 +1344,7 @@ complete_lps AS (
LEFT JOIN {{ ref('silver_dex__complete_dex_liquidity_pools') }}
lp
ON lp.pool_address = A.pool_address
AND lp.pool_id = A.pool_id
LEFT JOIN contracts c0
ON c0.contract_address = A.token0
LEFT JOIN contracts c1
@ -1386,6 +1425,7 @@ heal_model AS (
sender,
receiver,
t0.pool_address,
'0x' AS pool_id,
lp.pool_name AS pool_name_heal,
t0.tokens,
OBJECT_CONSTRUCT_KEEP_NULL(
@ -1539,6 +1579,7 @@ heal_model AS (
LEFT JOIN {{ ref('silver_dex__complete_dex_liquidity_pools') }}
lp
ON lp.pool_address = t0.pool_address
AND lp.pool_id = '0x'
LEFT JOIN contracts c0
ON c0.contract_address = t0.tokens :token0
LEFT JOIN contracts c1

View File

@ -13,27 +13,7 @@
tags = ['silver_dex','defi','dex','curated','heal','complete','lp']
) }}
WITH contracts AS (
SELECT
address AS contract_address,
symbol AS token_symbol,
decimals AS token_decimals,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('core__dim_contracts') }}
UNION ALL
SELECT
'0x0000000000000000000000000000000000000000' AS contract_address,
'{{ vars.GLOBAL_NATIVE_ASSET_SYMBOL }}' AS token_symbol,
decimals AS token_decimals,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('core__dim_contracts') }}
WHERE
address = '{{ vars.GLOBAL_WRAPPED_NATIVE_ASSET_ADDRESS }}'
),
balancer AS (
WITH balancer AS (
SELECT
block_number,
block_timestamp,
@ -1360,6 +1340,41 @@ all_pools AS (
FROM
fluid_v1
),
token_addresses AS (
SELECT DISTINCT token_address
FROM all_pools
UNPIVOT (token_address FOR token_position IN (token0, token1, token2, token3, token4, token5, token6, token7))
WHERE token_address IS NOT NULL
{% if is_incremental() and var('HEAL_MODEL') %}
UNION
SELECT DISTINCT token_address
FROM {{ this }}
UNPIVOT (token_address FOR token_position IN (token0, token1, token2, token3, token4, token5, token6, token7))
WHERE token_address IS NOT NULL
{% endif %}
),
contracts AS (
SELECT
address AS contract_address,
symbol AS token_symbol,
decimals AS token_decimals,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('core__dim_contracts') }}
WHERE
address IN (SELECT token_address FROM token_addresses)
UNION ALL
SELECT
'0x0000000000000000000000000000000000000000' AS contract_address,
'{{ vars.GLOBAL_NATIVE_ASSET_SYMBOL }}' AS token_symbol,
decimals AS token_decimals,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('core__dim_contracts') }}
WHERE
address = '{{ vars.GLOBAL_WRAPPED_NATIVE_ASSET_ADDRESS }}'
AND '0x0000000000000000000000000000000000000000' IN (SELECT token_address FROM token_addresses)
),
complete_lps AS (
SELECT
block_number,

View File

@ -1,3 +1,6 @@
{# Get variables #}
{% set vars = return_vars() %}
{# Log configuration details #}
{{ log_model_details() }}
@ -81,6 +84,7 @@ AND DATE_TRUNC(
'hour',
block_timestamp
) >= '{{ min_block_timestamp_hour }}'
AND block_timestamp::DATE >= SYSDATE() - INTERVAL '{{ vars.CURATED_LOOKBACK_DAYS }}'
{% endif %}
GROUP BY
1