From e55f726624dc3040dae0b188e39020ed91e46a05 Mon Sep 17 00:00:00 2001 From: Alex Weseley Date: Thu, 27 Jun 2024 21:29:24 -0400 Subject: [PATCH 1/7] moving chainlink vrf to prod_raw --- .../prod_raw}/fact_chainlink_ethereum_vrf_request_fulfilled.sql | 0 .../fact_chainlink_ethereum_vrf_request_fulfilled_daily.sql | 0 .../prod_raw}/fact_chainlink_ethereum_vrf_rewards_daily.sql | 0 .../fact_chainlink_ethereum_vrf_v1_random_fulfilled_logs.sql | 0 .../fact_chainlink_ethereum_vrf_v1_random_request_logs.sql | 0 .../fact_chainlink_ethereum_vrf_v2_random_fulfilled_logs.sql | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename models/{staging/chainlink => projects/chainlink/prod_raw}/fact_chainlink_ethereum_vrf_request_fulfilled.sql (100%) rename models/{staging/chainlink => projects/chainlink/prod_raw}/fact_chainlink_ethereum_vrf_request_fulfilled_daily.sql (100%) rename models/{staging/chainlink => projects/chainlink/prod_raw}/fact_chainlink_ethereum_vrf_rewards_daily.sql (100%) rename models/{staging/chainlink => projects/chainlink/prod_raw}/fact_chainlink_ethereum_vrf_v1_random_fulfilled_logs.sql (100%) rename models/{staging/chainlink => projects/chainlink/prod_raw}/fact_chainlink_ethereum_vrf_v1_random_request_logs.sql (100%) rename models/{staging/chainlink => projects/chainlink/prod_raw}/fact_chainlink_ethereum_vrf_v2_random_fulfilled_logs.sql (100%) diff --git a/models/staging/chainlink/fact_chainlink_ethereum_vrf_request_fulfilled.sql b/models/projects/chainlink/prod_raw/fact_chainlink_ethereum_vrf_request_fulfilled.sql similarity index 100% rename from models/staging/chainlink/fact_chainlink_ethereum_vrf_request_fulfilled.sql rename to models/projects/chainlink/prod_raw/fact_chainlink_ethereum_vrf_request_fulfilled.sql diff --git a/models/staging/chainlink/fact_chainlink_ethereum_vrf_request_fulfilled_daily.sql b/models/projects/chainlink/prod_raw/fact_chainlink_ethereum_vrf_request_fulfilled_daily.sql similarity index 100% rename from models/staging/chainlink/fact_chainlink_ethereum_vrf_request_fulfilled_daily.sql rename to models/projects/chainlink/prod_raw/fact_chainlink_ethereum_vrf_request_fulfilled_daily.sql diff --git a/models/staging/chainlink/fact_chainlink_ethereum_vrf_rewards_daily.sql b/models/projects/chainlink/prod_raw/fact_chainlink_ethereum_vrf_rewards_daily.sql similarity index 100% rename from models/staging/chainlink/fact_chainlink_ethereum_vrf_rewards_daily.sql rename to models/projects/chainlink/prod_raw/fact_chainlink_ethereum_vrf_rewards_daily.sql diff --git a/models/staging/chainlink/fact_chainlink_ethereum_vrf_v1_random_fulfilled_logs.sql b/models/projects/chainlink/prod_raw/fact_chainlink_ethereum_vrf_v1_random_fulfilled_logs.sql similarity index 100% rename from models/staging/chainlink/fact_chainlink_ethereum_vrf_v1_random_fulfilled_logs.sql rename to models/projects/chainlink/prod_raw/fact_chainlink_ethereum_vrf_v1_random_fulfilled_logs.sql diff --git a/models/staging/chainlink/fact_chainlink_ethereum_vrf_v1_random_request_logs.sql b/models/projects/chainlink/prod_raw/fact_chainlink_ethereum_vrf_v1_random_request_logs.sql similarity index 100% rename from models/staging/chainlink/fact_chainlink_ethereum_vrf_v1_random_request_logs.sql rename to models/projects/chainlink/prod_raw/fact_chainlink_ethereum_vrf_v1_random_request_logs.sql diff --git a/models/staging/chainlink/fact_chainlink_ethereum_vrf_v2_random_fulfilled_logs.sql b/models/projects/chainlink/prod_raw/fact_chainlink_ethereum_vrf_v2_random_fulfilled_logs.sql similarity index 100% rename from models/staging/chainlink/fact_chainlink_ethereum_vrf_v2_random_fulfilled_logs.sql rename to models/projects/chainlink/prod_raw/fact_chainlink_ethereum_vrf_v2_random_fulfilled_logs.sql From f9fb5cf3504854be8d5136797e9edabad182d9d5 Mon Sep 17 00:00:00 2001 From: Alex Weseley Date: Fri, 28 Jun 2024 14:05:04 -0400 Subject: [PATCH 2/7] chainlink financials and treasury --- .../chainlink/prod_raw/fact_chainlink_fdv.sql | 18 ++++ .../fact_chainlink_token_turnover_fd.sql | 16 +++ .../fact_chainlink_token_turnover_mc.sql | 17 ++++ .../fact_chainlink_tokenholder_count.sql | 70 +++++++++++++ .../fact_chainlink_treasury_native.sql | 87 +++++++++++++++++ .../prod_raw/fact_chainlink_treasury_usd.sql | 97 +++++++++++++++++++ .../chainlink/prod_raw/fact_chainlink_tvl.sql | 83 ++++++++++++++++ 7 files changed, 388 insertions(+) create mode 100644 models/projects/chainlink/prod_raw/fact_chainlink_fdv.sql create mode 100644 models/projects/chainlink/prod_raw/fact_chainlink_token_turnover_fd.sql create mode 100644 models/projects/chainlink/prod_raw/fact_chainlink_token_turnover_mc.sql create mode 100644 models/projects/chainlink/prod_raw/fact_chainlink_tokenholder_count.sql create mode 100644 models/projects/chainlink/prod_raw/fact_chainlink_treasury_native.sql create mode 100644 models/projects/chainlink/prod_raw/fact_chainlink_treasury_usd.sql create mode 100644 models/projects/chainlink/prod_raw/fact_chainlink_tvl.sql diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_fdv.sql b/models/projects/chainlink/prod_raw/fact_chainlink_fdv.sql new file mode 100644 index 00000000..e61801ee --- /dev/null +++ b/models/projects/chainlink/prod_raw/fact_chainlink_fdv.sql @@ -0,0 +1,18 @@ + + +{{ + config( + materialized="table", + snowflake_warehouse="CHAINLINK", + database="chainlink", + schema="raw", + alias="fact_fdv", + ) +}} + +SELECT + date, + shifted_token_price_usd * 1000000000 as fdv +FROM pc_dbt_db.prod.fact_coingecko_token_date_adjusted_gold +where coingecko_id = 'chainlink' +order by date desc \ No newline at end of file diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_token_turnover_fd.sql b/models/projects/chainlink/prod_raw/fact_chainlink_token_turnover_fd.sql new file mode 100644 index 00000000..f1431756 --- /dev/null +++ b/models/projects/chainlink/prod_raw/fact_chainlink_token_turnover_fd.sql @@ -0,0 +1,16 @@ +{{ + config( + materialized="table", + snowflake_warehouse="CHAINLINK", + database="chainlink", + schema="raw", + alias="fact_token_turnover_fd", + ) +}} + +SELECT + date, + shifted_token_h24_volume_usd / (shifted_token_price_usd * 1000000000) as token_turnover_fdv +FROM pc_dbt_db.prod.fact_coingecko_token_date_adjusted_gold +where coingecko_id = 'chainlink' +order by date desc \ No newline at end of file diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_token_turnover_mc.sql b/models/projects/chainlink/prod_raw/fact_chainlink_token_turnover_mc.sql new file mode 100644 index 00000000..ba9f04c0 --- /dev/null +++ b/models/projects/chainlink/prod_raw/fact_chainlink_token_turnover_mc.sql @@ -0,0 +1,17 @@ +{{ + config( + materialized="table", + snowflake_warehouse="CHAINLINK", + database="chainlink", + schema="raw", + alias="fact_token_turnover_mc", + ) +}} + + +SELECT + date, + shifted_token_h24_volume_usd / shifted_token_market_cap as token_turnover_circulating +FROM pc_dbt_db.prod.fact_coingecko_token_date_adjusted_gold +where coingecko_id = 'chainlink' +order by date desc \ No newline at end of file diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_tokenholder_count.sql b/models/projects/chainlink/prod_raw/fact_chainlink_tokenholder_count.sql new file mode 100644 index 00000000..60e5b697 --- /dev/null +++ b/models/projects/chainlink/prod_raw/fact_chainlink_tokenholder_count.sql @@ -0,0 +1,70 @@ +{{ + config( + materialized="table", + snowflake_warehouse="CHAINLINK", + database="chainlink", + schema="raw", + alias="fact_tokenholder_count", + ) +}} + +WITH filtered_balances AS ( + SELECT + DATE(block_timestamp) AS date, + address, + MAX_BY(balance_token / 1e18, block_timestamp) AS balance_token + FROM pc_dbt_db.prod.fact_ethereum_address_balances_by_token + WHERE contract_address = '0x514910771af9ca656af840dff83e8264ecf986ca' -- set token contract address + GROUP BY 1, 2 +), +unique_dates AS ( + SELECT DISTINCT DATE(block_timestamp) AS date + FROM pc_dbt_db.prod.fact_ethereum_address_balances_by_token + where block_timestamp > '2017-09-15' -- set token contract creation date +), +addresses AS ( + SELECT + address, + MIN(DATE(block_timestamp)) AS first_date + FROM pc_dbt_db.prod.fact_ethereum_address_balances_by_token + WHERE contract_address = '0x514910771af9ca656af840dff83e8264ecf986ca' + GROUP BY address +), +all_combinations AS ( + SELECT + ud.date, + a.address + FROM unique_dates ud + JOIN addresses a + ON ud.date >= a.first_date +) +, joined_balances AS ( + SELECT + ac.date, + ac.address, + fb.balance_token + FROM all_combinations ac + LEFT JOIN filtered_balances fb + ON ac.date = fb.date + AND ac.address = fb.address +) +, filled_balances AS ( + SELECT + date, + address, + COALESCE( + balance_token, + LAST_VALUE(balance_token IGNORE NULLS) OVER ( + PARTITION BY address ORDER BY date + ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW + ) + ) AS balance_token + FROM joined_balances +) + +select date, count(*) as tokenholder_count from filled_balances +where balance_token > 0 +group by date +order by date desc + + diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_treasury_native.sql b/models/projects/chainlink/prod_raw/fact_chainlink_treasury_native.sql new file mode 100644 index 00000000..691f1b45 --- /dev/null +++ b/models/projects/chainlink/prod_raw/fact_chainlink_treasury_native.sql @@ -0,0 +1,87 @@ +{{ + config( + materialized="table", + snowflake_warehouse="CHAINLINK", + database="chainlink", + schema="raw", + alias="fact_treasury_native", + ) +}} + +with recursive date_range as( + select + min(block_timestamp)::date as date + FROM ethereum_flipside.core.ez_token_transfers + where lower(contract_address) = lower('0x514910771AF9Ca656af840dff83E8264EcF986CA') + union all + select dateadd(day, 1, date) from date_range + where date < to_date(sysdate()) +), +address_cte as ( + select lower('0x98c63b7b319dfbdf3d811530f2ab9dfe4983af9d') as address + union all select lower('0x75398564ce69b7498da10a11ab06fd8ff549001c') + union all select lower('0x5560d001f977df5e49ead7ab0bdd437c4ee3a99e') + union all select lower('0xbe6977e08d4479c0a6777539ae0e8fa27be4e9d6') + union all select lower('0xdad22a85ef8310ef582b70e4051e543f3153e11f') + union all select lower('0xe0362f7445e3203a496f6f8b3d51cbb413b69be2') + union all select lower('0x5a8e77bc30948cc9a51ae4e042d96e145648bb4c') + union all select lower('0xe0b66bfc7344a80152bfec954942e2926a6fca80') + union all select lower('0xa42d0a18b834f52e41beddeaa2940165db3da9a3') + union all select lower('0x276f695b3b2c7f24e7cf5b9d24e416a7f357adb7') + union all select lower('0x5eab1966d5f61e52c22d0279f06f175e36a7181e') + union all select lower('0x959815462eec5fff387a2e8a6871d94323d371de') + union all select lower('0xb9b012cad0a7c1b10cbe33a1b3f623b06fad1c7c') + union all select lower('0xfb682b0de4e0093835ea21cfabb5449ca9ac9e5e') + union all select lower('0x3264225f2fd3bb8d5dc50587ea7506aa8638b966') + union all select lower('0x8d34d66bdb2d1d6acd788a2d73d68e62282332e7') + union all select lower('0x4a87ece3efffcb012fbe491aa028032e07b6f6cf') + union all select lower('0x57ec4745258e5a4c73d1a82636dc0fe291e3ee9f') + union all select lower('0x37398a324d35c942574650b9ed2987bc640bad76') + union all select lower('0xd321948212663366503e8dccde39cc8e71c267c0') + union all select lower('0x55b0ba1994d68c2ab0c01c3332ec9473de296137') + union all select lower('0xd48133c96c5fe8d41d0cbd598f65bf4548941e27') + union all select lower('0x9c17f630dbde24eece8fd248faa2e51f690ff79b') + union all select lower('0x35a5dc3fd1210fe7173add3c01144cf1693b5e45') + union all select lower('0x0dffd343c2d3460a7ead2797a687304beb394ce0') + union all select lower('0x76287e0f7b107d1c9f8f01d5afac314ea8461a04') + union all select lower('0x9bbb46637a1df7cadec2afca19c2920cddcc8db8') + union all select lower('0x7594eb0ca0a7f313befd59afe9e95c2201a443e4') + union all select lower('0x8652fb672253607c0061677bdcafb77a324de081') + union all select lower('0x157235a3cc6011d9c26a010875c2550246aabcca') + union all select lower('0xa71bbbd288a4e288cfdc08bb2e70dcd74da4486d') + union all select lower('0xec640a90e9a30072158115b7c0253f2689ee6547') + union all select lower('0x2a6ab3b0c96377bd20ae47e50ae426a8546a4ae9') +), +inflows as ( + SELECT + block_timestamp::date as date, + SUM(amount_precise) as amount_in + FROM ethereum_flipside.core.ez_token_transfers + where lower(contract_address) = lower('0x514910771AF9Ca656af840dff83E8264EcF986CA') + and to_address in ( + SELECT address from address_cte + ) + GROUP BY 1 + ORDER BY 1 DESC +), +outflows as ( + SELECT + block_timestamp::date as date, + SUM(amount_precise) as amount_out + FROM ethereum_flipside.core.ez_token_transfers + where lower(contract_address) = lower('0x514910771AF9Ca656af840dff83E8264EcF986CA') + and from_address in ( + SELECT address from address_cte + ) + GROUP BY 1 + ORDER BY 1 DESC +) +SELECT + dr.date AS date, + SUM(COALESCE(i.amount_in, 0) - COALESCE(o.amount_out, 0)) OVER (ORDER BY dr.date) as treasury_link, +FROM date_range dr +LEFT JOIN outflows o + ON o.date = dr.date +LEFT JOIN inflows i + ON i.date = dr.date +ORDER BY date DESC \ No newline at end of file diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_treasury_usd.sql b/models/projects/chainlink/prod_raw/fact_chainlink_treasury_usd.sql new file mode 100644 index 00000000..156ce643 --- /dev/null +++ b/models/projects/chainlink/prod_raw/fact_chainlink_treasury_usd.sql @@ -0,0 +1,97 @@ +{{ + config( + materialized="table", + snowflake_warehouse="CHAINLINK", + database="chainlink", + schema="raw", + alias="fact_treasury_usd", + ) +}} + + +with recursive date_range as( + select + min(block_timestamp)::date as date + FROM ethereum_flipside.core.ez_token_transfers + where lower(contract_address) = lower('0x514910771AF9Ca656af840dff83E8264EcF986CA') + union all + select dateadd(day, 1, date) from date_range + where date < to_date(sysdate()) +), +address_cte as ( + select lower('0x98c63b7b319dfbdf3d811530f2ab9dfe4983af9d') as address + union all select lower('0x75398564ce69b7498da10a11ab06fd8ff549001c') + union all select lower('0x5560d001f977df5e49ead7ab0bdd437c4ee3a99e') + union all select lower('0xbe6977e08d4479c0a6777539ae0e8fa27be4e9d6') + union all select lower('0xdad22a85ef8310ef582b70e4051e543f3153e11f') + union all select lower('0xe0362f7445e3203a496f6f8b3d51cbb413b69be2') + union all select lower('0x5a8e77bc30948cc9a51ae4e042d96e145648bb4c') + union all select lower('0xe0b66bfc7344a80152bfec954942e2926a6fca80') + union all select lower('0xa42d0a18b834f52e41beddeaa2940165db3da9a3') + union all select lower('0x276f695b3b2c7f24e7cf5b9d24e416a7f357adb7') + union all select lower('0x5eab1966d5f61e52c22d0279f06f175e36a7181e') + union all select lower('0x959815462eec5fff387a2e8a6871d94323d371de') + union all select lower('0xb9b012cad0a7c1b10cbe33a1b3f623b06fad1c7c') + union all select lower('0xfb682b0de4e0093835ea21cfabb5449ca9ac9e5e') + union all select lower('0x3264225f2fd3bb8d5dc50587ea7506aa8638b966') + union all select lower('0x8d34d66bdb2d1d6acd788a2d73d68e62282332e7') + union all select lower('0x4a87ece3efffcb012fbe491aa028032e07b6f6cf') + union all select lower('0x57ec4745258e5a4c73d1a82636dc0fe291e3ee9f') + union all select lower('0x37398a324d35c942574650b9ed2987bc640bad76') + union all select lower('0xd321948212663366503e8dccde39cc8e71c267c0') + union all select lower('0x55b0ba1994d68c2ab0c01c3332ec9473de296137') + union all select lower('0xd48133c96c5fe8d41d0cbd598f65bf4548941e27') + union all select lower('0x9c17f630dbde24eece8fd248faa2e51f690ff79b') + union all select lower('0x35a5dc3fd1210fe7173add3c01144cf1693b5e45') + union all select lower('0x0dffd343c2d3460a7ead2797a687304beb394ce0') + union all select lower('0x76287e0f7b107d1c9f8f01d5afac314ea8461a04') + union all select lower('0x9bbb46637a1df7cadec2afca19c2920cddcc8db8') + union all select lower('0x7594eb0ca0a7f313befd59afe9e95c2201a443e4') + union all select lower('0x8652fb672253607c0061677bdcafb77a324de081') + union all select lower('0x157235a3cc6011d9c26a010875c2550246aabcca') + union all select lower('0xa71bbbd288a4e288cfdc08bb2e70dcd74da4486d') + union all select lower('0xec640a90e9a30072158115b7c0253f2689ee6547') + union all select lower('0x2a6ab3b0c96377bd20ae47e50ae426a8546a4ae9') +), +inflows as ( + SELECT + block_timestamp::date as date, + SUM(amount_precise) as amount_in + FROM ethereum_flipside.core.ez_token_transfers + where lower(contract_address) = lower('0x514910771AF9Ca656af840dff83E8264EcF986CA') + and to_address in ( + SELECT address from address_cte + ) + GROUP BY 1 + ORDER BY 1 DESC +), +outflows as ( + SELECT + block_timestamp::date as date, + SUM(amount_precise) as amount_out + FROM ethereum_flipside.core.ez_token_transfers + where lower(contract_address) = lower('0x514910771AF9Ca656af840dff83E8264EcF986CA') + and from_address in ( + SELECT address from address_cte + ) + GROUP BY 1 + ORDER BY 1 DESC +), +prices as( + SELECT + date(hour) as date, + AVG(price) as price + FROM ethereum_flipside.price.ez_prices_hourly + where lower(token_address) = lower('0x514910771AF9Ca656af840dff83E8264EcF986CA') + group by 1 +) +SELECT + dr.date AS date, + SUM(COALESCE(i.amount_in, 0) - COALESCE(o.amount_out, 0)) OVER (ORDER BY dr.date) * p.price as treasury_usd, +FROM date_range dr +LEFT JOIN outflows o + ON o.date = dr.date +LEFT JOIN inflows i + ON i.date = dr.date +LEFT JOIN prices p on p.date = dr.date +ORDER BY date DESC \ No newline at end of file diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_tvl.sql b/models/projects/chainlink/prod_raw/fact_chainlink_tvl.sql new file mode 100644 index 00000000..04294a27 --- /dev/null +++ b/models/projects/chainlink/prod_raw/fact_chainlink_tvl.sql @@ -0,0 +1,83 @@ +{{ + config( + materialized="table", + snowflake_warehouse="CHAINLINK", + database="chainlink", + schema="raw", + alias="fact_tvl", + ) +}} + +WITH filtered_balances AS ( + SELECT + DATE(block_timestamp) AS date, + address, + MAX_BY(balance_token / 1e18, block_timestamp) AS balance_token + FROM pc_dbt_db.prod.fact_ethereum_address_balances_by_token + WHERE contract_address = '0x514910771af9ca656af840dff83e8264ecf986ca' -- set token contract address + and lower(address) in (lower('0xBc10f2E862ED4502144c7d632a3459F49DFCDB5e'), lower('0xA1d76A7cA72128541E9FCAcafBdA3a92EF94fDc5'), + lower('0x3feB1e09b4bb0E7f0387CeE092a52e85797ab889')) + GROUP BY 1, 2 +), +unique_dates AS ( + SELECT DISTINCT DATE(block_timestamp) AS date + FROM pc_dbt_db.prod.fact_ethereum_address_balances_by_token + where block_timestamp > '2017-09-16' -- set token contract creation date +), +addresses AS ( + SELECT DISTINCT address + FROM filtered_balances +), +all_combinations AS ( + SELECT + ud.date, + a.address + FROM unique_dates ud + CROSS JOIN addresses a +) +, joined_balances AS ( + SELECT + ac.date, + ac.address, + fb.balance_token + FROM all_combinations ac + LEFT JOIN filtered_balances fb + ON ac.date = fb.date + AND ac.address = fb.address +), +prices as( + SELECT + date(hour) as date, + AVG(price) as price + FROM ethereum_flipside.price.ez_prices_hourly + where lower(token_address) = lower('0x514910771AF9Ca656af840dff83E8264EcF986CA') + group by 1 +), +filled_balances as( + SELECT + j.date, + address, + COALESCE( + balance_token, + LAST_VALUE(balance_token IGNORE NULLS) OVER ( + PARTITION BY address ORDER BY j.date + ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW + ) + ) AS balance_token, + COALESCE( + balance_token, + LAST_VALUE(balance_token IGNORE NULLS) OVER ( + PARTITION BY address ORDER BY j.date + ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW + ) + ) * p.price AS balance_usd + FROM joined_balances j + LEFT JOIN prices p on p.date = j.date + order by j.date desc +) +SELECT + date, + SUM(balance_usd) as balance_usd +FROM filled_balances +GROUP BY date +ORDER BY date desc \ No newline at end of file From b42c6bc63f9b5d50648658f97bd18ab62ba90781 Mon Sep 17 00:00:00 2001 From: Alex Weseley Date: Fri, 28 Jun 2024 14:09:07 -0400 Subject: [PATCH 3/7] fixing dates in tvl query --- models/projects/chainlink/prod_raw/fact_chainlink_tvl.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_tvl.sql b/models/projects/chainlink/prod_raw/fact_chainlink_tvl.sql index 04294a27..7f6ca6a4 100644 --- a/models/projects/chainlink/prod_raw/fact_chainlink_tvl.sql +++ b/models/projects/chainlink/prod_raw/fact_chainlink_tvl.sql @@ -22,7 +22,7 @@ WITH filtered_balances AS ( unique_dates AS ( SELECT DISTINCT DATE(block_timestamp) AS date FROM pc_dbt_db.prod.fact_ethereum_address_balances_by_token - where block_timestamp > '2017-09-16' -- set token contract creation date + where block_timestamp > '2022-12-06' -- set token contract creation date ), addresses AS ( SELECT DISTINCT address From 7b9fd00bbb44c1b13fb0d3fd49b9462545b2e7ad Mon Sep 17 00:00:00 2001 From: Alex Weseley Date: Fri, 28 Jun 2024 16:16:34 -0400 Subject: [PATCH 4/7] query optimizations and consolidations --- ...nlink_non_circulating_supply_addresses.sql | 39 +++++++++ .../chainlink/prod_raw/fact_chainlink_fdv.sql | 18 ---- ...ql => fact_chainlink_fdv_and_turnover.sql} | 6 +- .../fact_chainlink_token_turnover_fd.sql | 16 ---- .../fact_chainlink_treasury_native.sql | 86 +++++-------------- .../prod_raw/fact_chainlink_treasury_usd.sql | 86 +++++-------------- 6 files changed, 89 insertions(+), 162 deletions(-) create mode 100644 macros/addresses/chainlink_non_circulating_supply_addresses.sql delete mode 100644 models/projects/chainlink/prod_raw/fact_chainlink_fdv.sql rename models/projects/chainlink/prod_raw/{fact_chainlink_token_turnover_mc.sql => fact_chainlink_fdv_and_turnover.sql} (61%) delete mode 100644 models/projects/chainlink/prod_raw/fact_chainlink_token_turnover_fd.sql diff --git a/macros/addresses/chainlink_non_circulating_supply_addresses.sql b/macros/addresses/chainlink_non_circulating_supply_addresses.sql new file mode 100644 index 00000000..42c8d22e --- /dev/null +++ b/macros/addresses/chainlink_non_circulating_supply_addresses.sql @@ -0,0 +1,39 @@ +{% macro chainlink_non_circulating_supply_addresses() %} + SELECT LOWER(address) AS address + FROM ( + VALUES + ('0x98c63b7b319dfbdf3d811530f2ab9dfe4983af9d'), + ('0x75398564ce69b7498da10a11ab06fd8ff549001c'), + ('0x5560d001f977df5e49ead7ab0bdd437c4ee3a99e'), + ('0xbe6977e08d4479c0a6777539ae0e8fa27be4e9d6'), + ('0xdad22a85ef8310ef582b70e4051e543f3153e11f'), + ('0xe0362f7445e3203a496f6f8b3d51cbb413b69be2'), + ('0x5a8e77bc30948cc9a51ae4e042d96e145648bb4c'), + ('0xe0b66bfc7344a80152bfec954942e2926a6fca80'), + ('0xa42d0a18b834f52e41beddeaa2940165db3da9a3'), + ('0x276f695b3b2c7f24e7cf5b9d24e416a7f357adb7'), + ('0x5eab1966d5f61e52c22d0279f06f175e36a7181e'), + ('0x959815462eec5fff387a2e8a6871d94323d371de'), + ('0xb9b012cad0a7c1b10cbe33a1b3f623b06fad1c7c'), + ('0xfb682b0de4e0093835ea21cfabb5449ca9ac9e5e'), + ('0x3264225f2fd3bb8d5dc50587ea7506aa8638b966'), + ('0x8d34d66bdb2d1d6acd788a2d73d68e62282332e7'), + ('0x4a87ece3efffcb012fbe491aa028032e07b6f6cf'), + ('0x57ec4745258e5a4c73d1a82636dc0fe291e3ee9f'), + ('0x37398a324d35c942574650b9ed2987bc640bad76'), + ('0xd321948212663366503e8dccde39cc8e71c267c0'), + ('0x55b0ba1994d68c2ab0c01c3332ec9473de296137'), + ('0xd48133c96c5fe8d41d0cbd598f65bf4548941e27'), + ('0x9c17f630dbde24eece8fd248faa2e51f690ff79b'), + ('0x35a5dc3fd1210fe7173add3c01144cf1693b5e45'), + ('0x0dffd343c2d3460a7ead2797a687304beb394ce0'), + ('0x76287e0f7b107d1c9f8f01d5afac314ea8461a04'), + ('0x9bbb46637a1df7cadec2afca19c2920cddcc8db8'), + ('0x7594eb0ca0a7f313befd59afe9e95c2201a443e4'), + ('0x8652fb672253607c0061677bdcafb77a324de081'), + ('0x157235a3cc6011d9c26a010875c2550246aabcca'), + ('0xa71bbbd288a4e288cfdc08bb2e70dcd74da4486d'), + ('0xec640a90e9a30072158115b7c0253f2689ee6547'), + ('0x2a6ab3b0c96377bd20ae47e50ae426a8546a4ae9') + ) AS addresses(address) +{% endmacro%} \ No newline at end of file diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_fdv.sql b/models/projects/chainlink/prod_raw/fact_chainlink_fdv.sql deleted file mode 100644 index e61801ee..00000000 --- a/models/projects/chainlink/prod_raw/fact_chainlink_fdv.sql +++ /dev/null @@ -1,18 +0,0 @@ - - -{{ - config( - materialized="table", - snowflake_warehouse="CHAINLINK", - database="chainlink", - schema="raw", - alias="fact_fdv", - ) -}} - -SELECT - date, - shifted_token_price_usd * 1000000000 as fdv -FROM pc_dbt_db.prod.fact_coingecko_token_date_adjusted_gold -where coingecko_id = 'chainlink' -order by date desc \ No newline at end of file diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_token_turnover_mc.sql b/models/projects/chainlink/prod_raw/fact_chainlink_fdv_and_turnover.sql similarity index 61% rename from models/projects/chainlink/prod_raw/fact_chainlink_token_turnover_mc.sql rename to models/projects/chainlink/prod_raw/fact_chainlink_fdv_and_turnover.sql index ba9f04c0..7981be7a 100644 --- a/models/projects/chainlink/prod_raw/fact_chainlink_token_turnover_mc.sql +++ b/models/projects/chainlink/prod_raw/fact_chainlink_fdv_and_turnover.sql @@ -4,14 +4,16 @@ snowflake_warehouse="CHAINLINK", database="chainlink", schema="raw", - alias="fact_token_turnover_mc", + alias="fact_fdv_and_turnover", ) }} SELECT date, - shifted_token_h24_volume_usd / shifted_token_market_cap as token_turnover_circulating + shifted_token_price_usd * 1000000000 as fully_diluted_market_cap, + shifted_token_h24_volume_usd / shifted_token_market_cap as token_turnover_circulating, + shifted_token_h24_volume_usd / fully_diluted_market_cap as token_turnover_fdv FROM pc_dbt_db.prod.fact_coingecko_token_date_adjusted_gold where coingecko_id = 'chainlink' order by date desc \ No newline at end of file diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_token_turnover_fd.sql b/models/projects/chainlink/prod_raw/fact_chainlink_token_turnover_fd.sql deleted file mode 100644 index f1431756..00000000 --- a/models/projects/chainlink/prod_raw/fact_chainlink_token_turnover_fd.sql +++ /dev/null @@ -1,16 +0,0 @@ -{{ - config( - materialized="table", - snowflake_warehouse="CHAINLINK", - database="chainlink", - schema="raw", - alias="fact_token_turnover_fd", - ) -}} - -SELECT - date, - shifted_token_h24_volume_usd / (shifted_token_price_usd * 1000000000) as token_turnover_fdv -FROM pc_dbt_db.prod.fact_coingecko_token_date_adjusted_gold -where coingecko_id = 'chainlink' -order by date desc \ No newline at end of file diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_treasury_native.sql b/models/projects/chainlink/prod_raw/fact_chainlink_treasury_native.sql index 691f1b45..91700e72 100644 --- a/models/projects/chainlink/prod_raw/fact_chainlink_treasury_native.sql +++ b/models/projects/chainlink/prod_raw/fact_chainlink_treasury_native.sql @@ -8,80 +8,40 @@ ) }} -with recursive date_range as( +WITH base AS ( select - min(block_timestamp)::date as date + to_address, + from_address, + TO_DATE(block_timestamp) as date, + amount_precise, + MIN(TO_DATE(block_timestamp)) OVER() as min_date FROM ethereum_flipside.core.ez_token_transfers where lower(contract_address) = lower('0x514910771AF9Ca656af840dff83E8264EcF986CA') - union all - select dateadd(day, 1, date) from date_range - where date < to_date(sysdate()) +), date_range AS ( + SELECT * + FROM ( + SELECT + min_date + SEQ4() AS date + FROM base + ) + WHERE date <= TO_DATE(SYSDATE()) ), address_cte as ( - select lower('0x98c63b7b319dfbdf3d811530f2ab9dfe4983af9d') as address - union all select lower('0x75398564ce69b7498da10a11ab06fd8ff549001c') - union all select lower('0x5560d001f977df5e49ead7ab0bdd437c4ee3a99e') - union all select lower('0xbe6977e08d4479c0a6777539ae0e8fa27be4e9d6') - union all select lower('0xdad22a85ef8310ef582b70e4051e543f3153e11f') - union all select lower('0xe0362f7445e3203a496f6f8b3d51cbb413b69be2') - union all select lower('0x5a8e77bc30948cc9a51ae4e042d96e145648bb4c') - union all select lower('0xe0b66bfc7344a80152bfec954942e2926a6fca80') - union all select lower('0xa42d0a18b834f52e41beddeaa2940165db3da9a3') - union all select lower('0x276f695b3b2c7f24e7cf5b9d24e416a7f357adb7') - union all select lower('0x5eab1966d5f61e52c22d0279f06f175e36a7181e') - union all select lower('0x959815462eec5fff387a2e8a6871d94323d371de') - union all select lower('0xb9b012cad0a7c1b10cbe33a1b3f623b06fad1c7c') - union all select lower('0xfb682b0de4e0093835ea21cfabb5449ca9ac9e5e') - union all select lower('0x3264225f2fd3bb8d5dc50587ea7506aa8638b966') - union all select lower('0x8d34d66bdb2d1d6acd788a2d73d68e62282332e7') - union all select lower('0x4a87ece3efffcb012fbe491aa028032e07b6f6cf') - union all select lower('0x57ec4745258e5a4c73d1a82636dc0fe291e3ee9f') - union all select lower('0x37398a324d35c942574650b9ed2987bc640bad76') - union all select lower('0xd321948212663366503e8dccde39cc8e71c267c0') - union all select lower('0x55b0ba1994d68c2ab0c01c3332ec9473de296137') - union all select lower('0xd48133c96c5fe8d41d0cbd598f65bf4548941e27') - union all select lower('0x9c17f630dbde24eece8fd248faa2e51f690ff79b') - union all select lower('0x35a5dc3fd1210fe7173add3c01144cf1693b5e45') - union all select lower('0x0dffd343c2d3460a7ead2797a687304beb394ce0') - union all select lower('0x76287e0f7b107d1c9f8f01d5afac314ea8461a04') - union all select lower('0x9bbb46637a1df7cadec2afca19c2920cddcc8db8') - union all select lower('0x7594eb0ca0a7f313befd59afe9e95c2201a443e4') - union all select lower('0x8652fb672253607c0061677bdcafb77a324de081') - union all select lower('0x157235a3cc6011d9c26a010875c2550246aabcca') - union all select lower('0xa71bbbd288a4e288cfdc08bb2e70dcd74da4486d') - union all select lower('0xec640a90e9a30072158115b7c0253f2689ee6547') - union all select lower('0x2a6ab3b0c96377bd20ae47e50ae426a8546a4ae9') + {{chainlink_non_circulating_supply_addresses()}} ), -inflows as ( +flows as ( SELECT - block_timestamp::date as date, - SUM(amount_precise) as amount_in - FROM ethereum_flipside.core.ez_token_transfers - where lower(contract_address) = lower('0x514910771AF9Ca656af840dff83E8264EcF986CA') - and to_address in ( - SELECT address from address_cte - ) - GROUP BY 1 - ORDER BY 1 DESC -), -outflows as ( - SELECT - block_timestamp::date as date, - SUM(amount_precise) as amount_out - FROM ethereum_flipside.core.ez_token_transfers - where lower(contract_address) = lower('0x514910771AF9Ca656af840dff83E8264EcF986CA') - and from_address in ( - SELECT address from address_cte - ) + date, + SUM(CASE WHEN to_address IN (SELECT address FROM address_cte) THEN amount_precise ELSE 0 END) AS amount_in, + SUM(CASE WHEN from_address IN (SELECT address FROM address_cte) THEN amount_precise ELSE 0 END) AS amount_out + FROM base GROUP BY 1 ORDER BY 1 DESC ) SELECT dr.date AS date, - SUM(COALESCE(i.amount_in, 0) - COALESCE(o.amount_out, 0)) OVER (ORDER BY dr.date) as treasury_link, + SUM(COALESCE(f.amount_in, 0) - COALESCE(f.amount_out, 0)) OVER (ORDER BY dr.date) as treasury_link, FROM date_range dr -LEFT JOIN outflows o - ON o.date = dr.date -LEFT JOIN inflows i - ON i.date = dr.date +LEFT JOIN flows f + ON f.date = dr.date ORDER BY date DESC \ No newline at end of file diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_treasury_usd.sql b/models/projects/chainlink/prod_raw/fact_chainlink_treasury_usd.sql index 156ce643..0f235be3 100644 --- a/models/projects/chainlink/prod_raw/fact_chainlink_treasury_usd.sql +++ b/models/projects/chainlink/prod_raw/fact_chainlink_treasury_usd.sql @@ -9,71 +9,33 @@ }} -with recursive date_range as( +WITH base AS ( select - min(block_timestamp)::date as date + to_address, + from_address, + TO_DATE(block_timestamp) as date, + amount_precise, + MIN(TO_DATE(block_timestamp)) OVER() as min_date FROM ethereum_flipside.core.ez_token_transfers where lower(contract_address) = lower('0x514910771AF9Ca656af840dff83E8264EcF986CA') - union all - select dateadd(day, 1, date) from date_range - where date < to_date(sysdate()) +), date_range AS ( + SELECT * + FROM ( + SELECT + min_date + SEQ4() AS date + FROM base + ) + WHERE date <= TO_DATE(SYSDATE()) ), address_cte as ( - select lower('0x98c63b7b319dfbdf3d811530f2ab9dfe4983af9d') as address - union all select lower('0x75398564ce69b7498da10a11ab06fd8ff549001c') - union all select lower('0x5560d001f977df5e49ead7ab0bdd437c4ee3a99e') - union all select lower('0xbe6977e08d4479c0a6777539ae0e8fa27be4e9d6') - union all select lower('0xdad22a85ef8310ef582b70e4051e543f3153e11f') - union all select lower('0xe0362f7445e3203a496f6f8b3d51cbb413b69be2') - union all select lower('0x5a8e77bc30948cc9a51ae4e042d96e145648bb4c') - union all select lower('0xe0b66bfc7344a80152bfec954942e2926a6fca80') - union all select lower('0xa42d0a18b834f52e41beddeaa2940165db3da9a3') - union all select lower('0x276f695b3b2c7f24e7cf5b9d24e416a7f357adb7') - union all select lower('0x5eab1966d5f61e52c22d0279f06f175e36a7181e') - union all select lower('0x959815462eec5fff387a2e8a6871d94323d371de') - union all select lower('0xb9b012cad0a7c1b10cbe33a1b3f623b06fad1c7c') - union all select lower('0xfb682b0de4e0093835ea21cfabb5449ca9ac9e5e') - union all select lower('0x3264225f2fd3bb8d5dc50587ea7506aa8638b966') - union all select lower('0x8d34d66bdb2d1d6acd788a2d73d68e62282332e7') - union all select lower('0x4a87ece3efffcb012fbe491aa028032e07b6f6cf') - union all select lower('0x57ec4745258e5a4c73d1a82636dc0fe291e3ee9f') - union all select lower('0x37398a324d35c942574650b9ed2987bc640bad76') - union all select lower('0xd321948212663366503e8dccde39cc8e71c267c0') - union all select lower('0x55b0ba1994d68c2ab0c01c3332ec9473de296137') - union all select lower('0xd48133c96c5fe8d41d0cbd598f65bf4548941e27') - union all select lower('0x9c17f630dbde24eece8fd248faa2e51f690ff79b') - union all select lower('0x35a5dc3fd1210fe7173add3c01144cf1693b5e45') - union all select lower('0x0dffd343c2d3460a7ead2797a687304beb394ce0') - union all select lower('0x76287e0f7b107d1c9f8f01d5afac314ea8461a04') - union all select lower('0x9bbb46637a1df7cadec2afca19c2920cddcc8db8') - union all select lower('0x7594eb0ca0a7f313befd59afe9e95c2201a443e4') - union all select lower('0x8652fb672253607c0061677bdcafb77a324de081') - union all select lower('0x157235a3cc6011d9c26a010875c2550246aabcca') - union all select lower('0xa71bbbd288a4e288cfdc08bb2e70dcd74da4486d') - union all select lower('0xec640a90e9a30072158115b7c0253f2689ee6547') - union all select lower('0x2a6ab3b0c96377bd20ae47e50ae426a8546a4ae9') + {{chainlink_non_circulating_supply_addresses() }} ), -inflows as ( +flows as ( SELECT - block_timestamp::date as date, - SUM(amount_precise) as amount_in - FROM ethereum_flipside.core.ez_token_transfers - where lower(contract_address) = lower('0x514910771AF9Ca656af840dff83E8264EcF986CA') - and to_address in ( - SELECT address from address_cte - ) - GROUP BY 1 - ORDER BY 1 DESC -), -outflows as ( - SELECT - block_timestamp::date as date, - SUM(amount_precise) as amount_out - FROM ethereum_flipside.core.ez_token_transfers - where lower(contract_address) = lower('0x514910771AF9Ca656af840dff83E8264EcF986CA') - and from_address in ( - SELECT address from address_cte - ) + date, + SUM(CASE WHEN to_address IN (SELECT address FROM address_cte) THEN amount_precise ELSE 0 END) AS amount_in, + SUM(CASE WHEN from_address IN (SELECT address FROM address_cte) THEN amount_precise ELSE 0 END) AS amount_out + FROM base GROUP BY 1 ORDER BY 1 DESC ), @@ -87,11 +49,9 @@ prices as( ) SELECT dr.date AS date, - SUM(COALESCE(i.amount_in, 0) - COALESCE(o.amount_out, 0)) OVER (ORDER BY dr.date) * p.price as treasury_usd, + SUM(COALESCE(f.amount_in, 0) - COALESCE(f.amount_out, 0)) OVER (ORDER BY dr.date) * p.price as treasury_usd, FROM date_range dr -LEFT JOIN outflows o - ON o.date = dr.date -LEFT JOIN inflows i - ON i.date = dr.date +LEFT JOIN flows f + ON f.date = dr.date LEFT JOIN prices p on p.date = dr.date ORDER BY date DESC \ No newline at end of file From ef5bbee478d1c38089be6cdc08af887fc2504805 Mon Sep 17 00:00:00 2001 From: Alex Weseley Date: Fri, 28 Jun 2024 16:20:54 -0400 Subject: [PATCH 5/7] adding tvl native --- models/projects/chainlink/prod_raw/fact_chainlink_tvl.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_tvl.sql b/models/projects/chainlink/prod_raw/fact_chainlink_tvl.sql index 7f6ca6a4..523df0bf 100644 --- a/models/projects/chainlink/prod_raw/fact_chainlink_tvl.sql +++ b/models/projects/chainlink/prod_raw/fact_chainlink_tvl.sql @@ -77,7 +77,8 @@ filled_balances as( ) SELECT date, - SUM(balance_usd) as balance_usd + SUM(balance_usd) as balance_usd, + SUM(balance_token) as balance_link FROM filled_balances GROUP BY date ORDER BY date desc \ No newline at end of file From a8c87e1f7462813f11c66fb8efd9cee76f1d120a Mon Sep 17 00:00:00 2001 From: Alex Weseley Date: Fri, 28 Jun 2024 16:32:43 -0400 Subject: [PATCH 6/7] more query consolidation --- .../fact_chainlink_treasury_native.sql | 47 ------------------- ...=> fact_chainlink_treasury_native_usd.sql} | 3 +- ....sql => fact_chainlink_tvl_native_usd.sql} | 0 3 files changed, 2 insertions(+), 48 deletions(-) delete mode 100644 models/projects/chainlink/prod_raw/fact_chainlink_treasury_native.sql rename models/projects/chainlink/prod_raw/{fact_chainlink_treasury_usd.sql => fact_chainlink_treasury_native_usd.sql} (94%) rename models/projects/chainlink/prod_raw/{fact_chainlink_tvl.sql => fact_chainlink_tvl_native_usd.sql} (100%) diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_treasury_native.sql b/models/projects/chainlink/prod_raw/fact_chainlink_treasury_native.sql deleted file mode 100644 index 91700e72..00000000 --- a/models/projects/chainlink/prod_raw/fact_chainlink_treasury_native.sql +++ /dev/null @@ -1,47 +0,0 @@ -{{ - config( - materialized="table", - snowflake_warehouse="CHAINLINK", - database="chainlink", - schema="raw", - alias="fact_treasury_native", - ) -}} - -WITH base AS ( - select - to_address, - from_address, - TO_DATE(block_timestamp) as date, - amount_precise, - MIN(TO_DATE(block_timestamp)) OVER() as min_date - FROM ethereum_flipside.core.ez_token_transfers - where lower(contract_address) = lower('0x514910771AF9Ca656af840dff83E8264EcF986CA') -), date_range AS ( - SELECT * - FROM ( - SELECT - min_date + SEQ4() AS date - FROM base - ) - WHERE date <= TO_DATE(SYSDATE()) -), -address_cte as ( - {{chainlink_non_circulating_supply_addresses()}} -), -flows as ( - SELECT - date, - SUM(CASE WHEN to_address IN (SELECT address FROM address_cte) THEN amount_precise ELSE 0 END) AS amount_in, - SUM(CASE WHEN from_address IN (SELECT address FROM address_cte) THEN amount_precise ELSE 0 END) AS amount_out - FROM base - GROUP BY 1 - ORDER BY 1 DESC -) -SELECT - dr.date AS date, - SUM(COALESCE(f.amount_in, 0) - COALESCE(f.amount_out, 0)) OVER (ORDER BY dr.date) as treasury_link, -FROM date_range dr -LEFT JOIN flows f - ON f.date = dr.date -ORDER BY date DESC \ No newline at end of file diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_treasury_usd.sql b/models/projects/chainlink/prod_raw/fact_chainlink_treasury_native_usd.sql similarity index 94% rename from models/projects/chainlink/prod_raw/fact_chainlink_treasury_usd.sql rename to models/projects/chainlink/prod_raw/fact_chainlink_treasury_native_usd.sql index 0f235be3..9cb06c92 100644 --- a/models/projects/chainlink/prod_raw/fact_chainlink_treasury_usd.sql +++ b/models/projects/chainlink/prod_raw/fact_chainlink_treasury_native_usd.sql @@ -49,7 +49,8 @@ prices as( ) SELECT dr.date AS date, - SUM(COALESCE(f.amount_in, 0) - COALESCE(f.amount_out, 0)) OVER (ORDER BY dr.date) * p.price as treasury_usd, + SUM(COALESCE(f.amount_in, 0) - COALESCE(f.amount_out, 0)) OVER (ORDER BY dr.date) as treasury_link, + treasury_link * p.price as treasury_usd, FROM date_range dr LEFT JOIN flows f ON f.date = dr.date diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_tvl.sql b/models/projects/chainlink/prod_raw/fact_chainlink_tvl_native_usd.sql similarity index 100% rename from models/projects/chainlink/prod_raw/fact_chainlink_tvl.sql rename to models/projects/chainlink/prod_raw/fact_chainlink_tvl_native_usd.sql From bb56c2d35f87df5bd1ab17413b653bf814979092 Mon Sep 17 00:00:00 2001 From: Alex Weseley Date: Fri, 28 Jun 2024 18:40:23 -0400 Subject: [PATCH 7/7] making naming consistent --- .../chainlink/prod_raw/fact_chainlink_treasury_native_usd.sql | 2 +- .../chainlink/prod_raw/fact_chainlink_tvl_native_usd.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_treasury_native_usd.sql b/models/projects/chainlink/prod_raw/fact_chainlink_treasury_native_usd.sql index 9cb06c92..54445bb8 100644 --- a/models/projects/chainlink/prod_raw/fact_chainlink_treasury_native_usd.sql +++ b/models/projects/chainlink/prod_raw/fact_chainlink_treasury_native_usd.sql @@ -4,7 +4,7 @@ snowflake_warehouse="CHAINLINK", database="chainlink", schema="raw", - alias="fact_treasury_usd", + alias="fact_treasury_native_usd", ) }} diff --git a/models/projects/chainlink/prod_raw/fact_chainlink_tvl_native_usd.sql b/models/projects/chainlink/prod_raw/fact_chainlink_tvl_native_usd.sql index 523df0bf..160c5aa9 100644 --- a/models/projects/chainlink/prod_raw/fact_chainlink_tvl_native_usd.sql +++ b/models/projects/chainlink/prod_raw/fact_chainlink_tvl_native_usd.sql @@ -4,7 +4,7 @@ snowflake_warehouse="CHAINLINK", database="chainlink", schema="raw", - alias="fact_tvl", + alias="fact_tvl_native_usd", ) }}