mirror of
https://github.com/FlipsideCrypto/flow-models.git
synced 2026-02-06 11:26:53 +00:00
Upgrade decoding ABIs
This commit is contained in:
parent
e5e7147a78
commit
530e6773d3
@ -0,0 +1,173 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = "contract_address",
|
||||
full_refresh = false,
|
||||
tags = ['evm']
|
||||
) }}
|
||||
|
||||
WITH level1 AS (
|
||||
|
||||
SELECT
|
||||
{{ target.database }}.live.udf_api(
|
||||
'https://evm.flowscan.io/api/v2/smart-contracts/'
|
||||
) :data AS DATA
|
||||
),
|
||||
level2 AS (
|
||||
SELECT
|
||||
{{ target.database }}.live.udf_api(
|
||||
'https://evm.flowscan.io/api/v2/smart-contracts?hash=' || DATA :next_page_params: "hash" :: STRING
|
||||
) :data AS DATA
|
||||
FROM
|
||||
level1
|
||||
WHERE
|
||||
DATA :next_page_params: "hash" :: STRING IS NOT NULL
|
||||
),
|
||||
level3 AS (
|
||||
SELECT
|
||||
{{ target.database }}.live.udf_api(
|
||||
'https://evm.flowscan.io/api/v2/smart-contracts?hash=' || DATA :next_page_params: "hash" :: STRING
|
||||
) :data AS DATA
|
||||
FROM
|
||||
level2
|
||||
WHERE
|
||||
DATA :next_page_params: "hash" :: STRING IS NOT NULL
|
||||
),
|
||||
level4 AS (
|
||||
SELECT
|
||||
{{ target.database }}.live.udf_api(
|
||||
'https://evm.flowscan.io/api/v2/smart-contracts?hash=' || DATA :next_page_params: "hash" :: STRING
|
||||
) :data AS DATA
|
||||
FROM
|
||||
level3
|
||||
WHERE
|
||||
DATA :next_page_params: "hash" :: STRING IS NOT NULL
|
||||
),
|
||||
level5 AS (
|
||||
SELECT
|
||||
{{ target.database }}.live.udf_api(
|
||||
'https://evm.flowscan.io/api/v2/smart-contracts?hash=' || DATA :next_page_params: "hash" :: STRING
|
||||
) :data AS DATA
|
||||
FROM
|
||||
level4
|
||||
WHERE
|
||||
DATA :next_page_params: "hash" :: STRING IS NOT NULL
|
||||
),
|
||||
level6 AS (
|
||||
SELECT
|
||||
{{ target.database }}.live.udf_api(
|
||||
'https://evm.flowscan.io/api/v2/smart-contracts?hash=' || DATA :next_page_params: "hash" :: STRING
|
||||
) :data AS DATA
|
||||
FROM
|
||||
level5
|
||||
WHERE
|
||||
DATA :next_page_params: "hash" :: STRING IS NOT NULL
|
||||
),
|
||||
level7 AS (
|
||||
SELECT
|
||||
{{ target.database }}.live.udf_api(
|
||||
'https://evm.flowscan.io/api/v2/smart-contracts?hash=' || DATA :next_page_params: "hash" :: STRING
|
||||
) :data AS DATA
|
||||
FROM
|
||||
level6
|
||||
WHERE
|
||||
DATA :next_page_params: "hash" :: STRING IS NOT NULL
|
||||
),
|
||||
level8 AS (
|
||||
SELECT
|
||||
{{ target.database }}.live.udf_api(
|
||||
'https://evm.flowscan.io/api/v2/smart-contracts?hash=' || DATA :next_page_params: "hash" :: STRING
|
||||
) :data AS DATA
|
||||
FROM
|
||||
level7
|
||||
WHERE
|
||||
DATA :next_page_params: "hash" :: STRING IS NOT NULL
|
||||
),
|
||||
level9 AS (
|
||||
SELECT
|
||||
{{ target.database }}.live.udf_api(
|
||||
'https://evm.flowscan.io/api/v2/smart-contracts?hash=' || DATA :next_page_params: "hash" :: STRING
|
||||
) :data AS DATA
|
||||
FROM
|
||||
level8
|
||||
WHERE
|
||||
DATA :next_page_params: "hash" :: STRING IS NOT NULL
|
||||
),
|
||||
level10 AS (
|
||||
SELECT
|
||||
{{ target.database }}.live.udf_api(
|
||||
'https://evm.flowscan.io/api/v2/smart-contracts?hash=' || DATA :next_page_params: "hash" :: STRING
|
||||
) :data AS DATA
|
||||
FROM
|
||||
level9
|
||||
WHERE
|
||||
DATA :next_page_params: "hash" :: STRING IS NOT NULL
|
||||
),
|
||||
ua AS (
|
||||
SELECT
|
||||
DATA
|
||||
FROM
|
||||
level1
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATA
|
||||
FROM
|
||||
level2
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATA
|
||||
FROM
|
||||
level3
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATA
|
||||
FROM
|
||||
level4
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATA
|
||||
FROM
|
||||
level5
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATA
|
||||
FROM
|
||||
level6
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATA
|
||||
FROM
|
||||
level7
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATA
|
||||
FROM
|
||||
level8
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATA
|
||||
FROM
|
||||
level9
|
||||
UNION ALL
|
||||
SELECT
|
||||
DATA
|
||||
FROM
|
||||
level10
|
||||
)
|
||||
SELECT
|
||||
VALUE AS DATA,
|
||||
VALUE :address :hash :: STRING AS contract_address,
|
||||
VALUE :address :implementations AS implementations,
|
||||
VALUE :address :is_contract :: BOOLEAN AS is_contract,
|
||||
VALUE :address :is_verified :: BOOLEAN AS is_verified,
|
||||
VALUE :address :name :: STRING AS NAME,
|
||||
VALUE :address :private_tags AS private_tags,
|
||||
VALUE :verified_at :: datetime AS verified_at,
|
||||
{{ dbt_utils.generate_surrogate_key(['contract_address']) }} AS flowscan_verified_contracts_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
ua,
|
||||
LATERAL FLATTEN(
|
||||
input => DATA :items
|
||||
)
|
||||
@ -0,0 +1,11 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: bronze_evm_api__flowscan_verified_contracts
|
||||
|
||||
columns:
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_row_values_to_have_recent_data:
|
||||
datepart: day
|
||||
interval: 1
|
||||
@ -10,19 +10,25 @@
|
||||
"sql_source": "{{this.identifier}}" }
|
||||
)
|
||||
) }}
|
||||
with verified_contracts as (
|
||||
select address_hash AS contract_address from {{ ref('seeds__evm_verified_contracts') }}
|
||||
|
||||
WITH verified_contracts AS (
|
||||
|
||||
SELECT
|
||||
contract_address
|
||||
FROM
|
||||
{{ ref('bronze_evm_api__flowscan_verified_contracts') }}
|
||||
EXCEPT
|
||||
select contract_address from {{ ref('streamline__complete_contract_abis') }}
|
||||
SELECT
|
||||
contract_address
|
||||
FROM
|
||||
{{ ref('streamline__complete_contract_abis') }}
|
||||
)
|
||||
SELECT
|
||||
contract_address,
|
||||
DATE_PART('EPOCH', SYSDATE()) :: INTEGER AS partition_key,
|
||||
{{ target.database }}.live.udf_api(
|
||||
'GET',
|
||||
'https://evm.flowscan.io/api/v2/smart-contracts/' || contract_address,
|
||||
{},
|
||||
{}
|
||||
'https://evm.flowscan.io/api/v2/smart-contracts/' || contract_address,{},{}
|
||||
) AS request
|
||||
FROM
|
||||
verified_contracts
|
||||
|
||||
Loading…
Reference in New Issue
Block a user