From d990e238884f07f7382928b14719d1570190373d Mon Sep 17 00:00:00 2001 From: Austin <93135983+austinFlipside@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:39:30 -0500 Subject: [PATCH] upgrades (#173) * upgrades * fix --- models/bronze/api_udf/bronze_api__contract_abis.sql | 8 +++++--- models/silver/core/silver__relevant_contracts.sql | 6 +----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/models/bronze/api_udf/bronze_api__contract_abis.sql b/models/bronze/api_udf/bronze_api__contract_abis.sql index 51ba96ac..9dec1f07 100644 --- a/models/bronze/api_udf/bronze_api__contract_abis.sql +++ b/models/bronze/api_udf/bronze_api__contract_abis.sql @@ -15,14 +15,16 @@ WITH base AS ( total_interaction_count >= 100 {% if is_incremental() %} -EXCEPT +and contract_address not in ( SELECT contract_address FROM {{ this }} -WHERE - abi_data :data :result :: STRING <> 'Max rate limit reached' + WHERE + abi_data :data :result :: STRING <> 'Max rate limit reached' +) {% endif %} +order by total_interaction_count desc LIMIT 50 ), all_contracts AS ( diff --git a/models/silver/core/silver__relevant_contracts.sql b/models/silver/core/silver__relevant_contracts.sql index 36f33b16..85b5b2bc 100644 --- a/models/silver/core/silver__relevant_contracts.sql +++ b/models/silver/core/silver__relevant_contracts.sql @@ -29,11 +29,7 @@ GROUP BY ), function_calls AS ( SELECT - IFF( - TYPE = 'DELEGATECALL', - from_address, - to_address - ) AS contract_address, + to_address AS contract_address, COUNT(*) AS function_call_count, MAX(_inserted_timestamp) AS max_inserted_timestamp_traces, MAX(block_number) AS latest_call_block