mirror of
https://github.com/FlipsideCrypto/ton-models.git
synced 2026-02-06 15:36:44 +00:00
pause for metrics update first
This commit is contained in:
parent
15cd08394b
commit
5eefbf41ca
64
models/bronze/bronze_api/bronze_api__detect_address.sql
Normal file
64
models/bronze/bronze_api/bronze_api__detect_address.sql
Normal file
@ -0,0 +1,64 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
full_refresh = false,
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
WITH tokens_base AS (
|
||||
|
||||
SELECT
|
||||
DISTINCT token_address
|
||||
FROM
|
||||
{{ ref('bronze__complete_provider_asset_metadata') }}
|
||||
UNION
|
||||
SELECT
|
||||
DISTINCT token_address
|
||||
FROM
|
||||
{{ ref('bronze__complete_token_asset_metadata') }}
|
||||
),
|
||||
tokens AS (
|
||||
SELECT
|
||||
token_address
|
||||
FROM
|
||||
tokens_base A
|
||||
|
||||
{% if is_incremental() %}
|
||||
LEFT JOIN {{ this }}
|
||||
b USING(token_address)
|
||||
{% endif %}
|
||||
|
||||
{% if is_incremental() %}
|
||||
WHERE
|
||||
b.token_address IS NULL
|
||||
{% endif %}
|
||||
LIMIT
|
||||
20
|
||||
), res AS (
|
||||
SELECT
|
||||
token_address,
|
||||
{{ target.database }}.live.udf_api(
|
||||
'GET',
|
||||
'{Service}/{Authentication}/detectAddress?address=' || token_address,
|
||||
OBJECT_CONSTRUCT(
|
||||
'Content-Type',
|
||||
'application/json'
|
||||
),
|
||||
OBJECT_CONSTRUCT(),
|
||||
'Vault/prod/ton/quicknode/mainnet'
|
||||
) :data :result AS DATA
|
||||
FROM
|
||||
tokens
|
||||
)
|
||||
SELECT
|
||||
token_address,
|
||||
DATA,
|
||||
DATA :bounceable AS bounceable,
|
||||
DATA :given_type :: STRING AS given_type,
|
||||
DATA :non_bounceable AS non_bounceable,
|
||||
DATA :raw_form :: STRING AS raw_form,
|
||||
DATA :test_only AS test_only,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
FROM
|
||||
res
|
||||
WHERE
|
||||
raw_form IS NOT NULL
|
||||
@ -0,0 +1,26 @@
|
||||
{{ config (
|
||||
materialized = 'view',
|
||||
tags = ['bronze_prices']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
asset_id,
|
||||
symbol,
|
||||
NAME,
|
||||
decimals,
|
||||
blockchain,
|
||||
is_deprecated,
|
||||
provider,
|
||||
source,
|
||||
_inserted_timestamp,
|
||||
inserted_timestamp,
|
||||
modified_timestamp,
|
||||
complete_native_asset_metadata_id,
|
||||
_invocation_id
|
||||
FROM
|
||||
{{ source(
|
||||
'crosschain_silver',
|
||||
'complete_native_asset_metadata'
|
||||
) }}
|
||||
WHERE
|
||||
blockchain = 'toncoin'
|
||||
29
models/bronze/prices/bronze__complete_native_prices.sql
Normal file
29
models/bronze/prices/bronze__complete_native_prices.sql
Normal file
@ -0,0 +1,29 @@
|
||||
{{ config (
|
||||
materialized = 'view',
|
||||
tags = ['bronze_prices']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
HOUR,
|
||||
asset_id,
|
||||
symbol,
|
||||
NAME,
|
||||
decimals,
|
||||
price,
|
||||
blockchain,
|
||||
is_imputed,
|
||||
is_deprecated,
|
||||
provider,
|
||||
source,
|
||||
_inserted_timestamp,
|
||||
inserted_timestamp,
|
||||
modified_timestamp,
|
||||
complete_native_prices_id,
|
||||
_invocation_id
|
||||
FROM
|
||||
{{ source(
|
||||
'crosschain_silver',
|
||||
'complete_native_prices'
|
||||
) }}
|
||||
WHERE
|
||||
blockchain = 'toncoin'
|
||||
@ -0,0 +1,31 @@
|
||||
{{ config (
|
||||
materialized = 'view',
|
||||
tags = ['bronze_prices']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
asset_id,
|
||||
token_address,
|
||||
NAME,
|
||||
symbol,
|
||||
platform,
|
||||
platform_id,
|
||||
provider,
|
||||
source,
|
||||
_inserted_timestamp,
|
||||
inserted_timestamp,
|
||||
modified_timestamp,
|
||||
complete_provider_asset_metadata_id,
|
||||
_invocation_id
|
||||
FROM
|
||||
{{ source(
|
||||
'crosschain_silver',
|
||||
'complete_provider_asset_metadata'
|
||||
) }}
|
||||
WHERE
|
||||
LOWER(platform) IN (
|
||||
'ton',
|
||||
'toncoin'
|
||||
)
|
||||
AND len(token_address) > 5
|
||||
AND token_address LIKE 'E%'
|
||||
24
models/bronze/prices/bronze__complete_provider_prices.sql
Normal file
24
models/bronze/prices/bronze__complete_provider_prices.sql
Normal file
@ -0,0 +1,24 @@
|
||||
{{ config (
|
||||
materialized = 'view',
|
||||
tags = ['bronze_prices']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
asset_id,
|
||||
recorded_hour,
|
||||
OPEN,
|
||||
high,
|
||||
low,
|
||||
CLOSE,
|
||||
provider,
|
||||
source,
|
||||
_inserted_timestamp,
|
||||
inserted_timestamp,
|
||||
modified_timestamp,
|
||||
complete_provider_prices_id,
|
||||
_invocation_id
|
||||
FROM
|
||||
{{ source(
|
||||
'crosschain_silver',
|
||||
'complete_provider_prices'
|
||||
) }}
|
||||
@ -0,0 +1,32 @@
|
||||
{{ config (
|
||||
materialized = 'view',
|
||||
tags = ['bronze_prices']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
token_address,
|
||||
asset_id,
|
||||
symbol,
|
||||
NAME,
|
||||
decimals,
|
||||
blockchain,
|
||||
blockchain_name,
|
||||
blockchain_id,
|
||||
is_deprecated,
|
||||
provider,
|
||||
source,
|
||||
_inserted_timestamp,
|
||||
inserted_timestamp,
|
||||
modified_timestamp,
|
||||
complete_token_asset_metadata_id,
|
||||
_invocation_id
|
||||
FROM
|
||||
{{ source(
|
||||
'crosschain_silver',
|
||||
'complete_token_asset_metadata'
|
||||
) }}
|
||||
WHERE
|
||||
LOWER(blockchain) IN (
|
||||
'ton',
|
||||
'toncoin'
|
||||
)
|
||||
36
models/bronze/prices/bronze__complete_token_prices.sql
Normal file
36
models/bronze/prices/bronze__complete_token_prices.sql
Normal file
@ -0,0 +1,36 @@
|
||||
{{ config (
|
||||
materialized = 'view',
|
||||
tags = ['bronze_prices']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
HOUR,
|
||||
token_address,
|
||||
asset_id,
|
||||
symbol,
|
||||
NAME,
|
||||
decimals,
|
||||
price,
|
||||
blockchain,
|
||||
blockchain_name,
|
||||
blockchain_id,
|
||||
is_imputed,
|
||||
is_deprecated,
|
||||
provider,
|
||||
source,
|
||||
_inserted_timestamp,
|
||||
inserted_timestamp,
|
||||
modified_timestamp,
|
||||
complete_token_prices_id,
|
||||
_invocation_id
|
||||
FROM
|
||||
{{ source(
|
||||
'crosschain_silver',
|
||||
'complete_token_prices'
|
||||
) }}
|
||||
WHERE
|
||||
LOWER(blockchain) IN (
|
||||
'ton',
|
||||
'toncoin'
|
||||
)
|
||||
AND len(token_address) > 5
|
||||
@ -36,5 +36,10 @@ sources:
|
||||
schema: silver
|
||||
tables:
|
||||
- name: number_sequence
|
||||
- name: labels_combined
|
||||
- name: complete_native_asset_metadata
|
||||
- name: complete_native_prices
|
||||
- name: labels_combined
|
||||
- name: complete_provider_asset_metadata
|
||||
- name: complete_provider_prices
|
||||
- name: complete_token_asset_metadata
|
||||
- name: complete_token_prices
|
||||
Loading…
Reference in New Issue
Block a user