From 83ed1930af1c19d50e5dfb85f6ab5810c82eee9c Mon Sep 17 00:00:00 2001 From: Eric Laurello Date: Mon, 21 Jul 2025 15:40:57 -0400 Subject: [PATCH 1/5] Changes to be committed: new file: models/bronze/prices/bronze__complete_token_asset_metadata.sql new file: models/bronze/prices/bronze__complete_token_prices.sql modified: models/descriptions/columns.md new file: models/descriptions/prices.md new file: models/gold/prices/price__ez_asset_metadata.sql new file: models/gold/prices/price__ez_asset_metadata.yml new file: models/gold/prices/price__ez_prices_hourly.sql new file: models/gold/prices/price__ez_prices_hourly.yml new file: models/silver/prices/silver__complete_token_asset_metadata.sql new file: models/silver/prices/silver__complete_token_asset_metadata.yml new file: models/silver/prices/silver__complete_token_prices.sql new file: models/silver/prices/silver__complete_token_prices.yml modified: models/sources.yml --- .../bronze__complete_token_asset_metadata.sql | 31 +++++ .../prices/bronze__complete_token_prices.sql | 34 +++++ models/descriptions/columns.md | 6 +- models/descriptions/prices.md | 128 ++++++++++++++++++ .../gold/prices/price__ez_asset_metadata.sql | 36 +++++ .../gold/prices/price__ez_asset_metadata.yml | 34 +++++ .../gold/prices/price__ez_prices_hourly.sql | 40 ++++++ .../gold/prices/price__ez_prices_hourly.yml | 40 ++++++ .../silver__complete_token_asset_metadata.sql | 41 ++++++ .../silver__complete_token_asset_metadata.yml | 24 ++++ .../prices/silver__complete_token_prices.sql | 33 +++++ .../prices/silver__complete_token_prices.yml | 35 +++++ models/sources.yml | 5 +- 13 files changed, 484 insertions(+), 3 deletions(-) create mode 100644 models/bronze/prices/bronze__complete_token_asset_metadata.sql create mode 100644 models/bronze/prices/bronze__complete_token_prices.sql create mode 100644 models/descriptions/prices.md create mode 100644 models/gold/prices/price__ez_asset_metadata.sql create mode 100644 models/gold/prices/price__ez_asset_metadata.yml create mode 100644 models/gold/prices/price__ez_prices_hourly.sql create mode 100644 models/gold/prices/price__ez_prices_hourly.yml create mode 100644 models/silver/prices/silver__complete_token_asset_metadata.sql create mode 100644 models/silver/prices/silver__complete_token_asset_metadata.yml create mode 100644 models/silver/prices/silver__complete_token_prices.sql create mode 100644 models/silver/prices/silver__complete_token_prices.yml diff --git a/models/bronze/prices/bronze__complete_token_asset_metadata.sql b/models/bronze/prices/bronze__complete_token_asset_metadata.sql new file mode 100644 index 0000000..1168bfc --- /dev/null +++ b/models/bronze/prices/bronze__complete_token_asset_metadata.sql @@ -0,0 +1,31 @@ +{{ config ( + materialized = 'view', + tags = ['bronze_prices'] +) }} + +SELECT + token_address, + asset_id, + symbol, + NAME, + decimals, + blockchain, + blockchain_name, + blockchain_id, + is_deprecated, + is_verified, + provider, + source, + _inserted_timestamp, + inserted_timestamp, + modified_timestamp, + complete_token_asset_metadata_id, + _invocation_id +FROM + {{ source( + 'crosschain_silver', + 'complete_token_asset_metadata' + ) }} +WHERE + blockchain = 'sui' + AND len(token_address) > 1 diff --git a/models/bronze/prices/bronze__complete_token_prices.sql b/models/bronze/prices/bronze__complete_token_prices.sql new file mode 100644 index 0000000..15994d8 --- /dev/null +++ b/models/bronze/prices/bronze__complete_token_prices.sql @@ -0,0 +1,34 @@ +{{ 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, + is_verified, + provider, + source, + _inserted_timestamp, + inserted_timestamp, + modified_timestamp, + complete_token_prices_id, + _invocation_id +FROM + {{ source( + 'crosschain_silver', + 'complete_token_prices' + ) }} +WHERE + blockchain = 'sui' + AND len(token_address) > 1 diff --git a/models/descriptions/columns.md b/models/descriptions/columns.md index ae94736..33816e0 100644 --- a/models/descriptions/columns.md +++ b/models/descriptions/columns.md @@ -272,4 +272,8 @@ Web URL pointing to the token's icon image. Used for visual representation in wa {% docs id %} Unique identifier for the token metadata record, linking metadata to on-chain token types. Used for metadata management, registry operations, and analytics joins. Example: 'tokenmeta_123'. -{% enddocs %} \ No newline at end of file +{% enddocs %} + +{% docs token_is_verified %} +Boolean flag indicating whether the token or price record is verified by Flipside's crosschain curation process. Verified tokens are prioritized for analytics and are considered reliable for most use cases. Unverified tokens may be incomplete, deprecated, or experimental. +{% enddocs %} \ No newline at end of file diff --git a/models/descriptions/prices.md b/models/descriptions/prices.md new file mode 100644 index 0000000..533e006 --- /dev/null +++ b/models/descriptions/prices.md @@ -0,0 +1,128 @@ + + +{% docs prices_ez_asset_metadata_table_doc %} + +A convenience table holding prioritized asset metadata and other relevant details pertaining to each token_address and native asset. This data set is highly curated and contains metadata for one unique asset per blockchain. + +{% enddocs %} + + +{% docs prices_ez_prices_hourly_table_doc %} + +A convenience table for determining token prices by address and blockchain, and native asset prices by symbol and blockchain. This data set is highly curated and contains metadata for one price per hour per unique asset and blockchain. + +{% enddocs %} + +{% docs prices_provider %} + +The provider or source of the data. + +{% enddocs %} + +{% docs prices_asset_id %} + +The unique identifier representing the asset. + +{% enddocs %} + +{% docs prices_name %} + +The name of asset. + +{% enddocs %} + +{% docs prices_symbol %} + +The symbol of asset. + +{% enddocs %} + +{% docs prices_token_address %} + +The specific address representing the asset on a specific platform. This will be NULL if referring to a native asset. + +{% enddocs %} + +{% docs prices_blockchain %} + +The Blockchain, Network, or Platform for this asset. + +{% enddocs %} + +{% docs prices_blockchain_id %} + +The unique identifier of the Blockchain, Network, or Platform for this asset. + +{% enddocs %} + +{% docs prices_decimals %} + +The number of decimals for the asset. May be NULL. + +{% enddocs %} + +{% docs prices_is_native %} + +A flag indicating assets native to the respective blockchain. + +{% enddocs %} + +{% docs prices_is_deprecated %} + +A flag indicating if the asset is deprecated or no longer supported by the provider. + +{% enddocs %} + +{% docs prices_id_deprecation %} + +Deprecating soon! Please use the `asset_id` column instead. + +{% enddocs %} + +{% docs prices_decimals_deprecation %} + +Deprecating soon! Please use the decimals column in `ez_asset_metadata` or join in `dim_contracts` instead. + +{% enddocs %} + +{% docs prices_hour %} + +Hour that the price was recorded at. + +{% enddocs %} + +{% docs prices_price %} + +Closing price of the recorded hour in USD. + +{% enddocs %} + +{% docs prices_is_imputed %} + +A flag indicating if the price was imputed, or derived, from the last arriving record. This is generally used for tokens with low-liquidity or inconsistent reporting. + +{% enddocs %} + +{% docs prices_open %} + +Opening price of the recorded hour in USD. + +{% enddocs %} + +{% docs prices_high %} + +Highest price of the recorded hour in USD + +{% enddocs %} + +{% docs prices_low %} + +Lowest price of the recorded hour in USD + +{% enddocs %} + +{% docs prices_close %} + +Closing price of the recorded hour in USD + +{% enddocs %} \ No newline at end of file diff --git a/models/gold/prices/price__ez_asset_metadata.sql b/models/gold/prices/price__ez_asset_metadata.sql new file mode 100644 index 0000000..f8dcfcb --- /dev/null +++ b/models/gold/prices/price__ez_asset_metadata.sql @@ -0,0 +1,36 @@ +{{ config( + materialized = 'incremental', + incremental_strategy = 'merge', + merge_exclude_columns = ["inserted_timestamp"], + unique_key = 'ez_asset_metadata_id', + post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(token_address, symbol)", + tags = ['gold_prices','core'] +) }} + +SELECT + token_address, + asset_id, + symbol, + NAME, + decimals, + blockchain, + FALSE AS is_native, + is_deprecated, + COALESCE( + is_verified, + FALSE + ) AS token_is_verified, + {{ dbt_utils.generate_surrogate_key(['complete_token_asset_metadata_id']) }} AS ez_asset_metadata_id, + SYSDATE() AS inserted_timestamp, + SYSDATE() AS modified_timestamp +FROM + {{ ref('silver__complete_token_asset_metadata') }} + +{% if is_incremental() %} +WHERE + modified_timestamp > ( + SELECT + COALESCE(MAX(modified_timestamp), '1970-01-01' :: TIMESTAMP) AS modified_timestamp + FROM + {{ this }}) + {% endif %} diff --git a/models/gold/prices/price__ez_asset_metadata.yml b/models/gold/prices/price__ez_asset_metadata.yml new file mode 100644 index 0000000..f77d716 --- /dev/null +++ b/models/gold/prices/price__ez_asset_metadata.yml @@ -0,0 +1,34 @@ +version: 2 +models: + - name: price__ez_asset_metadata + description: '{{ doc("prices_ez_asset_metadata_table_doc") }}' + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - TOKEN_ADDRESS + columns: + - name: ASSET_ID + description: '{{ doc("prices_asset_id") }}' + - name: NAME + description: '{{ doc("prices_name") }}' + - name: SYMBOL + description: '{{ doc("prices_symbol") }}' + - name: TOKEN_ADDRESS + description: '{{ doc("prices_token_address") }}' + - name: BLOCKCHAIN + description: '{{ doc("prices_blockchain") }}' + - name: DECIMALS + description: '{{ doc("prices_decimals") }}' + - name: IS_NATIVE + description: '{{ doc("prices_is_native") }}' + - name: TOKEN_IS_VERIFIED + description: "{{ doc('token_is_verified') }}" + - name: IS_DEPRECATED + description: '{{ doc("prices_is_deprecated") }}' + - name: EZ_ASSET_METADATA_ID + description: '{{ doc("id") }}' + - name: INSERTED_TIMESTAMP + description: '{{ doc("inserted_timestamp") }}' + - name: MODIFIED_TIMESTAMP + description: '{{ doc("modified_timestamp") }}' + \ No newline at end of file diff --git a/models/gold/prices/price__ez_prices_hourly.sql b/models/gold/prices/price__ez_prices_hourly.sql new file mode 100644 index 0000000..8a6bf3c --- /dev/null +++ b/models/gold/prices/price__ez_prices_hourly.sql @@ -0,0 +1,40 @@ +{{ config( + materialized = 'incremental', + incremental_strategy = 'merge', + merge_exclude_columns = ["inserted_timestamp"], + incremental_predicates = ["dynamic_range_predicate", "HOUR::date"], + unique_key = 'ez_prices_hourly_id', + cluster_by = ['hour::DATE'], + post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(token_address, symbol)", + tags = ['gold_prices','core'] +) }} + +SELECT + HOUR, + token_address, + symbol, + NAME, + decimals, + price, + blockchain, + FALSE AS is_native, + is_deprecated, + is_imputed, + COALESCE( + is_verified, + FALSE + ) AS token_is_verified, + {{ dbt_utils.generate_surrogate_key(['complete_token_prices_id']) }} AS ez_prices_hourly_id, + SYSDATE() AS inserted_timestamp, + SYSDATE() AS modified_timestamp +FROM + {{ ref('silver__complete_token_prices') }} + +{% if is_incremental() %} +WHERE + modified_timestamp > ( + SELECT + COALESCE(MAX(modified_timestamp), '1970-01-01' :: TIMESTAMP) AS modified_timestamp + FROM + {{ this }}) + {% endif %} diff --git a/models/gold/prices/price__ez_prices_hourly.yml b/models/gold/prices/price__ez_prices_hourly.yml new file mode 100644 index 0000000..61d93ed --- /dev/null +++ b/models/gold/prices/price__ez_prices_hourly.yml @@ -0,0 +1,40 @@ +version: 2 +models: + - name: price__ez_prices_hourly + description: '{{ doc("prices_ez_prices_hourly_table_doc") }}' + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - HOUR + - TOKEN_ADDRESS + columns: + - name: HOUR + description: '{{ doc("prices_hour")}}' + tests: + - dbt_expectations.expect_row_values_to_have_recent_data: + datepart: day + interval: 2 + - name: TOKEN_ADDRESS + description: '{{ doc("prices_token_address") }}' + - name: SYMBOL + description: '{{ doc("prices_symbol") }}' + - name: BLOCKCHAIN + description: '{{ doc("prices_blockchain") }}' + - name: DECIMALS + description: '{{ doc("prices_decimals") }}' + - name: PRICE + description: '{{ doc("prices_price") }}' + - name: IS_NATIVE + description: '{{ doc("prices_is_native") }}' + - name: IS_IMPUTED + description: '{{ doc("prices_is_imputed") }}' + - name: TOKEN_IS_VERIFIED + description: "{{ doc('token_is_verified') }}" + - name: IS_DEPRECATED + description: '{{ doc("prices_is_deprecated") }}' + - name: EZ_PRICES_HOURLY_ID + description: '{{ doc("id") }}' + - name: INSERTED_TIMESTAMP + description: '{{ doc("inserted_timestamp") }}' + - name: MODIFIED_TIMESTAMP + description: '{{ doc("modified_timestamp") }}' diff --git a/models/silver/prices/silver__complete_token_asset_metadata.sql b/models/silver/prices/silver__complete_token_asset_metadata.sql new file mode 100644 index 0000000..c5fd29d --- /dev/null +++ b/models/silver/prices/silver__complete_token_asset_metadata.sql @@ -0,0 +1,41 @@ +{{ config( + materialized = 'view', + tags = ['silver','core'] +) }} + +SELECT + LOWER( + A.token_address + ) AS token_address, + asset_id, + symbol, + NAME, + decimals, + blockchain, + blockchain_name, + blockchain_id, + is_deprecated, + is_verified, + provider, + source, + _inserted_timestamp, + inserted_timestamp, + modified_timestamp, + {{ dbt_utils.generate_surrogate_key(['complete_token_asset_metadata_id']) }} AS complete_token_asset_metadata_id, + '{{ invocation_id }}' AS _invocation_id +FROM + {{ ref( + 'bronze__complete_token_asset_metadata' + ) }} A + +{% if is_incremental() %} +WHERE + modified_timestamp >= ( + SELECT + MAX( + modified_timestamp + ) + FROM + {{ this }} + ) +{% endif %} diff --git a/models/silver/prices/silver__complete_token_asset_metadata.yml b/models/silver/prices/silver__complete_token_asset_metadata.yml new file mode 100644 index 0000000..7f7551f --- /dev/null +++ b/models/silver/prices/silver__complete_token_asset_metadata.yml @@ -0,0 +1,24 @@ +version: 2 +models: + - name: silver__complete_token_asset_metadata + + + columns: + - name: PROVIDER + tests: + - not_null + - name: TOKEN_ADDRESS + tests: + - not_null + - name: BLOCKCHAIN + tests: + - not_null + - name: BLOCKCHAIN_ID + tests: + - not_null + - name: MODIFIED_TIMESTAMP + tests: + - not_null + - name: COMPLETE_TOKEN_ASSET_METADATA_ID + tests: + - unique \ No newline at end of file diff --git a/models/silver/prices/silver__complete_token_prices.sql b/models/silver/prices/silver__complete_token_prices.sql new file mode 100644 index 0000000..a48521c --- /dev/null +++ b/models/silver/prices/silver__complete_token_prices.sql @@ -0,0 +1,33 @@ +{{ config( + materialized = 'view', + tags = ['silver','core'] +) }} + +SELECT + HOUR, + LOWER( + p.token_address + ) AS token_address, + asset_id, + symbol, + NAME, + decimals, + price, + blockchain, + blockchain_name, + blockchain_id, + is_imputed, + is_deprecated, + is_verified, + provider, + source, + _inserted_timestamp, + inserted_timestamp, + modified_timestamp, + {{ dbt_utils.generate_surrogate_key(['complete_token_prices_id']) }} AS complete_token_prices_id, + '{{ invocation_id }}' AS _invocation_id +FROM + {{ ref( + 'bronze__complete_token_prices' + ) }} + p diff --git a/models/silver/prices/silver__complete_token_prices.yml b/models/silver/prices/silver__complete_token_prices.yml new file mode 100644 index 0000000..e858a88 --- /dev/null +++ b/models/silver/prices/silver__complete_token_prices.yml @@ -0,0 +1,35 @@ +version: 2 +models: + - name: silver__complete_token_prices + + columns: + - name: HOUR + tests: + - not_null + - name: TOKEN_ADDRESS + tests: + - not_null + - name: BLOCKCHAIN + tests: + - not_null + - name: BLOCKCHAIN_ID + tests: + - not_null + - name: PROVIDER + tests: + - not_null + - name: PRICE + tests: + - not_null + - name: IS_IMPUTED + tests: + - not_null + - name: _INSERTED_TIMESTAMP + tests: + - not_null + - name: MODIFIED_TIMESTAMP + tests: + - not_null + - name: COMPLETE_TOKEN_PRICES_ID + tests: + - unique \ No newline at end of file diff --git a/models/sources.yml b/models/sources.yml index 4e420d4..fd150b0 100644 --- a/models/sources.yml +++ b/models/sources.yml @@ -19,5 +19,6 @@ sources: schema: silver tables: - name: number_sequence - - name: complete_native_prices - - name: labels_combined \ No newline at end of file + - name: labels_combined + - name: complete_token_asset_metadata + - name: complete_token_prices \ No newline at end of file From ab5986a79b0a581ddf719eef79c30e68c8050b7f Mon Sep 17 00:00:00 2001 From: Eric Laurello Date: Wed, 23 Jul 2025 23:31:09 -0400 Subject: [PATCH 2/5] easy backfils --- .../workflows/dbt_run_coin_info_backfill.yml | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/dbt_run_coin_info_backfill.yml diff --git a/.github/workflows/dbt_run_coin_info_backfill.yml b/.github/workflows/dbt_run_coin_info_backfill.yml new file mode 100644 index 0000000..771781e --- /dev/null +++ b/.github/workflows/dbt_run_coin_info_backfill.yml @@ -0,0 +1,72 @@ +name: dbt_run_coin_info_backfill +run-name: dbt_run_coin_info_backfill + +on: + workflow_dispatch: + branches: + - "main" + schedule: + - cron: '0 * * * *' # Run every hour + +env: + DBT_PROFILES_DIR: "${{ vars.DBT_PROFILES_DIR }}" + + ACCOUNT: "${{ vars.ACCOUNT }}" + ROLE: "${{ vars.ROLE }}" + USER: "${{ vars.USER }}" + PASSWORD: "${{ secrets.PASSWORD }}" + REGION: "${{ vars.REGION }}" + DATABASE: "${{ vars.DATABASE }}" + WAREHOUSE: "${{ vars.WAREHOUSE }}" + SCHEMA: "${{ vars.SCHEMA }}" + +concurrency: + group: ${{ github.workflow }} + +jobs: + run_dbt_jobs: + runs-on: ubuntu-latest + environment: + name: workflow_prod + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: "${{ vars.PYTHON_VERSION }}" + cache: "pip" + + - name: install dependencies + run: | + pip install -r requirements.txt + dbt deps + - name: Run DBT Jobs + run: | + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql + dbt run -m models/bronze/bronze_api__coin_metadata.sql From 83e00c62a6409bf25e94267e6b5c6705a5006c1b Mon Sep 17 00:00:00 2001 From: Eric Laurello Date: Tue, 29 Jul 2025 16:34:20 -0400 Subject: [PATCH 3/5] cols --- models/descriptions/columns.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/models/descriptions/columns.md b/models/descriptions/columns.md index e3cf19f..be2a561 100644 --- a/models/descriptions/columns.md +++ b/models/descriptions/columns.md @@ -286,6 +286,22 @@ Web URL pointing to the token's icon image. Used for visual representation in wa Unique identifier for the token metadata record, linking metadata to on-chain token types. Used for metadata management, registry operations, and analytics joins. Example: 'tokenmeta_123'. {% enddocs %} +{% docs address_owner %} +The 32-byte Sui address (hex with 0x prefix) that owns this object when it has address-based ownership. Address-owned objects are controlled by a specific account and can only be accessed by their owner, providing exclusive control and enabling efficient parallel processing since they don't require consensus. Used for wallet analytics, ownership tracking, and transaction authorization analysis. When null, the object has a different ownership type (shared, immutable, or object-owned). Example: '0xabc123...'. +{% enddocs %} + +{% docs shared_owner %} +Variant data structure indicating this object has shared ownership, meaning it's accessible to everyone on the network and requires consensus validation for modifications. Shared objects enable coordination between multiple addresses but incur higher transaction costs due to consensus requirements. Used for marketplaces, escrows, AMMs, and other multi-user scenarios. Contains metadata about the shared object's initial version and access permissions. When null, the object has address-based, immutable, or object-based ownership. Example: {"initial_shared_version": 123}. +{% enddocs %} + +{% docs modules %} +Comma-separated list of Move module names contained within the package. Modules define the package's functionality and can be called by transactions to execute smart contract logic. Each module has a unique name within its package and contains functions, structs, and resources. Used for analyzing package composition, tracking module usage patterns, and understanding smart contract functionality. Example: 'coin,transfer,governance'. +{% enddocs %} + +{% docs amount_normalized %} +Decimal-adjusted token amount calculated by dividing the raw amount by 10^decimals. Provides human-readable token quantities that can be directly compared across different token types. Essential for financial analysis, balance calculations, and user-facing applications where raw blockchain amounts need to be converted to meaningful values. Example: if amount is 1000000000 and decimals is 9, amount_normalized would be 1.0. +{% enddocs %} + {% docs token_is_verified %} Boolean flag indicating whether the token or price record is verified by Flipside's crosschain curation process. Verified tokens are prioritized for analytics and are considered reliable for most use cases. Unverified tokens may be incomplete, deprecated, or experimental. {% enddocs %} \ No newline at end of file From d5873beb8ade2807b5e871af9b57537bedaf4d6f Mon Sep 17 00:00:00 2001 From: Eric Laurello Date: Tue, 29 Jul 2025 16:35:03 -0400 Subject: [PATCH 4/5] clean --- models/descriptions/columns.md | 131 ++++++++++++++++++++++++++++++++- models/descriptions/prices.md | 128 -------------------------------- 2 files changed, 130 insertions(+), 129 deletions(-) delete mode 100644 models/descriptions/prices.md diff --git a/models/descriptions/columns.md b/models/descriptions/columns.md index be2a561..c563146 100644 --- a/models/descriptions/columns.md +++ b/models/descriptions/columns.md @@ -304,4 +304,133 @@ Decimal-adjusted token amount calculated by dividing the raw amount by 10^decima {% docs token_is_verified %} Boolean flag indicating whether the token or price record is verified by Flipside's crosschain curation process. Verified tokens are prioritized for analytics and are considered reliable for most use cases. Unverified tokens may be incomplete, deprecated, or experimental. -{% enddocs %} \ No newline at end of file +{% enddocs %} + + + +{% docs prices_ez_asset_metadata_table_doc %} + +A convenience table holding prioritized asset metadata and other relevant details pertaining to each token_address and native asset. This data set is highly curated and contains metadata for one unique asset per blockchain. + +{% enddocs %} + + +{% docs prices_ez_prices_hourly_table_doc %} + +A convenience table for determining token prices by address and blockchain, and native asset prices by symbol and blockchain. This data set is highly curated and contains metadata for one price per hour per unique asset and blockchain. + +{% enddocs %} + +{% docs prices_provider %} + +The provider or source of the data. + +{% enddocs %} + +{% docs prices_asset_id %} + +The unique identifier representing the asset. + +{% enddocs %} + +{% docs prices_name %} + +The name of asset. + +{% enddocs %} + +{% docs prices_symbol %} + +The symbol of asset. + +{% enddocs %} + +{% docs prices_token_address %} + +The specific address representing the asset on a specific platform. This will be NULL if referring to a native asset. + +{% enddocs %} + +{% docs prices_blockchain %} + +The Blockchain, Network, or Platform for this asset. + +{% enddocs %} + +{% docs prices_blockchain_id %} + +The unique identifier of the Blockchain, Network, or Platform for this asset. + +{% enddocs %} + +{% docs prices_decimals %} + +The number of decimals for the asset. May be NULL. + +{% enddocs %} + +{% docs prices_is_native %} + +A flag indicating assets native to the respective blockchain. + +{% enddocs %} + +{% docs prices_is_deprecated %} + +A flag indicating if the asset is deprecated or no longer supported by the provider. + +{% enddocs %} + +{% docs prices_id_deprecation %} + +Deprecating soon! Please use the `asset_id` column instead. + +{% enddocs %} + +{% docs prices_decimals_deprecation %} + +Deprecating soon! Please use the decimals column in `ez_asset_metadata` or join in `dim_contracts` instead. + +{% enddocs %} + +{% docs prices_hour %} + +Hour that the price was recorded at. + +{% enddocs %} + +{% docs prices_price %} + +Closing price of the recorded hour in USD. + +{% enddocs %} + +{% docs prices_is_imputed %} + +A flag indicating if the price was imputed, or derived, from the last arriving record. This is generally used for tokens with low-liquidity or inconsistent reporting. + +{% enddocs %} + +{% docs prices_open %} + +Opening price of the recorded hour in USD. + +{% enddocs %} + +{% docs prices_high %} + +Highest price of the recorded hour in USD + +{% enddocs %} + +{% docs prices_low %} + +Lowest price of the recorded hour in USD + +{% enddocs %} + +{% docs prices_close %} + +Closing price of the recorded hour in USD + +{% enddocs %} \ No newline at end of file diff --git a/models/descriptions/prices.md b/models/descriptions/prices.md deleted file mode 100644 index 533e006..0000000 --- a/models/descriptions/prices.md +++ /dev/null @@ -1,128 +0,0 @@ - - -{% docs prices_ez_asset_metadata_table_doc %} - -A convenience table holding prioritized asset metadata and other relevant details pertaining to each token_address and native asset. This data set is highly curated and contains metadata for one unique asset per blockchain. - -{% enddocs %} - - -{% docs prices_ez_prices_hourly_table_doc %} - -A convenience table for determining token prices by address and blockchain, and native asset prices by symbol and blockchain. This data set is highly curated and contains metadata for one price per hour per unique asset and blockchain. - -{% enddocs %} - -{% docs prices_provider %} - -The provider or source of the data. - -{% enddocs %} - -{% docs prices_asset_id %} - -The unique identifier representing the asset. - -{% enddocs %} - -{% docs prices_name %} - -The name of asset. - -{% enddocs %} - -{% docs prices_symbol %} - -The symbol of asset. - -{% enddocs %} - -{% docs prices_token_address %} - -The specific address representing the asset on a specific platform. This will be NULL if referring to a native asset. - -{% enddocs %} - -{% docs prices_blockchain %} - -The Blockchain, Network, or Platform for this asset. - -{% enddocs %} - -{% docs prices_blockchain_id %} - -The unique identifier of the Blockchain, Network, or Platform for this asset. - -{% enddocs %} - -{% docs prices_decimals %} - -The number of decimals for the asset. May be NULL. - -{% enddocs %} - -{% docs prices_is_native %} - -A flag indicating assets native to the respective blockchain. - -{% enddocs %} - -{% docs prices_is_deprecated %} - -A flag indicating if the asset is deprecated or no longer supported by the provider. - -{% enddocs %} - -{% docs prices_id_deprecation %} - -Deprecating soon! Please use the `asset_id` column instead. - -{% enddocs %} - -{% docs prices_decimals_deprecation %} - -Deprecating soon! Please use the decimals column in `ez_asset_metadata` or join in `dim_contracts` instead. - -{% enddocs %} - -{% docs prices_hour %} - -Hour that the price was recorded at. - -{% enddocs %} - -{% docs prices_price %} - -Closing price of the recorded hour in USD. - -{% enddocs %} - -{% docs prices_is_imputed %} - -A flag indicating if the price was imputed, or derived, from the last arriving record. This is generally used for tokens with low-liquidity or inconsistent reporting. - -{% enddocs %} - -{% docs prices_open %} - -Opening price of the recorded hour in USD. - -{% enddocs %} - -{% docs prices_high %} - -Highest price of the recorded hour in USD - -{% enddocs %} - -{% docs prices_low %} - -Lowest price of the recorded hour in USD - -{% enddocs %} - -{% docs prices_close %} - -Closing price of the recorded hour in USD - -{% enddocs %} \ No newline at end of file From a8131dea42e04ca66b60adf19dc49888ad299e00 Mon Sep 17 00:00:00 2001 From: Eric Laurello Date: Wed, 30 Jul 2025 10:41:09 -0400 Subject: [PATCH 5/5] rm lower, add case for native --- models/gold/prices/price__ez_asset_metadata.sql | 5 ++++- models/gold/prices/price__ez_prices_hourly.sql | 5 ++++- .../silver/prices/silver__complete_token_asset_metadata.sql | 4 +--- models/silver/prices/silver__complete_token_prices.sql | 4 +--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/models/gold/prices/price__ez_asset_metadata.sql b/models/gold/prices/price__ez_asset_metadata.sql index f8dcfcb..7d34589 100644 --- a/models/gold/prices/price__ez_asset_metadata.sql +++ b/models/gold/prices/price__ez_asset_metadata.sql @@ -14,7 +14,10 @@ SELECT NAME, decimals, blockchain, - FALSE AS is_native, + CASE + WHEN token_address = '0x2::sui::SUI' THEN TRUE + ELSE FALSE + END AS is_native, is_deprecated, COALESCE( is_verified, diff --git a/models/gold/prices/price__ez_prices_hourly.sql b/models/gold/prices/price__ez_prices_hourly.sql index 8a6bf3c..cae8652 100644 --- a/models/gold/prices/price__ez_prices_hourly.sql +++ b/models/gold/prices/price__ez_prices_hourly.sql @@ -17,7 +17,10 @@ SELECT decimals, price, blockchain, - FALSE AS is_native, + CASE + WHEN token_address = '0x2::sui::SUI' THEN TRUE + ELSE FALSE + END AS is_native, is_deprecated, is_imputed, COALESCE( diff --git a/models/silver/prices/silver__complete_token_asset_metadata.sql b/models/silver/prices/silver__complete_token_asset_metadata.sql index c5fd29d..cfd5237 100644 --- a/models/silver/prices/silver__complete_token_asset_metadata.sql +++ b/models/silver/prices/silver__complete_token_asset_metadata.sql @@ -4,9 +4,7 @@ ) }} SELECT - LOWER( - A.token_address - ) AS token_address, + A.token_address, asset_id, symbol, NAME, diff --git a/models/silver/prices/silver__complete_token_prices.sql b/models/silver/prices/silver__complete_token_prices.sql index a48521c..e8d0b8a 100644 --- a/models/silver/prices/silver__complete_token_prices.sql +++ b/models/silver/prices/silver__complete_token_prices.sql @@ -5,9 +5,7 @@ SELECT HOUR, - LOWER( - p.token_address - ) AS token_address, + p.token_address, asset_id, symbol, NAME,