From bf4ec5cf6b45d1c097a0f9eae0c84831494c8add Mon Sep 17 00:00:00 2001 From: Sam <110511194+sam-xyz@users.noreply.github.com> Date: Mon, 24 Feb 2025 09:47:05 +0800 Subject: [PATCH] Add nft cols poly (#424) * add date * add columns and docs * add deprecation notice --- .../fsc_evm/evm_deprecations.md | 83 +++++++++---------- models/doc_descriptions/fsc_evm/nft.md | 34 +++++++- models/gold/NFT/nft__ez_nft_mints.sql | 32 +++++-- models/gold/NFT/nft__ez_nft_mints.yml | 57 ++++++++----- models/gold/NFT/nft__ez_nft_sales.sql | 30 ++++--- models/gold/NFT/nft__ez_nft_sales.yml | 32 ++++--- models/gold/NFT/nft__ez_nft_transfers.sql | 46 +++++++--- models/gold/NFT/nft__ez_nft_transfers.yml | 50 +++++++---- 8 files changed, 236 insertions(+), 128 deletions(-) diff --git a/models/doc_descriptions/fsc_evm/evm_deprecations.md b/models/doc_descriptions/fsc_evm/evm_deprecations.md index cefafdd..d40798b 100644 --- a/models/doc_descriptions/fsc_evm/evm_deprecations.md +++ b/models/doc_descriptions/fsc_evm/evm_deprecations.md @@ -1,240 +1,239 @@ {% docs evm_column_deprecation_notice %} -This column is being deprecated for standardization purposes. Please update your queries by February 28, 2025. +This column is being deprecated for standardization purposes. Please update your queries by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_hash %} -This column is being deprecated for standardization purposes. Please update your queries to use the `block_hash` column instead by February 28, 2025. +This column is being deprecated for standardization purposes. Please update your queries to use the `block_hash` column instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_block_hash %} -This column is being deprecated for standardization purposes. Please remove from your queries by February 28, 2025. +This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. {% enddocs %} - {% docs evm_column_deprecation_notice_position %} -This column is being deprecated for standardization purposes. Please update your queries to use the `tx_position` column instead by February 28, 2025. +This column is being deprecated for standardization purposes. Please update your queries to use the `tx_position` column instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_tx_status %} -This column is being deprecated for standardization purposes. Please update your queries to use the `tx_succeeded` column instead by February 28, 2025. +This column is being deprecated for standardization purposes. Please update your queries to use the `tx_succeeded` column instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_chain_id %} -This column is being removed for standardization purposes. Please remove from your queries by February 28, 2025. +This column is being removed for standardization purposes. Please remove from your queries by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_identifier %} -This column is being deprecated for standardization purposes. Please update your queries to use the `trace_address` column instead by February 28, 2025. +This column is being deprecated for standardization purposes. Please update your queries to use the `trace_address` column instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_trace_status %} -This column is being deprecated for standardization purposes. Please update your queries to use the `trace_succeeded` column instead by February 28, 2025. +This column is being deprecated for standardization purposes. Please update your queries to use the `trace_succeeded` column instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_log_id %} -This column is being removed for standardization purposes. Please remove or update your queries with `CONCAT(tx_hash, '_', event_index)` to reconstruct `_log_id` by February 28, 2025. +This column is being removed for standardization purposes. Please remove or update your queries with `CONCAT(tx_hash, '_', event_index)` to reconstruct `_log_id` by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_inserted_timestamp %} -This column is being removed for standardization purposes. Please update your queries to use the `modified_timestamp` column instead by February 28, 2025. +This column is being removed for standardization purposes. Please update your queries to use the `modified_timestamp` column instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_blockchain %} -This column is being removed for standardization purposes. Please remove from your queries by February 28, 2025. +This column is being removed for standardization purposes. Please remove from your queries by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_block_header_json %} -This column is being removed for standardization purposes and will be replaced with new columns associated with the keys extracted from this json. Please remove from your queries by February 28, 2025. +This column is being removed for standardization purposes and will be replaced with new columns associated with the keys extracted from this json. Please remove from your queries by March 10, 2025. {% enddocs %} {% docs evm_table_deprecation_notice %} -This table is being deprecated for standardization purposes. Please update your queries by February 28, 2025. +This table is being deprecated for standardization purposes. Please update your queries by March 10, 2025. {% enddocs %} {% docs evm_table_deprecation_notice_fact_decoded_event_logs %} -This table is being deprecated for standardization purposes. Please update your queries to use `ez_decoded_event_logs` instead by February 28, 2025. +This table is being deprecated for standardization purposes. Please update your queries to use `ez_decoded_event_logs` instead by March 10, 2025. {% enddocs %} {% docs evm_table_deprecation_notice_fact_decoded_traces %} -This table is being deprecated for standardization purposes. Please update your queries to use `ez_decoded_traces` instead by February 28, 2025. +This table is being deprecated for standardization purposes. Please update your queries to use `ez_decoded_traces` instead by March 10, 2025. {% enddocs %} {% docs evm_table_deprecation_notice_fact_token_transfers %} -This table is being deprecated for standardization purposes. Please update your queries to use `ez_token_transfers` instead by February 28, 2025. +This table is being deprecated for standardization purposes. Please update your queries to use `ez_token_transfers` instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_l1_state_root_tx_hash %} -This column is being deprecated for standardization purposes. Please remove from your queries by February 28, 2025. +This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_l1_state_root_batch_index %} -This column is being deprecated for standardization purposes. Please remove from your queries by February 28, 2025. +This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_l1_submission_tx_hash %} -This column is being deprecated for standardization purposes. Please remove from your queries by February 28, 2025. +This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_l1_submission_batch_index %} -This column is being deprecated for standardization purposes. Please remove from your queries by February 28, 2025. +This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_l1_submission_details %} -This column is being deprecated for standardization purposes. Please remove from your queries by February 28, 2025. +This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_data %} -This column is being deprecated for standardization purposes. Please remove from your queries by February 28, 2025. +This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_deposit_nonce %} -This column is being deprecated for standardization purposes. Please remove from your queries by February 28, 2025. +This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_deposit_receipt_version %} -This column is being deprecated for standardization purposes. Please remove from your queries by February 28, 2025. +This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_token_price %} -This column is being deprecated for standardization purposes. Please remove from your queries by February 28, 2025. +This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_has_price %} -This column is being deprecated for standardization purposes. Please remove from your queries by February 28, 2025. +This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_has_decimal %} -This column is being deprecated for standardization purposes. Please remove from your queries by February 28, 2025. +This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_nft_address %} -This column is being removed for standardization purposes. Please update your queries to use the `contract_address` column instead by February 28, 2025. +This column is being removed for standardization purposes. Please update your queries to use the `contract_address` column instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_tokenid %} -This column is being removed for standardization purposes. Please update your queries to use the `token_id` column instead by February 28, 2025. +This column is being removed for standardization purposes. Please update your queries to use the `token_id` column instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_erc1155_value %} -This column is being removed for standardization purposes. Please update your queries to use the `quantity` column instead by February 28, 2025. +This column is being removed for standardization purposes. Please update your queries to use the `quantity` column instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_project_name %} -This column is being removed for standardization purposes. Please update your queries to use the `name` column instead by February 28, 2025. +This column is being removed for standardization purposes. Please update your queries to use the `name` column instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_loanid %} -This column is being removed for standardization purposes. Please update your queries to use the `loan_id` column instead by February 28, 2025. +This column is being removed for standardization purposes. Please update your queries to use the `loan_id` column instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_tokenid_name %} -This column is being removed for standardization purposes. Please update your queries to use the `token_id_name` column instead by February 28, 2025. +This column is being removed for standardization purposes. Please update your queries to use the `token_id_name` column instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_tokenid_description %} -This column is being removed for standardization purposes. Please update your queries to use the `token_id_description` column instead by February 28, 2025. +This column is being removed for standardization purposes. Please update your queries to use the `token_id_description` column instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_tokenid_image_url %} -This column is being removed for standardization purposes. Please update your queries to use the `token_id_image_url` column instead by February 28, 2025. +This column is being removed for standardization purposes. Please update your queries to use the `token_id_image_url` column instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_nft_address_tokenid %} -This column is being removed for standardization purposes. Please update your queries to use the `nft_address_token_id` column instead by February 28, 2025. +This column is being removed for standardization purposes. Please update your queries to use the `nft_address_token_id` column instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_nft_from_address %} -This column is being removed for standardization purposes. Please update your queries to use the `from_address` column instead by February 28, 2025. +This column is being removed for standardization purposes. Please update your queries to use the `from_address` column instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_nft_to_address %} -This column is being removed for standardization purposes. Please update your queries to use the `to_address` column instead by February 28, 2025. +This column is being removed for standardization purposes. Please update your queries to use the `to_address` column instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_mint_price_eth %} -This column is being removed for standardization purposes. Please update your queries to use the `mint_price_native` column instead by February 28, 2025. +This column is being removed for standardization purposes. Please update your queries to use the `mint_price_native` column instead by March 10, 2025. {% enddocs %} {% docs evm_column_deprecation_notice_event_type %} -This column is being removed for standardization purposes. Please remove from your queries by February 28, 2025. +This column is being removed for standardization purposes. Please remove from your queries by March 10, 2025. -{% enddocs %} \ No newline at end of file +{% enddocs %} diff --git a/models/doc_descriptions/fsc_evm/nft.md b/models/doc_descriptions/fsc_evm/nft.md index 8ac9dae..f931b01 100644 --- a/models/doc_descriptions/fsc_evm/nft.md +++ b/models/doc_descriptions/fsc_evm/nft.md @@ -4,14 +4,12 @@ This table contains NFT sales on this EVM blockchain. More NFT marketplaces will {% enddocs %} - {% docs evm_ez_nft_sales_table_doc %} This table contains NFT sale events from various marketplaces. {% enddocs %} - {% docs evm_ez_nft_mint_table_doc %} This table contains NFT mint events, defined as NFT transfers from a burn address to an address, on this EVM blockchain. @@ -574,4 +572,34 @@ The url of the image for this tokenId. The concatenation of NFT address and tokenId. -{% enddocs %} \ No newline at end of file +{% enddocs %} + +{% docs evm_nft_token_standard %} + +The standard of the token, either erc721 or erc1155. + +{% enddocs %} + +{% docs evm_nft_is_mint %} + +Whether the transaction is a mint. + +{% enddocs %} + +{% docs evm_nft_quantity %} + +The quantity of the NFTs minted in the transaction. + +{% enddocs %} + +{% docs nft_nft_from_address %} + +The address of the nft sender for this event. + +{% enddocs %} + +{% docs nft_nft_to_address %} + +The address of the nft receiver for this event. + +{% enddocs %} diff --git a/models/gold/NFT/nft__ez_nft_mints.sql b/models/gold/NFT/nft__ez_nft_mints.sql index 9ea4e6f..9ef8b71 100644 --- a/models/gold/NFT/nft__ez_nft_mints.sql +++ b/models/gold/NFT/nft__ez_nft_mints.sql @@ -8,15 +8,23 @@ SELECT block_number, block_timestamp, - tx_hash, event_index, intra_event_index, - contract_address AS nft_address, - project_name, - from_address AS nft_from_address, - to_address AS nft_to_address, - tokenId, - erc1155_value, + tx_hash, + event_type, + contract_address,--new column + project_name AS NAME,--new column + from_address,--new column + to_address,--new column + tokenId AS token_id,--new column + COALESCE( + erc1155_value, + '1' + ) :: STRING AS quantity,--new column + CASE + WHEN erc1155_value IS NULL THEN 'erc721' + ELSE 'erc1155' + END AS token_standard,--new column COALESCE ( nft_transfers_id, {{ dbt_utils.generate_surrogate_key( @@ -30,9 +38,17 @@ SELECT COALESCE( modified_timestamp, '2000-01-01' - ) AS modified_timestamp + ) AS modified_timestamp, + contract_address AS nft_address, -- deprecate + project_name, -- deprecate + from_address AS nft_from_address, -- deprecate + to_address AS nft_to_address, -- deprecate + tokenId, -- deprecate + erc1155_value -- deprecate FROM {{ ref('silver__nft_transfers') }} WHERE event_type = 'mint' AND from_address = '0x0000000000000000000000000000000000000000' + + diff --git a/models/gold/NFT/nft__ez_nft_mints.yml b/models/gold/NFT/nft__ez_nft_mints.yml index e7ddbed..9ed2f86 100644 --- a/models/gold/NFT/nft__ez_nft_mints.yml +++ b/models/gold/NFT/nft__ez_nft_mints.yml @@ -1,34 +1,49 @@ version: 2 models: - name: nft__ez_nft_mints - description: 'This table contains all ERC721 and ERC1155 mint events.' - + description: We will be deprecating this table by March 10. Please use the ez_nft_transfers table together with the is_mint column to filter for nft mints. columns: - name: BLOCK_NUMBER - description: 'The block number of the NFT transfer.' + description: '{{ doc("nft_block_no") }}' - name: BLOCK_TIMESTAMP - description: 'The block timestamp of the NFT transfer.' + description: '{{ doc("nft_blocktime") }}' - name: TX_HASH - description: 'The transaction hash of the NFT transfer. Please note this is not unique, as it is possible to have multiple NFT transfers in a single transaction.' - - name: NFT_ADDRESS - description: 'The address of the NFT contract.' - - name: PROJECT_NAME - description: 'The name of the project, read from the NFT contract.' - - name: ERC1155_VALUE - description: 'The value of the ERC1155 transfer. This is only populated for ERC1155 transfers.' - - name: NFT_FROM_ADDRESS - description: 'The address of the sender of the NFT transfer.' - - name: NFT_TO_ADDRESS - description: 'The address of the recipient of the NFT transfer.' - - name: TOKENID - description: 'The token ID of the NFT transfer.' + description: '{{ doc("nft_tx_hash") }}' - name: EVENT_INDEX - description: 'The index of the NFT transfer within the transaction. This is used to ensure that multiple NFT transfers in a single transaction are not duplicated.' + description: '{{ doc("nft_event_index") }}' - name: INTRA_EVENT_INDEX description: '{{ doc("nft_intra_event_index") }}' + - name: EVENT_TYPE + description: '{{ doc("nft_event_type") }}' + - name: NFT_ADDRESS + description: '{{ doc("evm_column_deprecation_notice_nft_address") }}' + - name: CONTRACT_ADDRESS + description: '{{ doc("nft_nft_address") }}' + - name: PROJECT_NAME + description: '{{ doc("evm_column_deprecation_notice_project_name") }}' + - name: NAME + description: '{{ doc("nft_project_name") }}' + - name: ERC1155_VALUE + description: '{{ doc("evm_column_deprecation_notice_erc1155_value") }}' + - name: QUANTITY + description: '{{ doc("nft_erc1155_value") }}' + - name: NFT_FROM_ADDRESS + description: '{{ doc("evm_column_deprecation_notice_nft_from_address") }}' + - name: NFT_TO_ADDRESS + description: '{{ doc("evm_column_deprecation_notice_nft_to_address") }}' + - name: FROM_ADDRESS + description: '{{ doc("nft_from_address") }}' + - name: TO_ADDRESS + description: '{{ doc("nft_to_address") }}' + - name: TOKENID + description: '{{ doc("evm_column_deprecation_notice_tokenid") }}' + - name: TOKEN_ID + description: '{{ doc("nft_tokenid") }}' + - name: TOKEN_STANDARD + description: '{{ doc("evm_nft_token_standard") }}' - name: EZ_NFT_MINTS_ID - description: '{{ doc("pk") }}' + description: '{{ doc("pk") }}' - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' + description: '{{ doc("inserted_timestamp") }}' - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' \ No newline at end of file + description: '{{ doc("modified_timestamp") }}' diff --git a/models/gold/NFT/nft__ez_nft_sales.sql b/models/gold/NFT/nft__ez_nft_sales.sql index 7e7de3a..e20fc19 100644 --- a/models/gold/NFT/nft__ez_nft_sales.sql +++ b/models/gold/NFT/nft__ez_nft_sales.sql @@ -2,7 +2,10 @@ materialized = 'view', persist_docs ={ "relation": true, "columns": true }, - meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'NFT' } } } + meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'NFT' + } + } + } ) }} SELECT @@ -16,11 +19,15 @@ SELECT platform_exchange_version, aggregator_name, seller_address, - buyer_address, - nft_address, - project_name, - erc1155_value, - tokenId, + buyer_address, + nft_address as contract_address, -- new + project_name as name, -- new + tokenid as token_id, --new + COALESCE(erc1155_value, '1') :: STRING AS quantity, --new + CASE + WHEN erc1155_value IS NULL THEN 'erc721' + ELSE 'erc1155' + END AS token_standard, --new currency_symbol, currency_address, price, @@ -31,7 +38,7 @@ SELECT total_fees_usd, platform_fee_usd, creator_fee_usd, - tx_fee, + tx_fee, tx_fee_usd, origin_from_address, origin_to_address, @@ -49,6 +56,9 @@ SELECT COALESCE( modified_timestamp, '2000-01-01' - ) AS modified_timestamp -FROM - {{ ref('silver__complete_nft_sales') }} + ) AS modified_timestamp, + tokenId, -- deprecate + erc1155_value, -- deprecate + project_name, -- deprecate + nft_address -- deprecate +FROM {{ ref('silver__complete_nft_sales') }} \ No newline at end of file diff --git a/models/gold/NFT/nft__ez_nft_sales.yml b/models/gold/NFT/nft__ez_nft_sales.yml index aa5d7f1..bdd0e44 100644 --- a/models/gold/NFT/nft__ez_nft_sales.yml +++ b/models/gold/NFT/nft__ez_nft_sales.yml @@ -1,17 +1,17 @@ version: 2 models: - name: nft__ez_nft_sales - description: This table contains NFT sales from Opensea Seaport 1.1, 1.4, 1.5, and 1.6, TofuNFT, Mooar and Element on Polygon. + description: '{{ doc("evm_ez_nft_sales_table_doc") }}' columns: - name: BLOCK_NUMBER - description: '{{ doc("nft_block_no") }}' + description: '{{ doc("nft_block_no") }}' - name: BLOCK_TIMESTAMP description: '{{ doc("nft_blocktime") }}' - name: TX_HASH description: '{{ doc("nft_tx_hash") }}' - name: EVENT_INDEX - description: '{{ doc("nft_event_index") }}' + description: '{{ doc("nft_event_index") }}' - name: EVENT_TYPE description: '{{ doc("nft_event_type") }}' - name: PLATFORM_ADDRESS @@ -27,13 +27,23 @@ models: - name: BUYER_ADDRESS description: '{{ doc("nft_buyer_address") }}' - name: NFT_ADDRESS + description: '{{ doc("evm_column_deprecation_notice_nft_address") }}' + - name: CONTRACT_ADDRESS description: '{{ doc("nft_nft_address") }}' - name: PROJECT_NAME - description: '{{ doc("nft_project_name") }}' - - name: ERC1155_VALUE - description: '{{ doc("nft_erc1155_value") }}' + description: '{{ doc("evm_column_deprecation_notice_project_name") }}' + - name: NAME + description: '{{ doc("evm_nft_project_name") }}' - name: TOKENID + description: '{{ doc("evm_column_deprecation_notice_tokenid") }}' + - name: TOKEN_ID description: '{{ doc("nft_tokenid") }}' + - name: ERC1155_VALUE + description: '{{ doc("evm_column_deprecation_notice_erc1155_value") }}' + - name: QUANTITY + description: '{{ doc("evm_nft_quantity") }}' + - name: TOKEN_STANDARD + description: '{{ doc("evm_nft_token_standard") }}' - name: CURRENCY_SYMBOL description: '{{ doc("nft_currency_symbol") }}' - name: CURRENCY_ADDRESS @@ -54,10 +64,6 @@ models: description: '{{ doc("nft_platform_fee_usd") }}' - name: CREATOR_FEE_USD description: '{{ doc("nft_creator_fee_usd") }}' - - name: TX_FEE - description: '{{ doc("nft_tx_fee") }}' - - name: TX_FEE_USD - description: '{{ doc("nft_tx_fee_usd") }}' - name: ORIGIN_FROM_ADDRESS description: '{{ doc("nft_origin_from") }}' - name: ORIGIN_TO_ADDRESS @@ -65,8 +71,8 @@ models: - name: ORIGIN_FUNCTION_SIGNATURE description: '{{ doc("nft_origin_sig") }}' - name: EZ_NFT_SALES_ID - description: '{{ doc("pk") }}' + description: '{{ doc("evm_pk") }}' - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' + description: '{{ doc("evm_inserted_timestamp") }}' - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' \ No newline at end of file + description: '{{ doc("evm_modified_timestamp") }}' diff --git a/models/gold/NFT/nft__ez_nft_transfers.sql b/models/gold/NFT/nft__ez_nft_transfers.sql index 6aa5c0f..fdf2de8 100644 --- a/models/gold/NFT/nft__ez_nft_transfers.sql +++ b/models/gold/NFT/nft__ez_nft_transfers.sql @@ -2,22 +2,38 @@ materialized = 'view', persist_docs ={ "relation": true, "columns": true }, - meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'NFT' } } } + meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'NFT' + } + } + } ) }} SELECT block_timestamp, block_number, tx_hash, + {#tx_position, -- new #} event_index, intra_event_index, - event_type, - contract_address AS nft_address, - project_name, - from_address AS nft_from_address, - to_address AS nft_to_address, - tokenId, - erc1155_value, + token_transfer_type, + iff(from_address = '0x0000000000000000000000000000000000000000', TRUE, FALSE) AS is_mint, -- new + from_address, --new + to_address, --new + contract_address, --new + tokenId as token_id, --new + COALESCE( + erc1155_value, + '1' + ) :: STRING AS quantity, --new + CASE + WHEN token_transfer_type = 'erc721_Transfer' THEN 'erc721' + WHEN token_transfer_type = 'erc1155_TransferSingle' THEN 'erc1155' + WHEN token_transfer_type = 'erc1155_TransferBatch' THEN 'erc1155' + END AS token_standard, --new + project_name as name, --new + {#origin_function_signature, --new + origin_from_address, --new + origin_to_address, #} -- new COALESCE ( nft_transfers_id, {{ dbt_utils.generate_surrogate_key( @@ -31,9 +47,13 @@ SELECT COALESCE( modified_timestamp, '2000-01-01' - ) AS modified_timestamp + ) AS modified_timestamp, + event_type, -- deprecate + from_address AS nft_from_address, -- deprecate + to_address AS nft_to_address, -- deprecate + contract_address AS nft_address, --deprecate + tokenId, -- deprecate + erc1155_value, --deprecate + project_name --deprecate FROM - {{ ref('silver__nft_transfers') }} - - - \ No newline at end of file + {{ ref('silver__nft_transfers') }} \ No newline at end of file diff --git a/models/gold/NFT/nft__ez_nft_transfers.yml b/models/gold/NFT/nft__ez_nft_transfers.yml index 5b6ad80..6cb7849 100644 --- a/models/gold/NFT/nft__ez_nft_transfers.yml +++ b/models/gold/NFT/nft__ez_nft_transfers.yml @@ -1,36 +1,50 @@ version: 2 models: - name: nft__ez_nft_transfers - description: 'This table contains all ERC721 transfer and ERC1155 transfer single events.' - + description: '{{ doc("evm_ez_nft_transfer_table_doc") }}' + columns: - name: BLOCK_NUMBER - description: 'The block number of the NFT transfer.' + description: '{{ doc("nft_block_no") }}' - name: BLOCK_TIMESTAMP - description: 'The block timestamp of the NFT transfer.' + description: '{{ doc("nft_blocktime") }}' - name: TX_HASH - description: 'The transaction hash of the NFT transfer. Please note this is not unique, as it is possible to have multiple NFT transfers in a single transaction.' + description: '{{ doc("nft_tx_hash") }}' + - name: EVENT_INDEX + description: '{{ doc("nft_event_index") }}' - name: INTRA_EVENT_INDEX description: '{{ doc("nft_intra_event_index") }}' - name: EVENT_TYPE - description: 'The type of NFT transfer. This can be either "mint" or "other".' + description: '{{ doc("evm_column_deprecation_notice_event_type") }}' - name: NFT_ADDRESS - description: 'The address of the NFT contract.' + description: '{{ doc("evm_column_deprecation_notice_nft_address") }}' + - name: CONTRACT_ADDRESS + description: '{{ doc("nft_nft_address") }}' + - name: NAME + description: '{{ doc("evm_nft_project_name") }}' - name: PROJECT_NAME - description: 'The name of the project, read from the NFT contract.' - - name: ERC1155_VALUE - description: 'The value of the ERC1155 transfer. This is only populated for ERC1155 transfers.' + description: '{{ doc("evm_column_deprecation_notice_project_name") }}' - name: NFT_FROM_ADDRESS - description: 'The address of the sender of the NFT transfer.' + description: '{{ doc("evm_column_deprecation_notice_nft_from_address") }}' + - name: FROM_ADDRESS + description: '{{ doc("nft_nft_from_address") }}' - name: NFT_TO_ADDRESS - description: 'The address of the recipient of the NFT transfer.' + description: '{{ doc("evm_column_deprecation_notice_nft_to_address") }}' + - name: TO_ADDRESS + description: '{{ doc("nft_nft_to_address") }}' - name: TOKENID - description: 'The token ID of the NFT transfer.' - - name: EVENT_INDEX - description: 'The index of the NFT transfer within the transaction. This is used to ensure that multiple NFT transfers in a single transaction are not duplicated.' + description: '{{ doc("evm_column_deprecation_notice_tokenid") }}' + - name: TOKEN_ID + description: '{{ doc("nft_tokenid") }}' + - name: ERC1155_VALUE + description: '{{ doc("evm_column_deprecation_notice_erc1155_value") }}' + - name: QUANTITY + description: '{{ doc("evm_nft_quantity") }}' + - name: TOKEN_STANDARD + description: '{{ doc("evm_nft_token_standard") }}' - name: EZ_NFT_TRANSFERS_ID - description: '{{ doc("pk") }}' + description: '{{ doc("pk") }}' - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' + description: '{{ doc("inserted_timestamp") }}' - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' \ No newline at end of file + description: '{{ doc("modified_timestamp") }}'