AN-5443/aave-token-model-updates (#345)

* add updates

* update config

* remove lower
This commit is contained in:
Matt Romano 2025-06-12 08:21:25 -07:00 committed by GitHub
parent 150c2f760c
commit 5a8502edad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 11 deletions

View File

@ -1,5 +1,6 @@
{{ config(
materialized = 'incremental',
unique_key = 'atoken_address',
tags = ['silver','defi','lending','curated']
) }}
@ -11,6 +12,7 @@ WITH DECODE AS (
regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
CONCAT('0x', SUBSTR(topics [1] :: STRING, 27, 40)) AS underlying_asset,
CONCAT('0x', SUBSTR(topics [2] :: STRING, 27, 40)) AS aave_version_pool,
CONCAT('0x', SUBSTR(segmented_data [0] :: STRING, 25, 40)) AS treasury_address,
utils.udf_hex_to_int(
SUBSTR(
segmented_data [2] :: STRING,
@ -32,7 +34,6 @@ WITH DECODE AS (
) AS _log_id
FROM
{{ ref('core__fact_event_logs') }}
l
WHERE
topics [0] = '0xb19e051f8af41150ccccb3fc2c2d8d15f4a4cf434f32a559ba75fe73d6eea20b'
@ -61,6 +62,7 @@ a_token_step_1 AS (
segmented_data,
underlying_asset,
aave_version_pool,
treasury_address,
atoken_decimals,
atoken_name,
atoken_symbol,
@ -69,7 +71,7 @@ a_token_step_1 AS (
FROM
DECODE
WHERE
atoken_name LIKE '%Aave%'
treasury_address = '0x053d55f9b5af8694c503eb288a1b7e552f590710'
),
debt_tokens AS (
SELECT
@ -103,6 +105,7 @@ a_token_step_2 AS (
a_token_address,
segmented_data,
underlying_asset,
treasury_address,
aave_version_pool,
atoken_decimals,
atoken_name,
@ -112,11 +115,11 @@ a_token_step_2 AS (
'Aave V3' AS protocol
FROM
a_token_step_1
WHERE
aave_version_pool = LOWER('0x794a61358D6845594F94dc1DB02A252b5b4814aD')
)
SELECT
A.atoken_created_block,
A.aave_version_pool,
A.treasury_address,
A.atoken_symbol AS atoken_symbol,
A.a_token_address AS atoken_address,
b.atoken_stable_debt_address,

View File

@ -1,5 +1,6 @@
{{ config(
materialized = 'incremental',
unique_key = 'atoken_address',
tags = ['silver','defi','lending','curated']
) }}
@ -11,6 +12,7 @@ WITH DECODE AS (
regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
CONCAT('0x', SUBSTR(topics [1] :: STRING, 27, 40)) AS underlying_asset,
CONCAT('0x', SUBSTR(topics [2] :: STRING, 27, 40)) AS radiant_version_pool,
CONCAT('0x', SUBSTR(segmented_data [0] :: STRING, 25, 40)) AS treasury_address,
utils.udf_hex_to_int(
SUBSTR(
segmented_data [2] :: STRING,
@ -32,7 +34,6 @@ WITH DECODE AS (
) AS _log_id
FROM
{{ ref('core__fact_event_logs') }}
l
WHERE
topics [0] = '0xb19e051f8af41150ccccb3fc2c2d8d15f4a4cf434f32a559ba75fe73d6eea20b'
@ -61,6 +62,7 @@ a_token_step_1 AS (
segmented_data,
underlying_asset,
radiant_version_pool,
treasury_address,
atoken_decimals,
atoken_name,
atoken_symbol,
@ -69,7 +71,7 @@ a_token_step_1 AS (
FROM
DECODE
WHERE
atoken_name LIKE '%Radiant%'
treasury_address = '0xe10997b8d5c6e8b660451f61accf4bba00bc901f'
),
debt_tokens AS (
SELECT
@ -103,6 +105,7 @@ a_token_step_2 AS (
a_token_address,
segmented_data,
underlying_asset,
treasury_address,
radiant_version_pool,
atoken_decimals,
atoken_name,
@ -112,14 +115,11 @@ a_token_step_2 AS (
'Radiant' AS protocol
FROM
a_token_step_1
WHERE
radiant_version_pool IN (
LOWER('0x2032b9A8e9F7e76768CA9271003d3e43E1616B1F'),
LOWER('0xF4B1486DD74D07706052A33d31d7c0AAFD0659E1')
)
)
SELECT
A.atoken_created_block,
A.radiant_version_pool,
A.treasury_address,
A.atoken_symbol AS atoken_symbol,
A.a_token_address AS atoken_address,
b.atoken_stable_debt_address,