From 859235041501db22a4cca8e2171c6156daf185df Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Mon, 2 Dec 2024 23:28:23 +0800 Subject: [PATCH 01/45] Init flare chain --- .../chain_info/chain_info_chain_ids.sql | 6 +- .../daily_spellbook/models/evms/evms_info.sql | 3 +- .../tokens/models/prices/flare/_schema.yml | 29 +++ .../prices/flare/prices_flare_tokens.sql | 22 ++ .../models/prices/prices_native_tokens.sql | 1 + .../tokens/models/prices/prices_tokens.sql | 2 + .../models/prices/prices_trusted_tokens.sql | 1 + .../tokens/models/tokens/_schema.yml | 4 +- .../tokens/flare/tokens_flare_erc20.sql | 30 +++ sources/_base_sources/evm/flare_docs_block.md | 75 +++++++ .../flare/flare_base_sources.yml | 195 ++++++++++++++++++ 11 files changed, 362 insertions(+), 6 deletions(-) create mode 100644 dbt_subprojects/tokens/models/prices/flare/_schema.yml create mode 100644 dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql create mode 100644 dbt_subprojects/tokens/models/tokens/flare/tokens_flare_erc20.sql create mode 100644 sources/_base_sources/evm/flare_docs_block.md create mode 100644 sources/_base_sources/flare/flare_base_sources.yml diff --git a/dbt_subprojects/daily_spellbook/models/chain_info/chain_info_chain_ids.sql b/dbt_subprojects/daily_spellbook/models/chain_info/chain_info_chain_ids.sql index 83a864dd8dd..a0df844e8e3 100644 --- a/dbt_subprojects/daily_spellbook/models/chain_info/chain_info_chain_ids.sql +++ b/dbt_subprojects/daily_spellbook/models/chain_info/chain_info_chain_ids.sql @@ -31,12 +31,12 @@ FROM ( values ,('Metadium Mainnet' ,'META' ,'META' ,'11' ,'11' ,'https://metadium.com' ,'') ,('Metadium Testnet' ,'META' ,'KAL' ,'12' ,'12' ,'https://metadium.com' ,'') ,('Diode Testnet Staging' ,'DIODE' ,'sDIODE' ,'13' ,'13' ,'https://diode.io/staging' ,'') -,('Flare Mainnet' ,'FLR' ,'FLR' ,'14' ,'14' ,'https://flare.xyz' ,'https://flare-explorer.flare.network') +,('Flare Mainnet', 'FLR', 'FLR', '14', '14', 'https://flare.network', 'https://flare-explorer.flare.network') ,('Diode Prenet' ,'DIODE' ,'DIODE' ,'15' ,'15' ,'https://diode.io/prenet' ,'') -,('Flare Testnet Coston' ,'FLR' ,'CFLR' ,'16' ,'16' ,'https://flare.xyz' ,'https://coston-explorer.flare.network') +,('Flare Testnet Coston', 'CFLR', 'CFLR', '16', '16', 'https://flare.network', 'https://coston-explorer.flare.network') ,('ThaiChain 2.0 ThaiFi' ,'TCH' ,'TFI' ,'17' ,'17' ,'https://exp.thaifi.com' ,'') ,('ThunderCore Testnet' ,'TST' ,'TST' ,'18' ,'18' ,'https://thundercore.com' ,'https://explorer-testnet.thundercore.com') -,('Songbird Canary-Network' ,'SGB' ,'SGB' ,'19' ,'19' ,'https://flare.xyz' ,'https://songbird-explorer.flare.network') +,('Songbird Canary-Network' ,'SGB' ,'SGB' ,'19' ,'19' ,'https://flare.network' ,'https://songbird-explorer.flare.network') ,('Elastos Smart Chain' ,'ETH' ,'ELA' ,'20' ,'20' ,'https://www.elastos.org/' ,'https://esc.elastos.io') ,('Elastos Smart Chain Testnet' ,'ETH' ,'tELA' ,'21' ,'21' ,'https://www.elastos.org/' ,'https://esc-testnet.elastos.io') ,('ELA-DID-Sidechain Mainnet' ,'ETH' ,'ELA' ,'22' ,'22' ,'https://www.elastos.org/' ,'') diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql index dcb86d95584..d64499f62be 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql @@ -11,6 +11,7 @@ , "celo" , "ethereum" , "fantom" + , "flare" , "gnosis" , "kaia" , "linea" @@ -90,5 +91,5 @@ FROM ( , (5000, 'mantle', 'Mantle', 'Layer 2', 'Optimistic Rollup', 'MNT', 0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8, 'https://mantlescan.xyz/', timestamp '2023-07-02 18:21', 'Optimistic Virtual Machine', 'Ethereum', 'Ethereum', true) , (42170, 'nova', 'Arbitrum Nova', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x722e8bdd2ce80a4422e880164f2079488e115365, 'https://nova-explorer.arbitrum.io/', timestamp '2022-06-25 04:01', 'Arbitrum', 'Ethereum', 'Ethereum', true) , (2020, 'ronin', 'Ronin', 'Layer 1', null, 'RON', 0xe514d9deb7966c8be0ca922de8a064264ea6bcd4, 'https://app.roninchain.com/', timestamp '2021-01-25 10:49', NULL, NULL, NULL, true) + , (14, 'flare', 'Flare', 'Layer 1', NULL, 'FLR', NULL, 'https://flare-explorer.flare.network/', timestamp '2022-07-13 15:32', NULL, NULL, NULL, true) ) AS temp_table (chain_id, blockchain, name, chain_type, rollup_type, native_token_symbol, wrapped_native_token_address, explorer_link, first_block_time, codebase, data_availability, settlement, is_on_dune) - diff --git a/dbt_subprojects/tokens/models/prices/flare/_schema.yml b/dbt_subprojects/tokens/models/prices/flare/_schema.yml new file mode 100644 index 00000000000..67bac2872f6 --- /dev/null +++ b/dbt_subprojects/tokens/models/prices/flare/_schema.yml @@ -0,0 +1,29 @@ +version: 2 + +models: + - name: prices_flare_tokens + meta: + blockchain: flare + sector: prices + contributors: hosuke + config: + tags: ['prices', 'tokens', 'usd', 'flare'] + description: "Price tokens on Flare Network EVM chain" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - contract_address + columns: + - name: token_id + description: "Id of the token at coinpaprika. This id is required to pull the price feed data. NOTE: Not all tokens are listed at coinpaprika - consider using price data from DEX sources in this case or submit a listing request at coinpaprika." + - name: blockchain + description: "Native blockchain of the token, if any" + data_tests: + - accepted_values: + values: [ "flare" ] + - name: contract_address + description: "Contract address of the token, if any" + - name: symbol + description: "Token symbol" + - name: decimals + description: "Number of decimals for the token contract" diff --git a/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql b/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql new file mode 100644 index 00000000000..40ff58dc861 --- /dev/null +++ b/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql @@ -0,0 +1,22 @@ +{% set blockchain = 'flare' %} + +{{ config( + schema = 'prices_' + blockchain, + alias = 'tokens', + tags = ['static'] + ) +}} + +SELECT + token_id + , '{{ blockchain }}' as blockchain + , symbol + , contract_address + , decimals +FROM +( + VALUES + ('flare-flare', 'WFLR', 0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d, 18) + -- Note: Currently only WFLR has a reliable price feed. Other tokens will be added + -- when they have established price feeds on major price aggregators. +) as temp (token_id, symbol, contract_address, decimals) diff --git a/dbt_subprojects/tokens/models/prices/prices_native_tokens.sql b/dbt_subprojects/tokens/models/prices/prices_native_tokens.sql index f86c6a37a71..e574b71d6ec 100644 --- a/dbt_subprojects/tokens/models/prices/prices_native_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/prices_native_tokens.sql @@ -34,6 +34,7 @@ FROM ('eos-eos', null, 'EOS', null, null), ('etc-ethereum-classic', null, 'ETC', null, null), ('eth-ethereum', null, 'ETH', null, null), + ('flare-flare', null, 'FLR', null, null), ('ftm-fantom', null, 'FTM', null, null), ('hbar-hedera-hashgraph', null, 'HBAR', null, null), ('icp-internet-computer', null, 'ICP', null, null), diff --git a/dbt_subprojects/tokens/models/prices/prices_tokens.sql b/dbt_subprojects/tokens/models/prices/prices_tokens.sql index 665f2adde64..a0207259bc9 100644 --- a/dbt_subprojects/tokens/models/prices/prices_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/prices_tokens.sql @@ -15,6 +15,7 @@ , "celo" , "ethereum" , "fantom" + , "flare" , "gnosis" , "kaia" , "linea" @@ -45,6 +46,7 @@ ref('prices_native_tokens') ,ref('prices_cardano_tokens') ,ref('prices_ethereum_tokens') ,ref('prices_fantom_tokens') +,ref('prices_flare_tokens') ,ref('prices_gnosis_tokens') ,ref('prices_optimism_tokens') ,ref('prices_polygon_tokens') diff --git a/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql b/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql index 37ad50a9faa..9d3f563d4cc 100644 --- a/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql @@ -61,6 +61,7 @@ WITH trusted_tokens AS ( , ('ethereum', 0x2260fac5e5542a773aa44fbcfedf7c193bc2c599) , ('ethereum', 0xf939e0a03fb07f59a73314e73794be0e57ac1b4e) , ('fantom', 0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83) + , ('flare', 0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d) , ('fantom', 0x04068da6c83afcfa0e13ba15a6696662335d5b75) , ('fantom', 0x74b23882a30290451a17c44f4f05243b6b58c76d) , ('fantom', 0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e) diff --git a/dbt_subprojects/tokens/models/tokens/_schema.yml b/dbt_subprojects/tokens/models/tokens/_schema.yml index 5b5784747a1..5dc7217068e 100644 --- a/dbt_subprojects/tokens/models/tokens/_schema.yml +++ b/dbt_subprojects/tokens/models/tokens/_schema.yml @@ -3,11 +3,11 @@ version: 2 models: - name: tokens_erc20 meta: - blockchain: arbitrum, avalanche_c, bnb, ethereum, gnosis, mantle, optimism, fantom, polygon, base, blast, sepolia, sei, nova, worldchain, kaia, ronin + blockchain: arbitrum, avalanche_c, bnb, ethereum, gnosis, mantle, optimism, fantom, polygon, base, blast, sepolia, sei, nova, worldchain, kaia, ronin, boba, flare sector: tokens contributors: hildobby, 0xManny, dot2dotseurat, soispoke, mtitus6, wuligy, angus_1, Henrystats, viniabussafi, jeff-dude, rantum, hosuke config: - tags: ['tokens','erc20', 'arbitrum', 'avalanche_c', 'bnb', 'ethereum', 'gnosis', 'mantle', 'optimism', 'fantom', 'base', 'blast', 'sei', 'nova', 'linea', 'worldchain', 'kaia', 'ronin'] + tags: ['tokens','erc20', 'arbitrum', 'avalanche_c', 'bnb', 'ethereum', 'gnosis', 'mantle', 'optimism', 'fantom', 'base', 'blast', 'sei', 'nova', 'linea', 'worldchain', 'kaia', 'ronin', 'boba', 'flare'] description: > Crosschain ERC20 tokens data_tests: diff --git a/dbt_subprojects/tokens/models/tokens/flare/tokens_flare_erc20.sql b/dbt_subprojects/tokens/models/tokens/flare/tokens_flare_erc20.sql new file mode 100644 index 00000000000..05149e7d093 --- /dev/null +++ b/dbt_subprojects/tokens/models/tokens/flare/tokens_flare_erc20.sql @@ -0,0 +1,30 @@ +{{ + config( + schema = 'tokens_flare', + alias = 'erc20', + post_hook = '{{ expose_spells(\'["flare"]\', + "sector", + "tokens", + \'["hosuke"]\') }}' + ) +}} + +SELECT DISTINCT + 'flare' as blockchain, + contract_address, + symbol, + decimals, + token_name as name +FROM ( + VALUES + -- Base tokens + (0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d, 'Wrapped Flare', 'WFLR', 18), + -- Other tokens + (0x282b88514A52FcAdCD92b742745398f3574697d4, 'Finu', 'FINU', 18), + (0x64cB9bE6323c7a2cE39773674F380da30663bae4, 'ScottyCash', 'SCOTTY', 18), + (0xDE373AE127A11E756A9D1cc7743816928B239283, 'DAX.BEST', 'DAX', 18), + (0x932E691aA8c8306C4bB0b19F3f00a284371be8Ba, 'Phili Inu', 'PHIL', 18), + (0x22757fb83836e3F9F0F353126cACD3B1Dc82a387, 'FlareFox', 'FLX', 18), + (0xa80C114A90565C03BDCAbC1fcF913cC225d2c5ab, 'F-Asset Token', 'FASSET', 18), + (0xc6B19B06A92B337Cbca5f7334d29d45ec4d5E532, 'Dog on Moon', 'Moon', 18) +) as temp (contract_address, token_name, symbol, decimals) diff --git a/sources/_base_sources/evm/flare_docs_block.md b/sources/_base_sources/evm/flare_docs_block.md new file mode 100644 index 00000000000..38398dd0ea2 --- /dev/null +++ b/sources/_base_sources/evm/flare_docs_block.md @@ -0,0 +1,75 @@ +{% docs flare_transactions_doc %} + +The `flare.transactions` table contains detailed information about transactions on the flare blockchain. It includes: + +- Block information: number, timestamp, hash +- Transaction details: hash, from_address, to_address, value +- Gas data: gas_price, gas_limit, gas_used +- Status: success or failure +- Input data for contract interactions +- Nonce +- Transaction type + +This table is used for analyzing transaction patterns, gas usage, value transfers, and overall network activity on flare. + +{% enddocs %} + +{% docs flare_traces_doc %} + +The `flare.traces` table contains records of execution steps for transactions on the flare blockchain. Each trace represents an atomic operation that modifies the state of the Ethereum Virtual Machine (EVM). Key components include: + +- Transaction hash +- Block number and timestamp +- From and to addresses +- Value transferred +- Input data +- Call type (e.g., CALL, DELEGATECALL, CREATE) +- Gas information +- Error messages (if any) + +This table is essential for: +- Analyzing internal transactions +- Debugging smart contract interactions +- Tracking value flows through complex transactions +- Understanding contract creation and deployment + +{% enddocs %} + +{% docs flare_logs_doc %} + +The `flare.logs` table contains information about event logs emitted by smart contracts on the flare blockchain. It includes: + +- Block information: number, timestamp +- Transaction hash +- Contract address (emitting the event) +- Topic0 (event signature) +- Additional topics (indexed parameters) +- Data field (non-indexed parameters) +- Log index + +This table is crucial for: +- Tracking on-chain events +- Monitoring contract activity +- Analyzing token transfers +- Following protocol-specific events + +{% enddocs %} + +{% docs flare_contracts_doc %} + +The `flare.contracts` table tracks decoded contracts on flare, including: + +- Contract address +- Bytecode +- Contract name +- Namespace +- ABI +- Creation details + +This table is used for: +- Contract verification +- Smart contract analysis +- Protocol research +- Development and debugging + +{% enddocs %} diff --git a/sources/_base_sources/flare/flare_base_sources.yml b/sources/_base_sources/flare/flare_base_sources.yml new file mode 100644 index 00000000000..3ef75b83450 --- /dev/null +++ b/sources/_base_sources/flare/flare_base_sources.yml @@ -0,0 +1,195 @@ +version: 2 + +sources: + # flare Tables + - name: flare + description: "raw tables for the chain" + + tables: + - name: transactions + meta: + docs_slug: /evm/flare/raw/transactions + short_description: The transactions table contains detailed information about transactions on the network. + description: '{{ doc("flare_transactions_doc") }}' + + columns: + - &block_date + name: block_date + description: "The UTC date of the block in which this transaction was included" + - &block_time + name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - &block_number + name: block_number + description: "The number of the block containing this transaction" + - &block_hash + name: block_hash + description: "The hash of the block containing this transaction" + - name: index + description: "The index position of the transaction within its block" + - name: hash + description: "The transaction hash" + - name: from + description: "The sending address" + - name: to + description: "The receiving address" + - name: value + description: "The value transferred in wei" + - name: gas_limit + description: "The maximum amount of gas units that can be consumed by the transaction" + - name: gas_price + description: "The price per unit of gas in wei" + - name: gas_used + description: "The actual amount of gas used for the transaction" + - name: nonce + description: "The number of transactions sent from this address before this one" + - name: success + description: "Whether the transaction was successful (1) or failed (0)" + + - name: traces + meta: + docs_slug: /evm/flare/raw/traces + short_description: The traces table contains information about traces on the network. + description: '{{ doc("flare_traces_doc") }}' + + columns: + - *block_number + - *block_time + - name: tx_hash + description: "The hash of the transaction this trace belongs to" + - name: from + description: "Address where the trace call originated from" + - name: to + description: "Address where the trace call was made to" + - name: value + description: "Value transferred in the trace in wei" + - name: gas + description: "Gas provided for the trace call" + - name: input + description: "The data sent along with the trace call" + - name: output + description: "The data returned from the trace call" + - name: type + description: "The type of trace (call, create, suicide, reward)" + - name: error + description: "Error message if the trace failed" + + - name: logs + meta: + docs_slug: /evm/flare/raw/logs + short_description: The `flare.logs` table contains information about event logs emitted by smart contracts on the flare blockchain. + description: '{{ doc("flare_logs_doc") }}' + + columns: + - *block_number + - *block_time + - name: tx_hash + description: "The hash of the transaction that emitted this log" + - name: contract_address + description: "The address of the contract that emitted this log" + - name: topic0 + description: "The first topic (typically the event signature)" + - name: topic1 + description: "The second topic (if any)" + - name: topic2 + description: "The third topic (if any)" + - name: topic3 + description: "The fourth topic (if any)" + - name: data + description: "The data field of the log" + - name: index + description: "The index of the log within its transaction" + + - name: contracts + meta: + docs_slug: /evm/flare/raw/contracts + short_description: The `flare.contracts` table tracks decoded contracts on flare, including associated metadata such as namespace, name, address, ABI. + description: '{{ doc("flare_contracts_doc") }}' + + columns: + - name: address + description: "The contract address" + - name: bytecode + description: "The contract bytecode" + - name: name + description: "The name of the contract" + - name: namespace + description: "The namespace the contract belongs to" + - name: abi + description: "The contract ABI" + - *block_number + - *block_hash + - *tx_count + - *difficulty + - *gas_limit + - *gas_used + - *miner + - *nonce + - *parent_hash + - *size + - *total_difficulty + - *extra_data + + - name: transactions + loaded_at_field: block_time + description: "Transactions on the Flare Network" + columns: + - *blockchain + - *block_time + - *block_number + - *tx_hash + - *tx_index + - *tx_from + - *tx_to + - *tx_success + - *tx_gas_used + - *tx_gas_limit + - *tx_gas_price + - *tx_nonce + - *tx_value + - *tx_input + - *tx_type + - *max_fee_per_gas + - *max_priority_fee_per_gas + - *priority_fee_per_gas + + - name: traces + loaded_at_field: block_time + description: "Traces of transactions on the Flare Network" + columns: + - *blockchain + - *block_time + - *block_number + - *tx_hash + - *tx_index + - *tx_from + - *tx_to + - *tx_success + - *tx_gas_used + - *tx_gas_limit + - *tx_value + - *tx_input + - *trace_index + - *trace_address + - *trace_type + - *trace_status + - *trace_error + - *trace_output + - *sub_traces + + - name: logs + loaded_at_field: block_time + description: "Logs of transactions on the Flare Network" + columns: + - *blockchain + - *block_time + - *block_number + - *tx_hash + - *tx_index + - *log_index + - *contract_address + - *topic0 + - *topic1 + - *topic2 + - *topic3 + - *data From 7ab788373f68cefef9952bcfcbe680ec09f71891 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Mon, 2 Dec 2024 23:32:50 +0800 Subject: [PATCH 02/45] fix price --- .../tokens/models/prices/flare/prices_flare_tokens.sql | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql b/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql index 40ff58dc861..ffeef16f22c 100644 --- a/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql @@ -16,7 +16,5 @@ SELECT FROM ( VALUES - ('flare-flare', 'WFLR', 0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d, 18) - -- Note: Currently only WFLR has a reliable price feed. Other tokens will be added - -- when they have established price feeds on major price aggregators. + ('flr-flare-network', 'WFLR', 0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d, 18) ) as temp (token_id, symbol, contract_address, decimals) From 5307ccdedf3eb66555ca017122d13779e9288e5e Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Mon, 2 Dec 2024 23:39:02 +0800 Subject: [PATCH 03/45] Fix source --- .../{flare => evm}/flare_base_sources.yml | 78 +------------------ 1 file changed, 1 insertion(+), 77 deletions(-) rename sources/_base_sources/{flare => evm}/flare_base_sources.yml (71%) diff --git a/sources/_base_sources/flare/flare_base_sources.yml b/sources/_base_sources/evm/flare_base_sources.yml similarity index 71% rename from sources/_base_sources/flare/flare_base_sources.yml rename to sources/_base_sources/evm/flare_base_sources.yml index 3ef75b83450..03831776c13 100644 --- a/sources/_base_sources/flare/flare_base_sources.yml +++ b/sources/_base_sources/evm/flare_base_sources.yml @@ -116,80 +116,4 @@ sources: - name: namespace description: "The namespace the contract belongs to" - name: abi - description: "The contract ABI" - - *block_number - - *block_hash - - *tx_count - - *difficulty - - *gas_limit - - *gas_used - - *miner - - *nonce - - *parent_hash - - *size - - *total_difficulty - - *extra_data - - - name: transactions - loaded_at_field: block_time - description: "Transactions on the Flare Network" - columns: - - *blockchain - - *block_time - - *block_number - - *tx_hash - - *tx_index - - *tx_from - - *tx_to - - *tx_success - - *tx_gas_used - - *tx_gas_limit - - *tx_gas_price - - *tx_nonce - - *tx_value - - *tx_input - - *tx_type - - *max_fee_per_gas - - *max_priority_fee_per_gas - - *priority_fee_per_gas - - - name: traces - loaded_at_field: block_time - description: "Traces of transactions on the Flare Network" - columns: - - *blockchain - - *block_time - - *block_number - - *tx_hash - - *tx_index - - *tx_from - - *tx_to - - *tx_success - - *tx_gas_used - - *tx_gas_limit - - *tx_value - - *tx_input - - *trace_index - - *trace_address - - *trace_type - - *trace_status - - *trace_error - - *trace_output - - *sub_traces - - - name: logs - loaded_at_field: block_time - description: "Logs of transactions on the Flare Network" - columns: - - *blockchain - - *block_time - - *block_number - - *tx_hash - - *tx_index - - *log_index - - *contract_address - - *topic0 - - *topic1 - - *topic2 - - *topic3 - - *data + description: "The contract ABI" \ No newline at end of file From 1ed570254624057b6f79c9ebcfe1765f9fd252ed Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Mon, 2 Dec 2024 23:42:21 +0800 Subject: [PATCH 04/45] Add tokens.erc20 --- .../tokens/models/tokens/flare/_schema.yml | 21 +++++++++++++++++++ .../tokens/models/tokens/tokens_erc20.sql | 1 + 2 files changed, 22 insertions(+) create mode 100644 dbt_subprojects/tokens/models/tokens/flare/_schema.yml diff --git a/dbt_subprojects/tokens/models/tokens/flare/_schema.yml b/dbt_subprojects/tokens/models/tokens/flare/_schema.yml new file mode 100644 index 00000000000..afe1b985700 --- /dev/null +++ b/dbt_subprojects/tokens/models/tokens/flare/_schema.yml @@ -0,0 +1,21 @@ +version: 2 + +models: + - name: tokens_flare_erc20 + meta: + blockchain: flare + sector: tokens + project: erc20 + contributors: hosuke + config: + tags: ['table', 'erc20', 'flare'] + description: "ERC20 Token Addresses, Symbols and Decimals on flare Network" + columns: + - name: contract_address + description: "ERC20 token contract address" + data_tests: + - unique + - name: symbol + description: "ERC20 token symbol" + - name: decimals + description: "Number of decimals, refers to how divisible an ERC20 token can be" diff --git a/dbt_subprojects/tokens/models/tokens/tokens_erc20.sql b/dbt_subprojects/tokens/models/tokens/tokens_erc20.sql index c50255ecaf7..87471eae872 100644 --- a/dbt_subprojects/tokens/models/tokens/tokens_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/tokens_erc20.sql @@ -71,6 +71,7 @@ ,'tokens_tron': {'blockchain': 'tron', 'model': ref('tokens_tron_erc20')} ,'tokens_ronin': {'blockchain': 'ronin', 'model': ref('tokens_ronin_erc20')} ,'tokens_bob': {'blockchain': 'bob', 'model': ref('tokens_bob_erc20')} + ,'tokens_flare': {'blockchain': 'flare', 'model': ref('tokens_flare_erc20')} } %} with automated_source as ( From 124ad53f5defb3912a735896271e3ef692d53174 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Wed, 4 Dec 2024 18:04:53 +0800 Subject: [PATCH 05/45] Update flare tokens --- .../tokens/flare/tokens_flare_erc20.sql | 56 ++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/dbt_subprojects/tokens/models/tokens/flare/tokens_flare_erc20.sql b/dbt_subprojects/tokens/models/tokens/flare/tokens_flare_erc20.sql index 05149e7d093..8b302f932a0 100644 --- a/dbt_subprojects/tokens/models/tokens/flare/tokens_flare_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/flare/tokens_flare_erc20.sql @@ -1,30 +1,36 @@ {{ config( - schema = 'tokens_flare', - alias = 'erc20', - post_hook = '{{ expose_spells(\'["flare"]\', - "sector", - "tokens", - \'["hosuke"]\') }}' + schema = 'tokens_flare' + , alias = 'erc20' + , tags = ['static'] + , materialized = 'table' + , post_hook='{{ expose_spells(\'["flare"]\', + "sector", + "tokens", + \'["hosuke"]\') }}' ) }} -SELECT DISTINCT - 'flare' as blockchain, - contract_address, - symbol, - decimals, - token_name as name -FROM ( - VALUES - -- Base tokens - (0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d, 'Wrapped Flare', 'WFLR', 18), - -- Other tokens - (0x282b88514A52FcAdCD92b742745398f3574697d4, 'Finu', 'FINU', 18), - (0x64cB9bE6323c7a2cE39773674F380da30663bae4, 'ScottyCash', 'SCOTTY', 18), - (0xDE373AE127A11E756A9D1cc7743816928B239283, 'DAX.BEST', 'DAX', 18), - (0x932E691aA8c8306C4bB0b19F3f00a284371be8Ba, 'Phili Inu', 'PHIL', 18), - (0x22757fb83836e3F9F0F353126cACD3B1Dc82a387, 'FlareFox', 'FLX', 18), - (0xa80C114A90565C03BDCAbC1fcF913cC225d2c5ab, 'F-Asset Token', 'FASSET', 18), - (0xc6B19B06A92B337Cbca5f7334d29d45ec4d5E532, 'Dog on Moon', 'Moon', 18) -) as temp (contract_address, token_name, symbol, decimals) +SELECT + contract_address + , symbol + , decimals +FROM (VALUES + (0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d, 'WFLR', 18) + , (0xE6505f92583103AF7ed9974DEC451A7Af4e3A3bE, 'JOULE', 18) + , (0x12e605bc104e93B45e1aD99F9e555f659051c2BB, 'sFLR', 18) + , (0xfF56Eb5b1a7FAa972291117E5E9565dA29bc808d, 'APS', 18) + , (0x4A771Cc1a39FDd8AA08B8EA51F7Fd412e73B3d2B, 'USDX', 6) + , (0x140D8d3649Ec605CF69018C627fB44cCC76eC89f, 'HLN', 18) + , (0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6, 'USDC.e', 6) + , (0x0B38e83B86d491735fEaa0a791F65c2B99535396, 'USDT', 6) + , (0x22757fb83836e3F9F0F353126cACD3B1Dc82a387, 'FLX', 18) + , (0xC18f99CE6DD6278BE2D3f1e738Ed11623444aE33, 'POODLE', 18) + , (0x96B41289D90444B8adD57e6F265DB5aE8651DF29, 'eUSDT', 6) + , (0x932E691aA8c8306C4bB0b19F3f00a284371be8Ba, 'PHIL', 18) + , (0xB5010D5Eb31AA8776b52C7394B76D6d627501C73, 'PFL', 18) + , (0x908BB3E15040801fd29E542221A31Baaa7A4bE19, 'FODO', 18) + , (0xe2bBf70A52Ee84837E9E2e245E5aFc560E259249, 'ZOINK', 18) + , (0x1aa5282692398c078e71Fb3e4A85660d1BF8F586, 'BUNNY', 18) + , (0xc6B19B06A92B337Cbca5f7334d29d45ec4d5E532, 'Moon', 18) +) as temp (contract_address, symbol, decimals) From e87fa522fd46669e6f20070bd71050c5b2e67bef Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Wed, 4 Dec 2024 18:26:41 +0800 Subject: [PATCH 06/45] Verify source table schema --- .../_base_sources/evm/flare_base_sources.yml | 565 +++++++++++++++--- sources/_base_sources/evm/flare_docs_block.md | 100 +++- 2 files changed, 572 insertions(+), 93 deletions(-) diff --git a/sources/_base_sources/evm/flare_base_sources.yml b/sources/_base_sources/evm/flare_base_sources.yml index 03831776c13..398fe495dff 100644 --- a/sources/_base_sources/evm/flare_base_sources.yml +++ b/sources/_base_sources/evm/flare_base_sources.yml @@ -1,7 +1,7 @@ version: 2 sources: - # flare Tables + # Flare Tables - name: flare description: "raw tables for the chain" @@ -13,107 +13,530 @@ sources: description: '{{ doc("flare_transactions_doc") }}' columns: - - &block_date - name: block_date - description: "The UTC date of the block in which this transaction was included" - - &block_time - name: block_time - description: "The exact UTC timestamp when the block containing this transaction was added to the chain" - - &block_number - name: block_number - description: "The number of the block containing this transaction" - - &block_hash - name: block_hash - description: "The hash of the block containing this transaction" - - name: index - description: "The index position of the transaction within its block" - - name: hash - description: "The transaction hash" - - name: from - description: "The sending address" - - name: to - description: "The receiving address" + - name: block_time + description: "The exact UTC timestamp when this transaction was included" + data_type: timestamp + - name: block_number + description: "The sequential number of the block containing this transaction" + data_type: bigint - name: value - description: "The value transferred in wei" + description: "Amount of native tokens transferred in this transaction" + data_type: uint256 - name: gas_limit - description: "The maximum amount of gas units that can be consumed by the transaction" + description: "Maximum amount of gas that can be used by this transaction" + data_type: bigint - name: gas_price - description: "The price per unit of gas in wei" + description: "Price per unit of gas specified by the sender" + data_type: uint256 - name: gas_used - description: "The actual amount of gas used for the transaction" + description: "Amount of gas used by this transaction" + data_type: bigint + - name: max_fee_per_gas + description: "Maximum total fee per unit of gas (EIP-1559)" + data_type: bigint + - name: max_priority_fee_per_gas + description: "Maximum priority fee per unit of gas (EIP-1559)" + data_type: bigint + - name: priority_fee_per_gas + description: "Actual priority fee per unit of gas (EIP-1559)" + data_type: bigint - name: nonce - description: "The number of transactions sent from this address before this one" + description: "Number of transactions sent by the sender prior to this one" + data_type: bigint + - name: index + description: "Index of this transaction within the block" + data_type: bigint - name: success - description: "Whether the transaction was successful (1) or failed (0)" + description: "Whether the transaction was successful" + data_type: boolean + - name: from + description: "Address that sent the transaction" + data_type: varbinary + - name: to + description: "Address that received the transaction" + data_type: varbinary + - name: block_hash + description: "Hash of the block containing this transaction" + data_type: varbinary + - name: data + description: "Data payload of the transaction" + data_type: varbinary + - name: hash + description: "Unique identifier (hash) of this transaction" + data_type: varbinary + - name: type + description: "Transaction type (0 = legacy, 1 = access list, 2 = EIP-1559)" + data_type: varchar + - name: access_list + description: "List of addresses and storage keys that the transaction plans to access" + data_type: array(row(address varbinary,storageKeys array(varbinary))) + - name: block_date + description: "UTC date of the block containing this transaction" + data_type: date - name: traces meta: docs_slug: /evm/flare/raw/traces - short_description: The traces table contains information about traces on the network. + short_description: The `flare.traces` table contains all transaction traces on the flare blockchain. description: '{{ doc("flare_traces_doc") }}' - columns: - - *block_number - - *block_time + - name: block_time + description: "The exact UTC timestamp when this trace was created" + data_type: timestamp + - name: block_number + description: "The sequential number of the block containing this trace" + data_type: bigint + - name: value + description: "Amount of native tokens transferred in this trace" + data_type: uint256 + - name: gas + description: "Gas limit for this trace" + data_type: bigint + - name: gas_used + description: "Amount of gas used by this trace" + data_type: bigint + - name: block_hash + description: "Hash of the block containing this trace" + data_type: varbinary + - name: success + description: "Whether this trace was successful" + data_type: boolean + - name: tx_index + description: "Index of the transaction within the block" + data_type: integer + - name: tx_from + description: "Address that sent the transaction" + data_type: varbinary + - name: tx_to + description: "Address that received the transaction" + data_type: varbinary + - name: sub_traces + description: "Number of sub-traces" + data_type: bigint + - name: error + description: "Error message if the trace failed" + data_type: varchar + - name: tx_success + description: "Whether the parent transaction was successful" + data_type: boolean - name: tx_hash - description: "The hash of the transaction this trace belongs to" + description: "Hash of the transaction" + data_type: varbinary - name: from - description: "Address where the trace call originated from" + description: "Address initiating this trace" + data_type: varbinary - name: to - description: "Address where the trace call was made to" - - name: value - description: "Value transferred in the trace in wei" - - name: gas - description: "Gas provided for the trace call" + description: "Address receiving this trace" + data_type: varbinary + - name: trace_address + description: "Array indicating the position in the call trace tree" + data_type: array(bigint) + - name: type + description: "Type of the trace (call, create, suicide, reward)" + data_type: varchar + - name: address + description: "Address of the contract if this is a create trace" + data_type: varbinary + - name: code + description: "Contract code for create traces" + data_type: varbinary + - name: call_type + description: "Type of call (call, delegatecall, staticcall)" + data_type: varchar - name: input - description: "The data sent along with the trace call" + description: "Input data for the trace" + data_type: varbinary - name: output - description: "The data returned from the trace call" - - name: type - description: "The type of trace (call, create, suicide, reward)" - - name: error - description: "Error message if the trace failed" + description: "Output data from the trace" + data_type: varbinary + - name: refund_address + description: "Address receiving refund for self-destruct" + data_type: varbinary + - name: revert_reason + description: "Reason for revert if the trace failed" + data_type: varchar + - name: block_date + description: "UTC date of the block containing this trace" + data_type: date + + - name: traces_decoded + meta: + docs_slug: /evm/flare/raw/traces_decoded + short_description: The `flare.traces_decoded` table contains decoded traces from known contracts on the flare blockchain. + description: '{{ doc("flare_traces_decoded_doc") }}' + columns: + - name: block_date + description: "UTC date of the block containing this trace" + data_type: date + - name: block_time + description: "The exact UTC timestamp when this trace was created" + data_type: timestamp + - name: block_number + description: "The sequential number of the block containing this trace" + data_type: bigint + - name: namespace + description: "Project namespace for the contract" + data_type: varchar + - name: contract_name + description: "Name of the contract" + data_type: varchar + - name: to + description: "Address receiving this trace" + data_type: varbinary + - name: trace_address + description: "Array indicating the position in the call trace tree" + data_type: array(bigint) + - name: tx_hash + description: "Hash of the transaction" + data_type: varbinary + - name: tx_from + description: "Address that sent the transaction" + data_type: varbinary + - name: tx_to + description: "Address that received the transaction" + data_type: varbinary + - name: signature + description: "Function signature hash" + data_type: varbinary + - name: function_name + description: "Name of the called function" + data_type: varchar + + - name: creation_traces + meta: + docs_slug: /evm/flare/raw/creation_traces + short_description: The creation_traces table contains information about contract creation events. + description: '{{ doc("flare_creation_traces_doc") }}' + columns: + - name: block_time + description: "The exact UTC timestamp when the block containing this creation was added to the chain" + data_type: timestamp + - name: block_number + description: "The sequential number of the block containing this creation" + data_type: bigint + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the transaction" + data_type: varbinary + - name: address + description: "Address of the deployed contract" + data_type: varbinary + - name: from + description: "Address of the account that created the contract" + data_type: varbinary + - name: code + description: "Bytecode of the deployed contract" + data_type: varbinary + - name: block_month + description: "The month of the block date" + data_type: date - name: logs meta: docs_slug: /evm/flare/raw/logs - short_description: The `flare.logs` table contains information about event logs emitted by smart contracts on the flare blockchain. + short_description: The `flare.logs` table contains all event logs emitted by contracts on the flare blockchain. description: '{{ doc("flare_logs_doc") }}' - columns: - - *block_number - - *block_time - - name: tx_hash - description: "The hash of the transaction that emitted this log" + - name: block_time + description: "The exact UTC timestamp when this log was emitted" + data_type: timestamp + - name: block_number + description: "The sequential number of the block containing this log" + data_type: bigint + - name: block_hash + description: "Hash of the block containing this log" + data_type: varbinary - name: contract_address - description: "The address of the contract that emitted this log" + description: "Address of the contract that emitted this log" + data_type: varbinary - name: topic0 - description: "The first topic (typically the event signature)" + description: "First topic of the log (typically the event signature)" + data_type: varbinary - name: topic1 - description: "The second topic (if any)" + description: "Second topic of the log" + data_type: varbinary - name: topic2 - description: "The third topic (if any)" + description: "Third topic of the log" + data_type: varbinary - name: topic3 - description: "The fourth topic (if any)" + description: "Fourth topic of the log" + data_type: varbinary - name: data - description: "The data field of the log" + description: "Additional data included in the log" + data_type: varbinary + - name: tx_hash + description: "Hash of the transaction that generated this log" + data_type: varbinary - name: index - description: "The index of the log within its transaction" + description: "Index of this log within the transaction" + data_type: integer + - name: tx_index + description: "Index of the transaction within the block" + data_type: integer + - name: block_date + description: "UTC date of the block containing this log" + data_type: date + - name: tx_from + description: "Address that sent the transaction" + data_type: varbinary + - name: tx_to + description: "Address that received the transaction" + data_type: varbinary - - name: contracts + - name: logs_decoded meta: - docs_slug: /evm/flare/raw/contracts - short_description: The `flare.contracts` table tracks decoded contracts on flare, including associated metadata such as namespace, name, address, ABI. - description: '{{ doc("flare_contracts_doc") }}' - + docs_slug: /evm/flare/raw/logs_decoded + short_description: The `flare.logs_decoded` table contains decoded event logs from known contracts on the flare blockchain. + description: '{{ doc("flare_logs_decoded_doc") }}' columns: - - name: address - description: "The contract address" - - name: bytecode - description: "The contract bytecode" - - name: name - description: "The name of the contract" + - name: block_date + description: "UTC date of the block containing this log" + data_type: date + - name: block_time + description: "The exact UTC timestamp when this log was emitted" + data_type: timestamp + - name: block_number + description: "The sequential number of the block containing this log" + data_type: bigint - name: namespace - description: "The namespace the contract belongs to" - - name: abi - description: "The contract ABI" \ No newline at end of file + description: "Project namespace for the contract" + data_type: varchar + - name: contract_name + description: "Name of the contract that emitted this event" + data_type: varchar + - name: contract_address + description: "Address of the contract that emitted this event" + data_type: varbinary + - name: tx_hash + description: "Hash of the transaction that generated this event" + data_type: varbinary + - name: tx_from + description: "Address that sent the transaction" + data_type: varbinary + - name: tx_to + description: "Address that received the transaction" + data_type: varbinary + - name: index + description: "Index of this event within the transaction" + data_type: integer + - name: signature + description: "Event signature hash" + data_type: varbinary + - name: event_name + description: "Name of the emitted event" + data_type: varchar + + - name: blocks + meta: + docs_slug: /evm/flare/raw/blocks + short_description: The `flare.blocks` table contains information about blocks on the flare blockchain. + description: '{{ doc("flare_blocks_doc") }}' + columns: + - name: time + description: "The exact UTC timestamp when this block was added to the chain" + data_type: timestamp + - name: number + description: "The sequential number of this block in the chain" + data_type: bigint + - name: gas_limit + description: "Maximum amount of gas that could be used by all transactions in this block" + data_type: decimal(38,0) + - name: gas_used + description: "Actual amount of gas used by all transactions in this block" + data_type: decimal(38,0) + - name: difficulty + description: "Numerical value indicating the computational effort required to mine this block" + data_type: bigint + - name: total_difficulty + description: "Sum of block difficulties up to this block" + data_type: decimal(38,0) + - name: size + description: "Size of this block in bytes" + data_type: bigint + - name: base_fee_per_gas + description: "Base fee per gas in the block (post-EIP-1559)" + data_type: bigint + - name: hash + description: "Unique 256-bit identifier (hash) of this block" + data_type: varbinary + - name: parent_hash + description: "Hash of the previous block in the chain" + data_type: varbinary + - name: miner + description: "Address of the validator that produced this block" + data_type: varbinary + - name: nonce + description: "Value used to demonstrate proof of work for this block" + data_type: varbinary + - name: state_root + description: "Root hash of the state trie" + data_type: varbinary + - name: transactions_root + description: "Root hash of the transactions trie" + data_type: varbinary + - name: receipts_root + description: "Root hash of the receipts trie" + data_type: varbinary + - name: date + description: "The UTC date when this block was added to the chain" + data_type: date + + # ERC Transfer Tables + - name: erc20_flare + description: "Transfer events for ERC20 tokens on flare" + tables: + - name: evt_transfer + meta: + docs_slug: /evm/flare/decoded/interfaces/erc20/evt_transfer + short_description: This table contains individual transfer events for ERC20 tokens on the flare blockchain. Each row represents a single token transfer event. + description: '{{ doc("erc20_flare_evt_transfer_doc") }}' + columns: + - name: contract_address + description: "Address of the ERC20 token contract that emitted this event" + - &evt_tx_hash + name: evt_tx_hash + description: "Hash of the transaction containing this event" + - &evt_index + name: evt_index + description: "Index position of this event within the transaction" + - &evt_block_time + name: evt_block_time + description: "Timestamp of the block containing this event" + - &evt_block_number + name: evt_block_number + description: "The block number containing this event" + - *from + - *to + - name: value + description: "Amount of ERC20 tokens transferred, in the token's flare unit" + + - name: evt_approval + meta: + docs_slug: /evm/flare/decoded/interfaces/erc20/evt_approval + short_description: The `flare.evt_approval` table contains approval events for ERC20 tokens on flare, allowing an address to spend tokens on behalf of the owner. + description: '{{ doc("erc20_flare_evt_approval_doc") }}' + columns: + - name: contract_address + description: "Address of the ERC20 token contract" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - name: owner + description: "address of the token owner granting approval" + - name: spender + description: "address being granted permission to spend tokens" + - name: value + description: "Amount of ERC20 tokens approved for spending, in the token's smallest unit" + + - name: erc1155_flare + description: "events related to ERC1155 tokens" + tables: + - name: evt_transfersingle + meta: + docs_slug: /evm/flare/decoded/interfaces/erc1155/evt_transfersingle + short_description: This table contains single transfer events for ERC1155 tokens on the network. + description: '{{ doc("erc1155_flare_evt_transfersingle_doc") }}' + columns: + - name: contract_address + description: "address of the ERC1155 token contract" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - name: operator + description: "the address that is authorized to execute the transfer on behalf of the owner" + - *from + - *to + - name: id + description: "Unique identifier of the ERC1155 token being transferred" + - name: value + description: "Quantity of the ERC1155 token transferred" + - name: evt_transferbatch + meta: + docs_slug: /evm/flare/decoded/interfaces/erc1155/evt_transferbatch + short_description: This table contains all batch transfer events for ERC1155 tokens on the network. + description: '{{ doc("erc1155_ethereum_evt_transferbatch_doc") }}' + columns: + - name: contract_address + description: "Contract address of the ERC1155 token contract" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - name: operator + description: "Contract address authorized to execute the batch transfer on behalf of the owner" + - *from + - *to + - name: ids + description: "Array of unique identifiers of the ERC1155 tokens being transferred" + - name: values + description: "Array of quantities for each ERC1155 token transferred, corresponding to the ids array" + - name: evt_ApprovalForAll + meta: + docs_slug: /evm/flare/decoded/interfaces/erc1155/evt_ApprovalForAll + short_description: This table contains approval events for all tokens of an ERC1155 contract on this network. + description: '{{ doc("erc1155_ethereum_evt_ApprovalForAll_doc") }}' + columns: + - name: contract_address + description: "flare address of the ERC1155 token contract" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - &approved + name: approved + description: "Boolean indicating whether approval is granted (true) or revoked (false)" + - &owner + name: owner + description: "flare address of the token owner granting or revoking approval" + - name: operator + description: "flare address being granted or revoked permission to operate all tokens" + + - name: erc721_flare + description: '{{ doc("erc721_flare_evt_transfer_doc") }}' + tables: + - name: evt_transfer + description: "Transfer events for ERC721 tokens on this network" + columns: + - name: contract_address + description: "Contract address of the ERC721 token contract" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - *from + - *to + - name: tokenId + description: "Unique identifier of the ERC721 token (NFT) being transferred" + - name: evt_Approval + meta: + docs_slug: /evm/flare/decoded/interfaces/erc721/evt_Approval + short_description: "Approval events for ERC721 tokens on this network" + description: '{{ doc("erc721_ethereum_evt_Approval_doc") }}' + columns: + - name: contract_address + description: "Contract address of the ERC721 token contract" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - *approved + - *owner + - name: tokenId + description: "Unique identifier of the ERC721 token (NFT) for which approval is granted or revoked" + - name: evt_ApprovalForAll + meta: + docs_slug: /evm/flare/decoded/interfaces/erc721/evt_ApprovalForAll + short_description: The `flare.evt_ApprovalForAll` table contains approval events for all tokens of an ERC721 contract on the flare blockchain. + description: '{{ doc("erc721_ethereum_evt_ApprovalForAll_doc") }}' + columns: + - name: contract_address + description: "Address of the ERC721 token contract" + - *evt_tx_hash + - *evt_index + - *evt_block_time + - *evt_block_number + - *approved + - *owner + - name: operator + description: "The address being granted or revoked permission to operate all tokens" diff --git a/sources/_base_sources/evm/flare_docs_block.md b/sources/_base_sources/evm/flare_docs_block.md index 38398dd0ea2..b080dc26411 100644 --- a/sources/_base_sources/evm/flare_docs_block.md +++ b/sources/_base_sources/evm/flare_docs_block.md @@ -1,75 +1,131 @@ {% docs flare_transactions_doc %} -The `flare.transactions` table contains detailed information about transactions on the flare blockchain. It includes: +The `flare.transactions` table contains detailed information about transactions on the Flare blockchain. It includes: - Block information: number, timestamp, hash - Transaction details: hash, from_address, to_address, value -- Gas data: gas_price, gas_limit, gas_used +- Gas data: gas_price, gas_limit, gas_used, max_fee_per_gas, priority_fee_per_gas - Status: success or failure - Input data for contract interactions -- Nonce -- Transaction type +- Nonce and chain_id +- Transaction type and access list -This table is used for analyzing transaction patterns, gas usage, value transfers, and overall network activity on flare. +This table is used for analyzing transaction patterns, gas usage, value transfers, and overall network activity on Flare. {% enddocs %} {% docs flare_traces_doc %} -The `flare.traces` table contains records of execution steps for transactions on the flare blockchain. Each trace represents an atomic operation that modifies the state of the Ethereum Virtual Machine (EVM). Key components include: +The `flare.traces` table contains records of execution steps for transactions on the Flare blockchain. Each trace represents an atomic operation that modifies the state of the Ethereum Virtual Machine (EVM). Key components include: -- Transaction hash -- Block number and timestamp +- Transaction hash and block information - From and to addresses - Value transferred -- Input data +- Gas metrics (gas, gas_used) +- Input and output data - Call type (e.g., CALL, DELEGATECALL, CREATE) -- Gas information -- Error messages (if any) +- Error information and revert reasons +- Trace address for nested calls This table is essential for: - Analyzing internal transactions - Debugging smart contract interactions - Tracking value flows through complex transactions - Understanding contract creation and deployment +- Monitoring FTSO (Flare Time Series Oracle) interactions +- Analyzing State Connector operations + +{% enddocs %} + +{% docs flare_traces_decoded_doc %} + +The `flare.traces_decoded` table contains a subset of decoded traces from the Flare blockchain dependent on submitted smart contracts and their ABIs. It includes: + +- Block information and transaction details +- Contract name and namespace +- Decoded function names and signatures +- Trace address for execution path tracking +- Transaction origin and destination +- Function parameters (when available) + +This table is used for high level analysis of smart contract interactions, including FTSO and State Connector operations. For fully decoded function calls and parameters, refer to protocol-specific decoded tables. {% enddocs %} {% docs flare_logs_doc %} -The `flare.logs` table contains information about event logs emitted by smart contracts on the flare blockchain. It includes: +The `flare.logs` table contains event logs emitted by smart contracts on the Flare blockchain. It includes: -- Block information: number, timestamp -- Transaction hash +- Block information: number, timestamp, hash +- Transaction details: hash, index, from, to - Contract address (emitting the event) - Topic0 (event signature) - Additional topics (indexed parameters) - Data field (non-indexed parameters) -- Log index +- Log index and transaction index This table is crucial for: - Tracking on-chain events - Monitoring contract activity - Analyzing token transfers - Following protocol-specific events +- Tracking FTSO price submissions and rewards +- Monitoring State Connector attestations + +{% enddocs %} + +{% docs flare_logs_decoded_doc %} + +The `flare.logs_decoded` table contains a subset of decoded logs from the Flare blockchain dependent on submitted smart contracts and their ABIs. It includes: + +- Block and transaction information +- Contract details (name, namespace, address) +- Decoded event names and signatures +- Transaction origin and destination +- Event parameters (when available) + +This table is used for high level analysis of smart contract events, particularly useful for monitoring FTSO and State Connector activities. For fully decoded events and parameters, refer to protocol-specific decoded tables. + +{% enddocs %} + +{% docs flare_blocks_doc %} + +The `flare.blocks` table contains information about Flare blocks. It provides essential data about each block in the Flare blockchain, including: + +- Block identifiers and timestamps +- Gas metrics and size +- Consensus information (difficulty, nonce) +- State roots and receipts +- Parent block information +- Base fee per gas +- Extra data + +This table is used for: +- Block timing analysis +- Network performance monitoring +- Gas price trends +- Chain reorganization studies +- Consensus metrics tracking {% enddocs %} {% docs flare_contracts_doc %} -The `flare.contracts` table tracks decoded contracts on flare, including: +The `flare.contracts` table contains information about verified smart contracts on the Flare blockchain. It includes: - Contract address -- Bytecode -- Contract name -- Namespace -- ABI -- Creation details +- Contract name and version +- Verification status and timestamp +- Compiler information +- Source code and ABI +- License type +- Implementation details This table is used for: -- Contract verification +- Contract verification status - Smart contract analysis - Protocol research - Development and debugging +- FTSO and State Connector contract tracking {% enddocs %} From 24944a9ae61e95f41a0ccd11e7802f9bf9771ee0 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Wed, 4 Dec 2024 18:29:24 +0800 Subject: [PATCH 07/45] Fix source --- .../_base_sources/evm/flare_base_sources.yml | 239 +++++++++++------- 1 file changed, 145 insertions(+), 94 deletions(-) diff --git a/sources/_base_sources/evm/flare_base_sources.yml b/sources/_base_sources/evm/flare_base_sources.yml index 398fe495dff..aced6efea3d 100644 --- a/sources/_base_sources/evm/flare_base_sources.yml +++ b/sources/_base_sources/evm/flare_base_sources.yml @@ -1,17 +1,14 @@ version: 2 sources: - # Flare Tables - name: flare - description: "raw tables for the chain" - + description: "Raw tables for the Flare blockchain" tables: - name: transactions meta: - docs_slug: /evm/flare/raw/transactions - short_description: The transactions table contains detailed information about transactions on the network. + docs_slug: "/evm/flare/raw/transactions" + short_description: "The `flare.transactions` table contains all transactions on the Flare blockchain." description: '{{ doc("flare_transactions_doc") }}' - columns: - name: block_time description: "The exact UTC timestamp when this transaction was included" @@ -76,8 +73,8 @@ sources: - name: traces meta: - docs_slug: /evm/flare/raw/traces - short_description: The `flare.traces` table contains all transaction traces on the flare blockchain. + docs_slug: "/evm/flare/raw/traces" + short_description: "The `flare.traces` table contains all transaction traces on the Flare blockchain." description: '{{ doc("flare_traces_doc") }}' columns: - name: block_time @@ -161,8 +158,8 @@ sources: - name: traces_decoded meta: - docs_slug: /evm/flare/raw/traces_decoded - short_description: The `flare.traces_decoded` table contains decoded traces from known contracts on the flare blockchain. + docs_slug: "/evm/flare/raw/traces_decoded" + short_description: "The `flare.traces_decoded` table contains decoded traces from known contracts on the Flare blockchain." description: '{{ doc("flare_traces_decoded_doc") }}' columns: - name: block_date @@ -204,8 +201,8 @@ sources: - name: creation_traces meta: - docs_slug: /evm/flare/raw/creation_traces - short_description: The creation_traces table contains information about contract creation events. + docs_slug: "/evm/flare/raw/creation_traces" + short_description: "The `flare.creation_traces` table contains information about contract creation events." description: '{{ doc("flare_creation_traces_doc") }}' columns: - name: block_time @@ -232,8 +229,8 @@ sources: - name: logs meta: - docs_slug: /evm/flare/raw/logs - short_description: The `flare.logs` table contains all event logs emitted by contracts on the flare blockchain. + docs_slug: "/evm/flare/raw/logs" + short_description: "The `flare.logs` table contains all event logs emitted by contracts on the Flare blockchain." description: '{{ doc("flare_logs_doc") }}' columns: - name: block_time @@ -284,8 +281,8 @@ sources: - name: logs_decoded meta: - docs_slug: /evm/flare/raw/logs_decoded - short_description: The `flare.logs_decoded` table contains decoded event logs from known contracts on the flare blockchain. + docs_slug: "/evm/flare/raw/logs_decoded" + short_description: "The `flare.logs_decoded` table contains decoded event logs from known contracts on the Flare blockchain." description: '{{ doc("flare_logs_decoded_doc") }}' columns: - name: block_date @@ -327,8 +324,8 @@ sources: - name: blocks meta: - docs_slug: /evm/flare/raw/blocks - short_description: The `flare.blocks` table contains information about blocks on the flare blockchain. + docs_slug: "/evm/flare/raw/blocks" + short_description: "The `flare.blocks` table contains information about blocks on the Flare blockchain." description: '{{ doc("flare_blocks_doc") }}' columns: - name: time @@ -380,117 +377,146 @@ sources: description: "The UTC date when this block was added to the chain" data_type: date - # ERC Transfer Tables - name: erc20_flare - description: "Transfer events for ERC20 tokens on flare" + description: "Transfer events for ERC20 tokens on Flare blockchain" tables: - name: evt_transfer meta: - docs_slug: /evm/flare/decoded/interfaces/erc20/evt_transfer - short_description: This table contains individual transfer events for ERC20 tokens on the flare blockchain. Each row represents a single token transfer event. + docs_slug: "/evm/flare/decoded/interfaces/erc20/evt_transfer" + short_description: "This table contains individual transfer events for ERC20 tokens on the Flare blockchain. Each row represents a single token transfer event." description: '{{ doc("erc20_flare_evt_transfer_doc") }}' columns: - name: contract_address description: "Address of the ERC20 token contract that emitted this event" - - &evt_tx_hash - name: evt_tx_hash + - name: evt_tx_hash description: "Hash of the transaction containing this event" - - &evt_index - name: evt_index + - name: evt_index description: "Index position of this event within the transaction" - - &evt_block_time - name: evt_block_time + - name: evt_block_time description: "Timestamp of the block containing this event" - - &evt_block_number - name: evt_block_number + - name: evt_block_number description: "The block number containing this event" - - *from - - *to + - name: from + description: "Address that sent the transaction" + data_type: varbinary + - name: to + description: "Address that received the transaction" + data_type: varbinary - name: value - description: "Amount of ERC20 tokens transferred, in the token's flare unit" + description: "Amount of ERC20 tokens transferred, in the token's Flare unit" - name: evt_approval meta: - docs_slug: /evm/flare/decoded/interfaces/erc20/evt_approval - short_description: The `flare.evt_approval` table contains approval events for ERC20 tokens on flare, allowing an address to spend tokens on behalf of the owner. + docs_slug: "/evm/flare/decoded/interfaces/erc20/evt_approval" + short_description: "The `flare.evt_approval` table contains approval events for ERC20 tokens on Flare, allowing an address to spend tokens on behalf of the owner." description: '{{ doc("erc20_flare_evt_approval_doc") }}' columns: - name: contract_address description: "Address of the ERC20 token contract" - - *evt_tx_hash - - *evt_index - - *evt_block_time - - *evt_block_number + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" - name: owner - description: "address of the token owner granting approval" + description: "Address of the token owner granting approval" + data_type: varbinary - name: spender - description: "address being granted permission to spend tokens" + description: "Address being granted permission to spend tokens" + data_type: varbinary - name: value description: "Amount of ERC20 tokens approved for spending, in the token's smallest unit" - name: erc1155_flare - description: "events related to ERC1155 tokens" + description: "Events related to ERC1155 tokens on Flare blockchain" tables: - name: evt_transfersingle meta: - docs_slug: /evm/flare/decoded/interfaces/erc1155/evt_transfersingle - short_description: This table contains single transfer events for ERC1155 tokens on the network. + docs_slug: "/evm/flare/decoded/interfaces/erc1155/evt_transfersingle" + short_description: "This table contains single transfer events for ERC1155 tokens on the network." description: '{{ doc("erc1155_flare_evt_transfersingle_doc") }}' columns: - name: contract_address - description: "address of the ERC1155 token contract" - - *evt_tx_hash - - *evt_index - - *evt_block_time - - *evt_block_number + description: "Address of the ERC1155 token contract" + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" - name: operator - description: "the address that is authorized to execute the transfer on behalf of the owner" - - *from - - *to + description: "The address that is authorized to execute the transfer on behalf of the owner" + data_type: varbinary + - name: from + description: "Address that sent the transaction" + data_type: varbinary + - name: to + description: "Address that received the transaction" + data_type: varbinary - name: id description: "Unique identifier of the ERC1155 token being transferred" - name: value description: "Quantity of the ERC1155 token transferred" + - name: evt_transferbatch meta: - docs_slug: /evm/flare/decoded/interfaces/erc1155/evt_transferbatch - short_description: This table contains all batch transfer events for ERC1155 tokens on the network. + docs_slug: "/evm/flare/decoded/interfaces/erc1155/evt_transferbatch" + short_description: "This table contains all batch transfer events for ERC1155 tokens on the network." description: '{{ doc("erc1155_ethereum_evt_transferbatch_doc") }}' columns: - name: contract_address description: "Contract address of the ERC1155 token contract" - - *evt_tx_hash - - *evt_index - - *evt_block_time - - *evt_block_number + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" - name: operator description: "Contract address authorized to execute the batch transfer on behalf of the owner" - - *from - - *to + data_type: varbinary + - name: from + description: "Address that sent the transaction" + data_type: varbinary + - name: to + description: "Address that received the transaction" + data_type: varbinary - name: ids description: "Array of unique identifiers of the ERC1155 tokens being transferred" - name: values description: "Array of quantities for each ERC1155 token transferred, corresponding to the ids array" + - name: evt_ApprovalForAll meta: - docs_slug: /evm/flare/decoded/interfaces/erc1155/evt_ApprovalForAll - short_description: This table contains approval events for all tokens of an ERC1155 contract on this network. + docs_slug: "/evm/flare/decoded/interfaces/erc1155/evt_ApprovalForAll" + short_description: "This table contains approval events for all tokens of an ERC1155 contract on this network." description: '{{ doc("erc1155_ethereum_evt_ApprovalForAll_doc") }}' columns: - name: contract_address - description: "flare address of the ERC1155 token contract" - - *evt_tx_hash - - *evt_index - - *evt_block_time - - *evt_block_number - - &approved - name: approved + description: "Flare address of the ERC1155 token contract" + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: approved description: "Boolean indicating whether approval is granted (true) or revoked (false)" - - &owner - name: owner - description: "flare address of the token owner granting or revoking approval" + - name: owner + description: "Flare address of the token owner granting or revoking approval" + data_type: varbinary - name: operator - description: "flare address being granted or revoked permission to operate all tokens" + description: "Flare address being granted or revoked permission to operate all tokens" + data_type: varbinary - name: erc721_flare description: '{{ doc("erc721_flare_evt_transfer_doc") }}' @@ -500,43 +526,68 @@ sources: columns: - name: contract_address description: "Contract address of the ERC721 token contract" - - *evt_tx_hash - - *evt_index - - *evt_block_time - - *evt_block_number - - *from - - *to + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: from + description: "Address that sent the transaction" + data_type: varbinary + - name: to + description: "Address that received the transaction" + data_type: varbinary - name: tokenId description: "Unique identifier of the ERC721 token (NFT) being transferred" + - name: evt_Approval meta: - docs_slug: /evm/flare/decoded/interfaces/erc721/evt_Approval + docs_slug: "/evm/flare/decoded/interfaces/erc721/evt_Approval" short_description: "Approval events for ERC721 tokens on this network" description: '{{ doc("erc721_ethereum_evt_Approval_doc") }}' columns: - name: contract_address description: "Contract address of the ERC721 token contract" - - *evt_tx_hash - - *evt_index - - *evt_block_time - - *evt_block_number - - *approved - - *owner + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: approved + description: "Boolean indicating whether approval is granted (true) or revoked (false)" + - name: owner + description: "Address of the token owner granting or revoking approval" + data_type: varbinary - name: tokenId description: "Unique identifier of the ERC721 token (NFT) for which approval is granted or revoked" + - name: evt_ApprovalForAll meta: - docs_slug: /evm/flare/decoded/interfaces/erc721/evt_ApprovalForAll - short_description: The `flare.evt_ApprovalForAll` table contains approval events for all tokens of an ERC721 contract on the flare blockchain. + docs_slug: "/evm/flare/decoded/interfaces/erc721/evt_ApprovalForAll" + short_description: "The `flare.evt_ApprovalForAll` table contains approval events for all tokens of an ERC721 contract on the Flare blockchain." description: '{{ doc("erc721_ethereum_evt_ApprovalForAll_doc") }}' columns: - name: contract_address description: "Address of the ERC721 token contract" - - *evt_tx_hash - - *evt_index - - *evt_block_time - - *evt_block_number - - *approved - - *owner + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: approved + description: "Boolean indicating whether approval is granted (true) or revoked (false)" + - name: owner + description: "Address of the token owner granting or revoking approval" + data_type: varbinary - name: operator description: "The address being granted or revoked permission to operate all tokens" + data_type: varbinary From e965bf836a91520255816af9c7341c75b182cc8c Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Wed, 4 Dec 2024 18:36:59 +0800 Subject: [PATCH 08/45] Complete docs block --- sources/_base_sources/evm/flare_docs_block.md | 180 ++++++++++++++++++ 1 file changed, 180 insertions(+) diff --git a/sources/_base_sources/evm/flare_docs_block.md b/sources/_base_sources/evm/flare_docs_block.md index b080dc26411..06a96b286c2 100644 --- a/sources/_base_sources/evm/flare_docs_block.md +++ b/sources/_base_sources/evm/flare_docs_block.md @@ -129,3 +129,183 @@ This table is used for: - FTSO and State Connector contract tracking {% enddocs %} + +{% docs flare_creation_traces_doc %} + +The `flare.creation_traces` table contains detailed information about contract creation events on the Flare blockchain. It includes: + +- Block information: time, number, date +- Transaction details: hash, from address +- Contract creation specifics: + * Created contract address + * Contract bytecode + * Creation transaction details + * Success/failure status + +This table is essential for: +- Tracking smart contract deployments +- Analyzing contract creation patterns +- Monitoring new protocol deployments +- Auditing contract creation history +- Understanding contract deployment costs + +{% enddocs %} + +{% docs erc20_flare_evt_transfer_doc %} + +The `flare.erc20_flare.evt_transfer` table contains ERC20 token transfer events on the Flare blockchain. Each row represents a single token transfer and includes: + +- Contract address of the token +- Transaction details (hash, block info) +- Transfer participants (from and to addresses) +- Amount transferred +- Event metadata (index, block time) + +This table is crucial for: +- Tracking token movements +- Analyzing token holder behavior +- Monitoring token activity +- Computing token metrics +- Identifying significant transfers + +{% enddocs %} + +{% docs erc20_flare_evt_approval_doc %} + +The `flare.erc20_flare.evt_approval` table contains ERC20 token approval events on the Flare blockchain. It records when token holders authorize other addresses to spend tokens on their behalf, including: + +- Token contract address +- Transaction information +- Owner address (granting approval) +- Spender address (receiving approval) +- Approved amount +- Event metadata + +This table is used for: +- Monitoring token approvals +- Analyzing DEX interactions +- Tracking delegation patterns +- Security monitoring +- Protocol integration analysis + +{% enddocs %} + +{% docs erc1155_flare_evt_transfersingle_doc %} + +The `flare.erc1155_flare.evt_transfersingle` table contains single transfer events for ERC1155 tokens on the Flare blockchain. Each record includes: + +- Contract address +- Transaction details +- Operator address +- From and to addresses +- Token ID +- Amount transferred +- Event metadata + +This table is essential for: +- Tracking multi-token transfers +- Gaming asset movements +- NFT marketplace analysis +- Collection statistics +- User activity monitoring + +{% enddocs %} + +{% docs erc1155_flare_evt_transferbatch_doc %} + +The `flare.erc1155_flare.evt_transferbatch` table contains batch transfer events for ERC1155 tokens on the Flare blockchain. It records multiple token transfers in a single transaction: + +- Contract address +- Transaction information +- Operator address +- From and to addresses +- Arrays of token IDs and amounts +- Event metadata + +This table is used for: +- Analyzing bulk transfers +- Gaming inventory movements +- Marketplace activity +- Collection migrations +- Protocol efficiency analysis + +{% enddocs %} + +{% docs erc1155_flare_evt_approvalforall_doc %} + +The `flare.erc1155_flare.evt_approvalforall` table contains approval events for ERC1155 tokens on the Flare blockchain. It records when owners grant or revoke approval for all their tokens: + +- Contract address +- Transaction details +- Owner address +- Operator address +- Approval status +- Event metadata + +This table is crucial for: +- Monitoring collection approvals +- Marketplace integrations +- Protocol permissions +- Security analysis +- User behavior studies + +{% enddocs %} + +{% docs erc721_flare_evt_transfer_doc %} + +The `flare.erc721_flare.evt_transfer` table contains transfer events for ERC721 tokens (NFTs) on the Flare blockchain. Each record represents a single NFT transfer: + +- Contract address +- Transaction information +- From and to addresses +- Token ID +- Event metadata + +This table is essential for: +- NFT ownership tracking +- Collection analysis +- Market activity monitoring +- User portfolio tracking +- Transfer pattern analysis + +{% enddocs %} + +{% docs erc721_flare_evt_approval_doc %} + +The `flare.erc721_flare.evt_approval` table contains approval events for ERC721 tokens on the Flare blockchain. It records when NFT owners authorize specific addresses to transfer individual tokens: + +- Contract address +- Transaction details +- Owner address +- Approved address +- Token ID +- Event metadata + +This table is used for: +- NFT approval tracking +- Marketplace integration analysis +- Permission monitoring +- Security auditing +- Protocol interaction study + +{% enddocs %} + +{% docs erc721_flare_evt_approvalforall_doc %} + +The `flare.erc721_flare.evt_approvalforall` table contains collection-wide approval events for ERC721 tokens on the Flare blockchain. It records when owners grant or revoke approval for all their NFTs: + +- Contract address +- Transaction information +- Owner address +- Operator address +- Approval status +- Event metadata + +This table is crucial for: +- Collection permission tracking +- Marketplace authorization +- Protocol integration analysis +- Security monitoring +- User behavior analysis + +{% enddocs %} From f4ac044c5830dc9ca5b71d586ebc868572ba78a1 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Wed, 4 Dec 2024 18:39:47 +0800 Subject: [PATCH 09/45] Update prices_flare_tokens.sql --- .../tokens/models/prices/flare/prices_flare_tokens.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql b/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql index ffeef16f22c..956f9317452 100644 --- a/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql @@ -3,6 +3,8 @@ {{ config( schema = 'prices_' + blockchain, alias = 'tokens', + materialized = 'table', + file_format = 'delta', tags = ['static'] ) }} @@ -17,4 +19,7 @@ FROM ( VALUES ('flr-flare-network', 'WFLR', 0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d, 18) + , ('joule-kinetic', 'JOULE', 0xE6505f92583103AF7ed9974DEC451A7Af4e3A3bE, 18) + , ('usdc.e-usd-coin.e', 'USDC.e', 0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6, 6) + , ('usdt-tether', 'USDT', 0x0B38e83B86d491735fEaa0a791F65c2B99535396, 6) ) as temp (token_id, symbol, contract_address, decimals) From 715c31c9f83c6adfebd838e071a6d5273fce36b7 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Wed, 4 Dec 2024 18:44:56 +0800 Subject: [PATCH 10/45] Fix native token --- dbt_subprojects/tokens/models/prices/prices_native_tokens.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/dbt_subprojects/tokens/models/prices/prices_native_tokens.sql b/dbt_subprojects/tokens/models/prices/prices_native_tokens.sql index 9ab6c506e7c..978c1669a8c 100644 --- a/dbt_subprojects/tokens/models/prices/prices_native_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/prices_native_tokens.sql @@ -35,7 +35,6 @@ FROM ('eos-eos', null, 'EOS', null, null), ('etc-ethereum-classic', null, 'ETC', null, null), ('eth-ethereum', null, 'ETH', null, null), - ('flare-flare', null, 'FLR', null, null), ('ftm-fantom', null, 'FTM', null, null), ('hbar-hedera-hashgraph', null, 'HBAR', null, null), ('icp-internet-computer', null, 'ICP', null, null), From 78a7222ea4a14759e0ffa1f43d6f4f2c74550077 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Wed, 4 Dec 2024 18:53:16 +0800 Subject: [PATCH 11/45] Add yakufff's credit --- dbt_subprojects/tokens/models/prices/flare/_schema.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt_subprojects/tokens/models/prices/flare/_schema.yml b/dbt_subprojects/tokens/models/prices/flare/_schema.yml index 67bac2872f6..dcd1b19db3a 100644 --- a/dbt_subprojects/tokens/models/prices/flare/_schema.yml +++ b/dbt_subprojects/tokens/models/prices/flare/_schema.yml @@ -5,7 +5,7 @@ models: meta: blockchain: flare sector: prices - contributors: hosuke + contributors: hosuke, yakufff config: tags: ['prices', 'tokens', 'usd', 'flare'] description: "Price tokens on Flare Network EVM chain" From b8b0b0248faebabfc75341575fd2eff588451ea7 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Wed, 4 Dec 2024 18:55:21 +0800 Subject: [PATCH 12/45] Remove post_hook --- .../tokens/models/tokens/flare/tokens_flare_erc20.sql | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dbt_subprojects/tokens/models/tokens/flare/tokens_flare_erc20.sql b/dbt_subprojects/tokens/models/tokens/flare/tokens_flare_erc20.sql index 8b302f932a0..b12a5c48e61 100644 --- a/dbt_subprojects/tokens/models/tokens/flare/tokens_flare_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/flare/tokens_flare_erc20.sql @@ -4,10 +4,6 @@ , alias = 'erc20' , tags = ['static'] , materialized = 'table' - , post_hook='{{ expose_spells(\'["flare"]\', - "sector", - "tokens", - \'["hosuke"]\') }}' ) }} From 2d80043fd2b0328b7eb922ddf9d1e9100b72ba0d Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Wed, 4 Dec 2024 18:58:47 +0800 Subject: [PATCH 13/45] Update schema --- dbt_subprojects/tokens/models/tokens/flare/_schema.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt_subprojects/tokens/models/tokens/flare/_schema.yml b/dbt_subprojects/tokens/models/tokens/flare/_schema.yml index afe1b985700..93ec5d26b80 100644 --- a/dbt_subprojects/tokens/models/tokens/flare/_schema.yml +++ b/dbt_subprojects/tokens/models/tokens/flare/_schema.yml @@ -6,7 +6,7 @@ models: blockchain: flare sector: tokens project: erc20 - contributors: hosuke + contributors: hosuke, yakufff config: tags: ['table', 'erc20', 'flare'] description: "ERC20 Token Addresses, Symbols and Decimals on flare Network" From 3597854d6a249bbcc3a81610793d458a614618fc Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Fri, 6 Dec 2024 00:11:44 +0800 Subject: [PATCH 14/45] Init flare dex --- .../dex/models/trades/flare/_schema.yml | 78 +++++++++++++++++++ .../trades/flare/dex_flare_base_trades.sql | 49 ++++++++++++ .../platforms/enosys_v2_flare_base_trades.sql | 28 +++++++ .../platforms/enosys_v3_flare_base_trades.sql | 28 +++++++ sources/_sector/dex/trades/flare/_sources.yml | 19 +++++ 5 files changed, 202 insertions(+) create mode 100644 dbt_subprojects/dex/models/trades/flare/_schema.yml create mode 100644 dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql create mode 100644 dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql create mode 100644 dbt_subprojects/dex/models/trades/flare/platforms/enosys_v3_flare_base_trades.sql create mode 100644 sources/_sector/dex/trades/flare/_sources.yml diff --git a/dbt_subprojects/dex/models/trades/flare/_schema.yml b/dbt_subprojects/dex/models/trades/flare/_schema.yml new file mode 100644 index 00000000000..041ccda17aa --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/_schema.yml @@ -0,0 +1,78 @@ +version: 2 + +models: + - name: dex_flare_base_trades + meta: + blockchain: flare + sector: dex + project: dex + contributors: hosuke + config: + tags: ['flare', 'dex', 'trades'] + description: > + Flare DEX trades + columns: + - name: blockchain + description: "Blockchain" + - name: project + description: "Project name of the DEX" + - name: version + description: "Version of the DEX protocol" + - name: block_month + description: "UTC event block month" + - name: block_date + description: "UTC event block date" + - name: block_time + description: "UTC event block time" + - name: block_number + description: "Block number" + - name: token_bought_amount_raw + description: "Raw amount of token bought (not normalized)" + - name: token_sold_amount_raw + description: "Raw amount of token sold (not normalized)" + - name: token_bought_address + description: "Contract address of the token bought" + - name: token_sold_address + description: "Contract address of the token sold" + - name: taker + description: "Address of trader who initiated the trade" + - name: maker + description: "Address of trader who provided liquidity" + - name: project_contract_address + description: "Project's contract address that executed the trade" + - name: tx_hash + description: "Transaction hash" + - name: evt_index + description: "Event index" + data_tests: + - check_dex_info_relationship + + - name: enosys_v2_flare_base_trades + meta: + blockchain: flare + sector: dex + project: enosys + contributors: hosuke + config: + tags: [ 'flare', 'dex', 'trades', 'enosys', 'v2' ] + description: "Enosys V2 Flare base trades" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + + - name: enosys_v3_flare_base_trades + meta: + blockchain: flare + sector: dex + project: enosys + contributors: hosuke + config: + tags: [ 'flare', 'dex', 'trades', 'enosys', 'v3' ] + description: "Enosys V3 Flare base trades" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index diff --git a/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql new file mode 100644 index 00000000000..9bab098e9a4 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql @@ -0,0 +1,49 @@ +{{ config( + schema = 'dex_flare' + , alias = 'base_trades' + , materialized = 'view' + ) +}} + +{% set base_models = [ + ref('enosys_v2_flare_base_trades') + , ref('enosys_v3_flare_base_trades') +] %} + +WITH base_union AS ( + SELECT * + FROM ( + {% for base_model in base_models %} + SELECT + blockchain + , project + , version + , block_month + , block_date + , block_time + , block_number + , token_bought_amount_raw + , token_sold_amount_raw + , token_bought_address + , token_sold_address + , taker + , maker + , project_contract_address + , tx_hash + , evt_index + FROM + {{ base_model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} + ) +) + +{{ + add_tx_columns( + model_cte = 'base_union' + , blockchain = 'flare' + , columns = ['from', 'to', 'index'] + ) +}} diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql new file mode 100644 index 00000000000..9e8f8922ff5 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql @@ -0,0 +1,28 @@ +{{ config( + schema = 'enosys_v2_flare' + , alias = 'base_trades' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['tx_hash', 'evt_index'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +WITH dexs AS +( + {{ + uniswap_compatible_v2_trades( + blockchain = 'flare' + , project = 'enosys' + , version = '2' + , Pair_evt_Swap = source('enosys_flare', 'EnosysDexPair_evt_Swap') + , Factory_evt_PairCreated = source('enosys_flare', 'EnosysDexFactory_evt_PairCreated') + ) + }} +) + +SELECT + * +FROM + dexs diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v3_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v3_flare_base_trades.sql new file mode 100644 index 00000000000..6f88dd641b7 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v3_flare_base_trades.sql @@ -0,0 +1,28 @@ +{{ config( + schema = 'enosys_v3_flare' + , alias = 'base_trades' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['tx_hash', 'evt_index'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +WITH dexs AS +( + {{ + uniswap_compatible_v3_trades( + blockchain = 'flare' + , project = 'enosys' + , version = '3' + , Pool_evt_Swap = source('enosys_flare', 'EnosysDexV3Pool_evt_Swap') + , Factory_evt_PoolCreated = source('enosys_flare', 'EnosysDexV3Factory_evt_PoolCreated') + ) + }} +) + +SELECT + * +FROM + dexs diff --git a/sources/_sector/dex/trades/flare/_sources.yml b/sources/_sector/dex/trades/flare/_sources.yml new file mode 100644 index 00000000000..f24dd1060b4 --- /dev/null +++ b/sources/_sector/dex/trades/flare/_sources.yml @@ -0,0 +1,19 @@ +version: 2 + +sources: + - name: blazeswap_flare + tables: + - name: BlazeSwapFactory_evt_PairCreated + # - name: BlazeSwapPair_evt_Swap not existed yet + + - name: sparkdex_flare + tables: + - name: UniswapV3Factory_evt_PoolCreated + - name: UniswapV2Factory_evt_PairCreated + + - name: enosys_flare + tables: + - name: EnosysDexPair_evt_Swap + - name: EnosysDexFactory_evt_PairCreated + - name: EnosysDexV3Pool_evt_Swap + - name: EnosysDexV3Factory_evt_PoolCreated From ab4b6bcef0eb9343dd7c0b55db67b0e8666dd394 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Fri, 6 Dec 2024 00:28:45 +0800 Subject: [PATCH 15/45] Fix param --- .../trades/flare/platforms/enosys_v3_flare_base_trades.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v3_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v3_flare_base_trades.sql index 6f88dd641b7..8a698d71ed3 100644 --- a/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v3_flare_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v3_flare_base_trades.sql @@ -16,7 +16,7 @@ WITH dexs AS blockchain = 'flare' , project = 'enosys' , version = '3' - , Pool_evt_Swap = source('enosys_flare', 'EnosysDexV3Pool_evt_Swap') + , Pair_evt_Swap = source('enosys_flare', 'EnosysDexV3Pool_evt_Swap') , Factory_evt_PoolCreated = source('enosys_flare', 'EnosysDexV3Factory_evt_PoolCreated') ) }} From 0228adf93ada1a3c81f96cc008c85c80c316a369 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Mon, 9 Dec 2024 23:39:03 +0800 Subject: [PATCH 16/45] Update prices --- .../tokens/models/prices/flare/prices_flare_tokens.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql b/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql index 956f9317452..70a5836407c 100644 --- a/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql @@ -22,4 +22,6 @@ FROM , ('joule-kinetic', 'JOULE', 0xE6505f92583103AF7ed9974DEC451A7Af4e3A3bE, 18) , ('usdc.e-usd-coin.e', 'USDC.e', 0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6, 6) , ('usdt-tether', 'USDT', 0x0B38e83B86d491735fEaa0a791F65c2B99535396, 6) + , ('phili-inu', 'PHIL', 0x932E691aA8c8306C4bB0b19F3f00a284371be8Ba, 18) + , ('flare-inu', 'FINU', 0x2F8d7ff4f55D7B3E10D4910BeB38209291843B36, 18) ) as temp (token_id, symbol, contract_address, decimals) From 1e2864f9baa0c988d83b0a4d82c5a9b938a24b45 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Tue, 10 Dec 2024 21:09:27 +0800 Subject: [PATCH 17/45] Add flare dexes --- .../dex/models/trades/flare/_schema.yml | 45 +++++++++++++++++++ .../trades/flare/dex_flare_base_trades.sql | 3 ++ .../platforms/blazeswap_flare_base_trades.sql | 21 +++++++++ .../sparkdex_v2_flare_base_trades.sql | 21 +++++++++ .../sparkdex_v3_flare_base_trades.sql | 21 +++++++++ sources/_sector/dex/trades/flare/_sources.yml | 3 +- 6 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql create mode 100644 dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql create mode 100644 dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql diff --git a/dbt_subprojects/dex/models/trades/flare/_schema.yml b/dbt_subprojects/dex/models/trades/flare/_schema.yml index 041ccda17aa..6510187b061 100644 --- a/dbt_subprojects/dex/models/trades/flare/_schema.yml +++ b/dbt_subprojects/dex/models/trades/flare/_schema.yml @@ -76,3 +76,48 @@ models: combination_of_columns: - tx_hash - evt_index + + - name: sparkdex_v2_flare_base_trades + meta: + blockchain: flare + sector: dex + project: sparkdex + contributors: hosuke + config: + tags: ['flare', 'dex', 'trades', 'sparkdex', 'v2'] + description: "SparkDex (UniswapV2 fork) base trades on Flare" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + + - name: sparkdex_v3_flare_base_trades + meta: + blockchain: flare + sector: dex + project: sparkdex + contributors: hosuke + config: + tags: [ 'flare', 'dex', 'trades', 'sparkdex', 'v3' ] + description: "SparkDex (UniswapV3 fork) base trades on Flare" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + + - name: blazeswap_flare_base_trades + meta: + blockchain: flare + sector: dex + project: blazeswap + contributors: hosuke + config: + tags: [ 'flare', 'dex', 'trades', 'blazeswap' ] + description: "Blazeswap Flare base trades" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index \ No newline at end of file diff --git a/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql index 9bab098e9a4..bece6e4f012 100644 --- a/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql @@ -8,6 +8,9 @@ {% set base_models = [ ref('enosys_v2_flare_base_trades') , ref('enosys_v3_flare_base_trades') + , ref('sparkdex_v2_flare_base_trades') + , ref('sparkdex_v3_flare_base_trades') + , ref('blazeswap_flare_base_trades') ] %} WITH base_union AS ( diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql new file mode 100644 index 00000000000..20c6970801b --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'blazeswap_flare', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_v2_compatible_trades( + blockchain = 'flare', + project = 'blazeswap', + version = '2', + Pair_evt_Swap = source('blazeswap_flare', 'BlazeSwapPair_evt_Swap'), + Factory_evt_PairCreated = source('blazeswap_flare', 'BlazeSwapFactory_evt_PairCreated') + ) +}} diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql new file mode 100644 index 00000000000..bf93024a73e --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'sparkdex_v2_flare', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_v2_compatible_trades( + blockchain = 'flare', + project = 'sparkdex', + version = '2', + Pair_evt_Swap = source('sparkdex_flare', 'UniswapV2Pair_evt_Swap'), + Factory_evt_PairCreated = source('sparkdex_flare', 'UniswapV2Factory_evt_PairCreated') + ) +}} diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql new file mode 100644 index 00000000000..595fbd63de6 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'sparkdex_v3_flare', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_v3_compatible_trades( + blockchain = 'flare', + project = 'sparkdex', + version = '3', + Pool_evt_Swap = source('sparkdex_flare', 'UniswapV3Pool_evt_Swap'), + Factory_evt_PoolCreated = source('sparkdex_flare', 'UniswapV3Factory_evt_PoolCreated') + ) +}} diff --git a/sources/_sector/dex/trades/flare/_sources.yml b/sources/_sector/dex/trades/flare/_sources.yml index f24dd1060b4..eeeffbaf435 100644 --- a/sources/_sector/dex/trades/flare/_sources.yml +++ b/sources/_sector/dex/trades/flare/_sources.yml @@ -4,12 +4,13 @@ sources: - name: blazeswap_flare tables: - name: BlazeSwapFactory_evt_PairCreated - # - name: BlazeSwapPair_evt_Swap not existed yet + - name: BlazeSwapPair_evt_Swap - name: sparkdex_flare tables: - name: UniswapV3Factory_evt_PoolCreated - name: UniswapV2Factory_evt_PairCreated + - name: UniswapV3Pool_evt_Swap - name: enosys_flare tables: From dd4aa1fa7d2eaa64fd9e5d97b82969b1acc69dd1 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Tue, 10 Dec 2024 21:15:05 +0800 Subject: [PATCH 18/45] Add soruce --- sources/_sector/dex/trades/flare/_sources.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/_sector/dex/trades/flare/_sources.yml b/sources/_sector/dex/trades/flare/_sources.yml index eeeffbaf435..093b8d0c535 100644 --- a/sources/_sector/dex/trades/flare/_sources.yml +++ b/sources/_sector/dex/trades/flare/_sources.yml @@ -11,6 +11,7 @@ sources: - name: UniswapV3Factory_evt_PoolCreated - name: UniswapV2Factory_evt_PairCreated - name: UniswapV3Pool_evt_Swap + - name: UniswapV2Pair_evt_Swap - name: enosys_flare tables: From 7bad8d6803697a580d5a3539d6b9938431edabe3 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Tue, 10 Dec 2024 21:15:21 +0800 Subject: [PATCH 19/45] Update dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql --- .../tokens/models/prices/flare/prices_flare_tokens.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql b/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql index 70a5836407c..c9247273fd7 100644 --- a/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql @@ -22,6 +22,5 @@ FROM , ('joule-kinetic', 'JOULE', 0xE6505f92583103AF7ed9974DEC451A7Af4e3A3bE, 18) , ('usdc.e-usd-coin.e', 'USDC.e', 0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6, 6) , ('usdt-tether', 'USDT', 0x0B38e83B86d491735fEaa0a791F65c2B99535396, 6) - , ('phili-inu', 'PHIL', 0x932E691aA8c8306C4bB0b19F3f00a284371be8Ba, 18) , ('flare-inu', 'FINU', 0x2F8d7ff4f55D7B3E10D4910BeB38209291843B36, 18) ) as temp (token_id, symbol, contract_address, decimals) From c3eac5ea826657e15f3423d39524802d15cf46ad Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Tue, 10 Dec 2024 21:19:00 +0800 Subject: [PATCH 20/45] Fix macro name --- .../trades/flare/platforms/blazeswap_flare_base_trades.sql | 2 +- .../trades/flare/platforms/sparkdex_v2_flare_base_trades.sql | 2 +- .../trades/flare/platforms/sparkdex_v3_flare_base_trades.sql | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql index 20c6970801b..7884e48628e 100644 --- a/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql @@ -11,7 +11,7 @@ }} {{ - uniswap_v2_compatible_trades( + uniswap_compatible_v2_trades( blockchain = 'flare', project = 'blazeswap', version = '2', diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql index bf93024a73e..37719e144c7 100644 --- a/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql @@ -11,7 +11,7 @@ }} {{ - uniswap_v2_compatible_trades( + uniswap_compatible_v2_trades( blockchain = 'flare', project = 'sparkdex', version = '2', diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql index 595fbd63de6..164384eb7c0 100644 --- a/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql @@ -11,7 +11,7 @@ }} {{ - uniswap_v3_compatible_trades( + uniswap_compatible_v3_trades( blockchain = 'flare', project = 'sparkdex', version = '3', From c7afb8d504a424c77098e29280932455273f1d26 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Tue, 10 Dec 2024 21:26:09 +0800 Subject: [PATCH 21/45] Fix param --- .../flare/platforms/enosys_v2_flare_base_trades.sql | 12 ++---------- .../flare/platforms/enosys_v3_flare_base_trades.sql | 12 ++---------- .../platforms/sparkdex_v3_flare_base_trades.sql | 2 +- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql index 9e8f8922ff5..aa0a58525f9 100644 --- a/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql @@ -9,9 +9,7 @@ ) }} -WITH dexs AS -( - {{ +{{ uniswap_compatible_v2_trades( blockchain = 'flare' , project = 'enosys' @@ -19,10 +17,4 @@ WITH dexs AS , Pair_evt_Swap = source('enosys_flare', 'EnosysDexPair_evt_Swap') , Factory_evt_PairCreated = source('enosys_flare', 'EnosysDexFactory_evt_PairCreated') ) - }} -) - -SELECT - * -FROM - dexs +}} \ No newline at end of file diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v3_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v3_flare_base_trades.sql index 8a698d71ed3..0c2110dbe0d 100644 --- a/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v3_flare_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v3_flare_base_trades.sql @@ -9,9 +9,7 @@ ) }} -WITH dexs AS -( - {{ +{{ uniswap_compatible_v3_trades( blockchain = 'flare' , project = 'enosys' @@ -19,10 +17,4 @@ WITH dexs AS , Pair_evt_Swap = source('enosys_flare', 'EnosysDexV3Pool_evt_Swap') , Factory_evt_PoolCreated = source('enosys_flare', 'EnosysDexV3Factory_evt_PoolCreated') ) - }} -) - -SELECT - * -FROM - dexs +}} \ No newline at end of file diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql index 164384eb7c0..becc5cda95b 100644 --- a/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql @@ -15,7 +15,7 @@ blockchain = 'flare', project = 'sparkdex', version = '3', - Pool_evt_Swap = source('sparkdex_flare', 'UniswapV3Pool_evt_Swap'), + Pair_evt_Swap = source('sparkdex_flare', 'UniswapV3Pool_evt_Swap'), Factory_evt_PoolCreated = source('sparkdex_flare', 'UniswapV3Factory_evt_PoolCreated') ) }} From b962d91328e91c0bb8e18c3e0630291b5a568516 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Tue, 10 Dec 2024 21:35:40 +0800 Subject: [PATCH 22/45] Remove blazeswap as source not available yet --- .../dex/models/trades/flare/_schema.yml | 15 ------------- .../trades/flare/dex_flare_base_trades.sql | 1 - .../platforms/blazeswap_flare_base_trades.sql | 21 ------------------- sources/_sector/dex/trades/flare/_sources.yml | 2 +- 4 files changed, 1 insertion(+), 38 deletions(-) delete mode 100644 dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql diff --git a/dbt_subprojects/dex/models/trades/flare/_schema.yml b/dbt_subprojects/dex/models/trades/flare/_schema.yml index 6510187b061..bb73d132a9c 100644 --- a/dbt_subprojects/dex/models/trades/flare/_schema.yml +++ b/dbt_subprojects/dex/models/trades/flare/_schema.yml @@ -106,18 +106,3 @@ models: combination_of_columns: - tx_hash - evt_index - - - name: blazeswap_flare_base_trades - meta: - blockchain: flare - sector: dex - project: blazeswap - contributors: hosuke - config: - tags: [ 'flare', 'dex', 'trades', 'blazeswap' ] - description: "Blazeswap Flare base trades" - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - evt_index \ No newline at end of file diff --git a/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql index bece6e4f012..93bfb8a581d 100644 --- a/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql @@ -10,7 +10,6 @@ , ref('enosys_v3_flare_base_trades') , ref('sparkdex_v2_flare_base_trades') , ref('sparkdex_v3_flare_base_trades') - , ref('blazeswap_flare_base_trades') ] %} WITH base_union AS ( diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql deleted file mode 100644 index 7884e48628e..00000000000 --- a/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql +++ /dev/null @@ -1,21 +0,0 @@ -{{ - config( - schema = 'blazeswap_flare', - alias = 'base_trades', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['tx_hash', 'evt_index'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] - ) -}} - -{{ - uniswap_compatible_v2_trades( - blockchain = 'flare', - project = 'blazeswap', - version = '2', - Pair_evt_Swap = source('blazeswap_flare', 'BlazeSwapPair_evt_Swap'), - Factory_evt_PairCreated = source('blazeswap_flare', 'BlazeSwapFactory_evt_PairCreated') - ) -}} diff --git a/sources/_sector/dex/trades/flare/_sources.yml b/sources/_sector/dex/trades/flare/_sources.yml index 093b8d0c535..c892f1fb475 100644 --- a/sources/_sector/dex/trades/flare/_sources.yml +++ b/sources/_sector/dex/trades/flare/_sources.yml @@ -4,7 +4,7 @@ sources: - name: blazeswap_flare tables: - name: BlazeSwapFactory_evt_PairCreated - - name: BlazeSwapPair_evt_Swap +# - name: BlazeSwapPair_evt_Swap - name: sparkdex_flare tables: From 4f90e63d983f74799fa8b75cb461fc30a385f8f4 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Tue, 10 Dec 2024 21:45:04 +0800 Subject: [PATCH 23/45] Update dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql --- .../tokens/models/prices/flare/prices_flare_tokens.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql b/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql index c9247273fd7..956f9317452 100644 --- a/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/flare/prices_flare_tokens.sql @@ -22,5 +22,4 @@ FROM , ('joule-kinetic', 'JOULE', 0xE6505f92583103AF7ed9974DEC451A7Af4e3A3bE, 18) , ('usdc.e-usd-coin.e', 'USDC.e', 0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6, 6) , ('usdt-tether', 'USDT', 0x0B38e83B86d491735fEaa0a791F65c2B99535396, 6) - , ('flare-inu', 'FINU', 0x2F8d7ff4f55D7B3E10D4910BeB38209291843B36, 18) ) as temp (token_id, symbol, contract_address, decimals) From d8ea547080f015b3f912ef2301891c0c1cf773a7 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Tue, 10 Dec 2024 21:49:26 +0800 Subject: [PATCH 24/45] Remove sparkdex_v2 as source not available yet --- .../dex/models/trades/flare/_schema.yml | 15 ------------- .../trades/flare/dex_flare_base_trades.sql | 1 - .../sparkdex_v2_flare_base_trades.sql | 21 ------------------- sources/_sector/dex/trades/flare/_sources.yml | 2 +- 4 files changed, 1 insertion(+), 38 deletions(-) delete mode 100644 dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql diff --git a/dbt_subprojects/dex/models/trades/flare/_schema.yml b/dbt_subprojects/dex/models/trades/flare/_schema.yml index bb73d132a9c..818d868ede2 100644 --- a/dbt_subprojects/dex/models/trades/flare/_schema.yml +++ b/dbt_subprojects/dex/models/trades/flare/_schema.yml @@ -77,21 +77,6 @@ models: - tx_hash - evt_index - - name: sparkdex_v2_flare_base_trades - meta: - blockchain: flare - sector: dex - project: sparkdex - contributors: hosuke - config: - tags: ['flare', 'dex', 'trades', 'sparkdex', 'v2'] - description: "SparkDex (UniswapV2 fork) base trades on Flare" - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - evt_index - - name: sparkdex_v3_flare_base_trades meta: blockchain: flare diff --git a/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql index 93bfb8a581d..2cf8156f312 100644 --- a/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql @@ -8,7 +8,6 @@ {% set base_models = [ ref('enosys_v2_flare_base_trades') , ref('enosys_v3_flare_base_trades') - , ref('sparkdex_v2_flare_base_trades') , ref('sparkdex_v3_flare_base_trades') ] %} diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql deleted file mode 100644 index 37719e144c7..00000000000 --- a/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql +++ /dev/null @@ -1,21 +0,0 @@ -{{ - config( - schema = 'sparkdex_v2_flare', - alias = 'base_trades', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['tx_hash', 'evt_index'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] - ) -}} - -{{ - uniswap_compatible_v2_trades( - blockchain = 'flare', - project = 'sparkdex', - version = '2', - Pair_evt_Swap = source('sparkdex_flare', 'UniswapV2Pair_evt_Swap'), - Factory_evt_PairCreated = source('sparkdex_flare', 'UniswapV2Factory_evt_PairCreated') - ) -}} diff --git a/sources/_sector/dex/trades/flare/_sources.yml b/sources/_sector/dex/trades/flare/_sources.yml index c892f1fb475..d1f25fa9f66 100644 --- a/sources/_sector/dex/trades/flare/_sources.yml +++ b/sources/_sector/dex/trades/flare/_sources.yml @@ -11,7 +11,7 @@ sources: - name: UniswapV3Factory_evt_PoolCreated - name: UniswapV2Factory_evt_PairCreated - name: UniswapV3Pool_evt_Swap - - name: UniswapV2Pair_evt_Swap +# - name: UniswapV2Pair_evt_Swap - name: enosys_flare tables: From 971bfa1819fb0c0126572067b3130454f4e29bb2 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Tue, 10 Dec 2024 22:11:58 +0800 Subject: [PATCH 25/45] Add sparkdex into dex.info --- dbt_subprojects/dex/models/dex_info.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/dbt_subprojects/dex/models/dex_info.sql b/dbt_subprojects/dex/models/dex_info.sql index ba4dd6586d7..f683ac47f22 100644 --- a/dbt_subprojects/dex/models/dex_info.sql +++ b/dbt_subprojects/dex/models/dex_info.sql @@ -189,4 +189,5 @@ FROM (VALUES , ('stablebase', 'StableBase', 'Direct', 'stablebasefi') , ('flashliquidity', 'Flashliquidity', 'Direct', 'flashliquidity') , ('akronswap', 'Akronswap', 'Direct', 'AkronFinance') + , ('sparkdex', 'SparkDEX', 'Direct', 'SparkDexAI') ) AS temp_table (project, name, marketplace_type, x_username) From 74b7ac63d2209dc8fa838f571e2c154ca501db0c Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Tue, 10 Dec 2024 22:15:56 +0800 Subject: [PATCH 26/45] Add sparkdex seed --- .../dex/models/trades/flare/_schema.yml | 4 ++++ dbt_subprojects/dex/seeds/trades/_schema.yml | 15 +++++++++++++++ .../trades/sparkdex_flare_base_trades_seed.csv | 3 +++ 3 files changed, 22 insertions(+) create mode 100644 dbt_subprojects/dex/seeds/trades/sparkdex_flare_base_trades_seed.csv diff --git a/dbt_subprojects/dex/models/trades/flare/_schema.yml b/dbt_subprojects/dex/models/trades/flare/_schema.yml index 818d868ede2..53d505f237f 100644 --- a/dbt_subprojects/dex/models/trades/flare/_schema.yml +++ b/dbt_subprojects/dex/models/trades/flare/_schema.yml @@ -91,3 +91,7 @@ models: combination_of_columns: - tx_hash - evt_index + - check_dex_base_trades_seed: + seed_file: ref('sparkdex_flare_base_trades_seed') + filter: + version: 3 diff --git a/dbt_subprojects/dex/seeds/trades/_schema.yml b/dbt_subprojects/dex/seeds/trades/_schema.yml index fb61bd5db94..baabb217d7a 100644 --- a/dbt_subprojects/dex/seeds/trades/_schema.yml +++ b/dbt_subprojects/dex/seeds/trades/_schema.yml @@ -4514,3 +4514,18 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp + + - name: sparkdex_flare_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp \ No newline at end of file diff --git a/dbt_subprojects/dex/seeds/trades/sparkdex_flare_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/sparkdex_flare_base_trades_seed.csv new file mode 100644 index 00000000000..e11b6bde1d9 --- /dev/null +++ b/dbt_subprojects/dex/seeds/trades/sparkdex_flare_base_trades_seed.csv @@ -0,0 +1,3 @@ +blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw +flare,sparkdex,3,2024-12-04,0x2e172e22c714f28e9e8f29a89799ec5102397e29926a070a2bd11f92637106a3,10,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,0xfbda5f676cb37624f28265a144a48b0d6e87d3b6,34014169,4999999985390174801119,166057407 +flare,sparkdex,3,2024-10-29,0x2e29ac0d54b4bd75c4788a285a9806ea57ed801b4c931a877b2a17aeaa3dafff,10,0xfbda5f676cb37624f28265a144a48b0d6e87d3b6,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,32113089,4955860,353988522618423672831 \ No newline at end of file From 0aabb40ed039687e28fe4f7a81f436bbdc5635c9 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Wed, 11 Dec 2024 15:45:42 +0800 Subject: [PATCH 27/45] Revert "Remove sparkdex_v2 as source not available yet" This reverts commit d8ea547080f015b3f912ef2301891c0c1cf773a7. --- .../dex/models/trades/flare/_schema.yml | 15 +++++++++++++ .../trades/flare/dex_flare_base_trades.sql | 1 + .../sparkdex_v2_flare_base_trades.sql | 21 +++++++++++++++++++ sources/_sector/dex/trades/flare/_sources.yml | 2 +- 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql diff --git a/dbt_subprojects/dex/models/trades/flare/_schema.yml b/dbt_subprojects/dex/models/trades/flare/_schema.yml index 53d505f237f..0eb96257524 100644 --- a/dbt_subprojects/dex/models/trades/flare/_schema.yml +++ b/dbt_subprojects/dex/models/trades/flare/_schema.yml @@ -77,6 +77,21 @@ models: - tx_hash - evt_index + - name: sparkdex_v2_flare_base_trades + meta: + blockchain: flare + sector: dex + project: sparkdex + contributors: hosuke + config: + tags: ['flare', 'dex', 'trades', 'sparkdex', 'v2'] + description: "SparkDex (UniswapV2 fork) base trades on Flare" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - name: sparkdex_v3_flare_base_trades meta: blockchain: flare diff --git a/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql index 2cf8156f312..93bfb8a581d 100644 --- a/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql @@ -8,6 +8,7 @@ {% set base_models = [ ref('enosys_v2_flare_base_trades') , ref('enosys_v3_flare_base_trades') + , ref('sparkdex_v2_flare_base_trades') , ref('sparkdex_v3_flare_base_trades') ] %} diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql new file mode 100644 index 00000000000..37719e144c7 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'sparkdex_v2_flare', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_compatible_v2_trades( + blockchain = 'flare', + project = 'sparkdex', + version = '2', + Pair_evt_Swap = source('sparkdex_flare', 'UniswapV2Pair_evt_Swap'), + Factory_evt_PairCreated = source('sparkdex_flare', 'UniswapV2Factory_evt_PairCreated') + ) +}} diff --git a/sources/_sector/dex/trades/flare/_sources.yml b/sources/_sector/dex/trades/flare/_sources.yml index d1f25fa9f66..c892f1fb475 100644 --- a/sources/_sector/dex/trades/flare/_sources.yml +++ b/sources/_sector/dex/trades/flare/_sources.yml @@ -11,7 +11,7 @@ sources: - name: UniswapV3Factory_evt_PoolCreated - name: UniswapV2Factory_evt_PairCreated - name: UniswapV3Pool_evt_Swap -# - name: UniswapV2Pair_evt_Swap + - name: UniswapV2Pair_evt_Swap - name: enosys_flare tables: From c11c6badb424c7d71b841f33a7278ddc89f0f664 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Wed, 11 Dec 2024 15:48:15 +0800 Subject: [PATCH 28/45] Revert "Remove blazeswap as source not available yet" This reverts commit b962d91328e91c0bb8e18c3e0630291b5a568516. --- .../dex/models/trades/flare/_schema.yml | 15 +++++++++++++ .../trades/flare/dex_flare_base_trades.sql | 1 + .../platforms/blazeswap_flare_base_trades.sql | 21 +++++++++++++++++++ sources/_sector/dex/trades/flare/_sources.yml | 2 +- 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql diff --git a/dbt_subprojects/dex/models/trades/flare/_schema.yml b/dbt_subprojects/dex/models/trades/flare/_schema.yml index 0eb96257524..23efc6cd370 100644 --- a/dbt_subprojects/dex/models/trades/flare/_schema.yml +++ b/dbt_subprojects/dex/models/trades/flare/_schema.yml @@ -110,3 +110,18 @@ models: seed_file: ref('sparkdex_flare_base_trades_seed') filter: version: 3 + + - name: blazeswap_flare_base_trades + meta: + blockchain: flare + sector: dex + project: blazeswap + contributors: hosuke + config: + tags: [ 'flare', 'dex', 'trades', 'blazeswap' ] + description: "Blazeswap Flare base trades" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index \ No newline at end of file diff --git a/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql index 93bfb8a581d..bece6e4f012 100644 --- a/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql @@ -10,6 +10,7 @@ , ref('enosys_v3_flare_base_trades') , ref('sparkdex_v2_flare_base_trades') , ref('sparkdex_v3_flare_base_trades') + , ref('blazeswap_flare_base_trades') ] %} WITH base_union AS ( diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql new file mode 100644 index 00000000000..7884e48628e --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'blazeswap_flare', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_compatible_v2_trades( + blockchain = 'flare', + project = 'blazeswap', + version = '2', + Pair_evt_Swap = source('blazeswap_flare', 'BlazeSwapPair_evt_Swap'), + Factory_evt_PairCreated = source('blazeswap_flare', 'BlazeSwapFactory_evt_PairCreated') + ) +}} diff --git a/sources/_sector/dex/trades/flare/_sources.yml b/sources/_sector/dex/trades/flare/_sources.yml index c892f1fb475..093b8d0c535 100644 --- a/sources/_sector/dex/trades/flare/_sources.yml +++ b/sources/_sector/dex/trades/flare/_sources.yml @@ -4,7 +4,7 @@ sources: - name: blazeswap_flare tables: - name: BlazeSwapFactory_evt_PairCreated -# - name: BlazeSwapPair_evt_Swap + - name: BlazeSwapPair_evt_Swap - name: sparkdex_flare tables: From 66f1266071f617e90538d94b246d5b72434f0ad9 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Mon, 16 Dec 2024 21:39:23 +0800 Subject: [PATCH 29/45] Update sources/_sector/dex/trades/flare/_sources.yml --- sources/_sector/dex/trades/flare/_sources.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/_sector/dex/trades/flare/_sources.yml b/sources/_sector/dex/trades/flare/_sources.yml index 093b8d0c535..103d2486a67 100644 --- a/sources/_sector/dex/trades/flare/_sources.yml +++ b/sources/_sector/dex/trades/flare/_sources.yml @@ -4,7 +4,7 @@ sources: - name: blazeswap_flare tables: - name: BlazeSwapFactory_evt_PairCreated - - name: BlazeSwapPair_evt_Swap + - name: BLAZE_LP_evt_Swap - name: sparkdex_flare tables: From c329da29fba42c472ed8345312c42348ccfdbd73 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Mon, 16 Dec 2024 22:06:59 +0800 Subject: [PATCH 30/45] Update blazeswap_flare_base_trades --- .../trades/flare/platforms/blazeswap_flare_base_trades.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql index 7884e48628e..d2743688085 100644 --- a/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql @@ -15,7 +15,7 @@ blockchain = 'flare', project = 'blazeswap', version = '2', - Pair_evt_Swap = source('blazeswap_flare', 'BlazeSwapPair_evt_Swap'), + Pair_evt_Swap = source('blazeswap_flare', 'BLAZE_LP_evt_Swap'), Factory_evt_PairCreated = source('blazeswap_flare', 'BlazeSwapFactory_evt_PairCreated') ) }} From 19c8ff8f274d7b4a58c70d369f09d07b095969a2 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Mon, 16 Dec 2024 22:09:31 +0800 Subject: [PATCH 31/45] Add test for blazeswap --- .../dex/models/trades/flare/_schema.yml | 4 +++- dbt_subprojects/dex/seeds/trades/_schema.yml | 15 +++++++++++++++ .../trades/blazeswap_flare_base_trades_seed.csv | 3 +++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 dbt_subprojects/dex/seeds/trades/blazeswap_flare_base_trades_seed.csv diff --git a/dbt_subprojects/dex/models/trades/flare/_schema.yml b/dbt_subprojects/dex/models/trades/flare/_schema.yml index 23efc6cd370..34a0c49b92b 100644 --- a/dbt_subprojects/dex/models/trades/flare/_schema.yml +++ b/dbt_subprojects/dex/models/trades/flare/_schema.yml @@ -124,4 +124,6 @@ models: - dbt_utils.unique_combination_of_columns: combination_of_columns: - tx_hash - - evt_index \ No newline at end of file + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('blazeswap_flare_base_trades_seed') \ No newline at end of file diff --git a/dbt_subprojects/dex/seeds/trades/_schema.yml b/dbt_subprojects/dex/seeds/trades/_schema.yml index db9a328b039..4180927a96f 100644 --- a/dbt_subprojects/dex/seeds/trades/_schema.yml +++ b/dbt_subprojects/dex/seeds/trades/_schema.yml @@ -4604,3 +4604,18 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp + + - name: blazeswap_flare_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp diff --git a/dbt_subprojects/dex/seeds/trades/blazeswap_flare_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/blazeswap_flare_base_trades_seed.csv new file mode 100644 index 00000000000..f940476b700 --- /dev/null +++ b/dbt_subprojects/dex/seeds/trades/blazeswap_flare_base_trades_seed.csv @@ -0,0 +1,3 @@ +blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw +flare,blazeswap,2,2024-10-06,0x51407c99b67d71815b993420f8811900b5865cb673ba893ef07dcca5f85aa06d,30,0xe6505f92583103af7ed9974dec451a7af4e3a3be,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,30881152,1335216349117423088152,5497558138880000000000 +flare,blazeswap,2,2024-10-17,0x55de50c11e29636db85763b75c25a2b718dc18b4fe2c37539e5f324ac52e6e24,30,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,0xe6505f92583103af7ed9974dec451a7af4e3a3be,31449410,105931708336615473057,44371879946728776388 From 3b93c797f42d6cab2055b47ebe37f712b989125b Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Fri, 20 Dec 2024 00:49:21 +0800 Subject: [PATCH 32/45] Update sources/_sector/dex/trades/flare/_sources.yml --- sources/_sector/dex/trades/flare/_sources.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/_sector/dex/trades/flare/_sources.yml b/sources/_sector/dex/trades/flare/_sources.yml index 103d2486a67..8053f5bbd24 100644 --- a/sources/_sector/dex/trades/flare/_sources.yml +++ b/sources/_sector/dex/trades/flare/_sources.yml @@ -11,7 +11,7 @@ sources: - name: UniswapV3Factory_evt_PoolCreated - name: UniswapV2Factory_evt_PairCreated - name: UniswapV3Pool_evt_Swap - - name: UniswapV2Pair_evt_Swap + - name: UniswapV2Pool_evt_Swap - name: enosys_flare tables: From 5cb7a4cf40cb079f3fab69baa8738123a27b907b Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Fri, 20 Dec 2024 00:49:51 +0800 Subject: [PATCH 33/45] Update dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql --- .../trades/flare/platforms/sparkdex_v2_flare_base_trades.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql index 37719e144c7..852be76b246 100644 --- a/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql @@ -15,7 +15,7 @@ blockchain = 'flare', project = 'sparkdex', version = '2', - Pair_evt_Swap = source('sparkdex_flare', 'UniswapV2Pair_evt_Swap'), + Pair_evt_Swap = source('sparkdex_flare', 'UniswapV2Pool_evt_Swap'), Factory_evt_PairCreated = source('sparkdex_flare', 'UniswapV2Factory_evt_PairCreated') ) }} From 96dabd3675416f38354f2b645f39da2bcd2cc7dc Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Fri, 20 Dec 2024 01:05:34 +0800 Subject: [PATCH 34/45] Refresh schema --- .../dex/models/trades/flare/_schema.yml | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/dbt_subprojects/dex/models/trades/flare/_schema.yml b/dbt_subprojects/dex/models/trades/flare/_schema.yml index 34a0c49b92b..9ab947a3e71 100644 --- a/dbt_subprojects/dex/models/trades/flare/_schema.yml +++ b/dbt_subprojects/dex/models/trades/flare/_schema.yml @@ -11,39 +11,6 @@ models: tags: ['flare', 'dex', 'trades'] description: > Flare DEX trades - columns: - - name: blockchain - description: "Blockchain" - - name: project - description: "Project name of the DEX" - - name: version - description: "Version of the DEX protocol" - - name: block_month - description: "UTC event block month" - - name: block_date - description: "UTC event block date" - - name: block_time - description: "UTC event block time" - - name: block_number - description: "Block number" - - name: token_bought_amount_raw - description: "Raw amount of token bought (not normalized)" - - name: token_sold_amount_raw - description: "Raw amount of token sold (not normalized)" - - name: token_bought_address - description: "Contract address of the token bought" - - name: token_sold_address - description: "Contract address of the token sold" - - name: taker - description: "Address of trader who initiated the trade" - - name: maker - description: "Address of trader who provided liquidity" - - name: project_contract_address - description: "Project's contract address that executed the trade" - - name: tx_hash - description: "Transaction hash" - - name: evt_index - description: "Event index" data_tests: - check_dex_info_relationship From f405830d19215b57acfba497bf7ed2b55727ec7c Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Fri, 20 Dec 2024 01:09:42 +0800 Subject: [PATCH 35/45] Try to fix bug --- sources/_base_sources/other/ton_base_sources.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/_base_sources/other/ton_base_sources.yml b/sources/_base_sources/other/ton_base_sources.yml index 55770d278b7..e63917e4c1b 100644 --- a/sources/_base_sources/other/ton_base_sources.yml +++ b/sources/_base_sources/other/ton_base_sources.yml @@ -13,13 +13,13 @@ sources: columns: - name: block_time description: "Block timestamp" - tests: + data_tests: - not_null data_type: timestamp - name: block_date description: "Block date" - tests: + data_tests: - not_null data_type: date From 7da828490810f6293f8bbe8ef1eb8831d9683730 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Fri, 20 Dec 2024 01:17:07 +0800 Subject: [PATCH 36/45] Add seeds --- dbt_subprojects/dex/models/trades/flare/_schema.yml | 4 ++++ .../dex/seeds/trades/sparkdex_flare_base_trades_seed.csv | 2 ++ 2 files changed, 6 insertions(+) diff --git a/dbt_subprojects/dex/models/trades/flare/_schema.yml b/dbt_subprojects/dex/models/trades/flare/_schema.yml index 9ab947a3e71..921ed439b2f 100644 --- a/dbt_subprojects/dex/models/trades/flare/_schema.yml +++ b/dbt_subprojects/dex/models/trades/flare/_schema.yml @@ -58,6 +58,10 @@ models: combination_of_columns: - tx_hash - evt_index + - check_dex_base_trades_seed: + seed_file: ref('sparkdex_flare_base_trades_seed') + filter: + version: 2 - name: sparkdex_v3_flare_base_trades meta: diff --git a/dbt_subprojects/dex/seeds/trades/sparkdex_flare_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/sparkdex_flare_base_trades_seed.csv index e11b6bde1d9..67298b2d4ad 100644 --- a/dbt_subprojects/dex/seeds/trades/sparkdex_flare_base_trades_seed.csv +++ b/dbt_subprojects/dex/seeds/trades/sparkdex_flare_base_trades_seed.csv @@ -1,3 +1,5 @@ blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw +flare,sparkdex,2,2024-12-19,0x17b97c773299bb5432f7513ec1090b7182326dc6e8a8a772bbcc14639e2e5e74,16,0xfbda5f676cb37624f28265a144a48b0d6e87d3b6,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,34744392,164250,5873468685772181578 +flare,sparkdex,2,2024-12-19,0xe1ac5909a57022912a5853ccb70e2de4604eae3c6dd3483fc719338cf18a0625,23,0xfbda5f676cb37624f28265a144a48b0d6e87d3b6,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,34747482,658,24000000000000000 flare,sparkdex,3,2024-12-04,0x2e172e22c714f28e9e8f29a89799ec5102397e29926a070a2bd11f92637106a3,10,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,0xfbda5f676cb37624f28265a144a48b0d6e87d3b6,34014169,4999999985390174801119,166057407 flare,sparkdex,3,2024-10-29,0x2e29ac0d54b4bd75c4788a285a9806ea57ed801b4c931a877b2a17aeaa3dafff,10,0xfbda5f676cb37624f28265a144a48b0d6e87d3b6,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,32113089,4955860,353988522618423672831 \ No newline at end of file From d9215085d6dee05834e6184888a231fc2a50b25f Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Fri, 20 Dec 2024 01:18:28 +0800 Subject: [PATCH 37/45] Add flare --- dbt_subprojects/dex/models/trades/_schema.yml | 2 +- dbt_subprojects/dex/models/trades/dex_base_trades.sql | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dbt_subprojects/dex/models/trades/_schema.yml b/dbt_subprojects/dex/models/trades/_schema.yml index c913109f5c5..5e979f561b3 100644 --- a/dbt_subprojects/dex/models/trades/_schema.yml +++ b/dbt_subprojects/dex/models/trades/_schema.yml @@ -4,7 +4,7 @@ models: - name: dex_trades meta: docs_slug: /curated/trading/DEX/dex-trades - blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, kaia, optimism, polygon, scroll, zksync, linea, blast, sei, ronin + blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, kaia, optimism, polygon, scroll, zksync, linea, blast, sei, ronin, flare sector: dex short_description: The `dex.trades` table captures detailed data on trades executed via decentralized exchanges (DEXs). This table contains a detailed breakdown of trade execution containing one or many trades per transaction. contributors: 0xRob, hosuke, jeff-dude, tomfutago diff --git a/dbt_subprojects/dex/models/trades/dex_base_trades.sql b/dbt_subprojects/dex/models/trades/dex_base_trades.sql index 6a5a68bb734..f39d30c5f98 100644 --- a/dbt_subprojects/dex/models/trades/dex_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/dex_base_trades.sql @@ -33,6 +33,7 @@ , ref('dex_zkevm_base_trades') , ref('dex_zksync_base_trades') , ref('dex_zora_base_trades') + , ref('dex_flare_base_trades') ] %} with base_union as ( From a96833d33d7d4b5b2f63257c3ed103b2c2f2e995 Mon Sep 17 00:00:00 2001 From: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Date: Thu, 2 Jan 2025 16:20:18 -0500 Subject: [PATCH 38/45] update enosys v2 source --- sources/_sector/dex/trades/flare/_sources.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/_sector/dex/trades/flare/_sources.yml b/sources/_sector/dex/trades/flare/_sources.yml index 8053f5bbd24..5052c204fd3 100644 --- a/sources/_sector/dex/trades/flare/_sources.yml +++ b/sources/_sector/dex/trades/flare/_sources.yml @@ -15,7 +15,7 @@ sources: - name: enosys_flare tables: - - name: EnosysDexPair_evt_Swap + - name: EnosysPair_evt_Swap - name: EnosysDexFactory_evt_PairCreated - name: EnosysDexV3Pool_evt_Swap - name: EnosysDexV3Factory_evt_PoolCreated From d07a4870ef6a193bf3bc63c1f14ae861aa23e57e Mon Sep 17 00:00:00 2001 From: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Date: Thu, 2 Jan 2025 16:20:29 -0500 Subject: [PATCH 39/45] update enosys v2 source --- .../trades/flare/platforms/enosys_v2_flare_base_trades.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql index aa0a58525f9..680557edfbb 100644 --- a/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql @@ -14,7 +14,7 @@ blockchain = 'flare' , project = 'enosys' , version = '2' - , Pair_evt_Swap = source('enosys_flare', 'EnosysDexPair_evt_Swap') + , Pair_evt_Swap = source('enosys_flare', 'EnosysPair_evt_Swap') , Factory_evt_PairCreated = source('enosys_flare', 'EnosysDexFactory_evt_PairCreated') ) }} \ No newline at end of file From cdaea1edbccb3588dba03dc2bbc8437accbf93f3 Mon Sep 17 00:00:00 2001 From: jeff-dude <102681548+jeff-dude@users.noreply.github.com> Date: Thu, 2 Jan 2025 16:45:32 -0500 Subject: [PATCH 40/45] add all projects to dex info --- dbt_subprojects/dex/models/dex_info.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbt_subprojects/dex/models/dex_info.sql b/dbt_subprojects/dex/models/dex_info.sql index ed5c3f1f26d..f8bef38bdae 100644 --- a/dbt_subprojects/dex/models/dex_info.sql +++ b/dbt_subprojects/dex/models/dex_info.sql @@ -195,6 +195,8 @@ FROM (VALUES , ('bridgers', 'Bridgers', 'Direct', 'Bridgersxyz') , ('levinswap', 'Levinswap', 'Direct', 'levinswap') , ('sparkdex', 'SparkDEX', 'Direct', 'SparkDexAI') + , ('blazeswap', 'BlazeSwap', 'Direct', 'blazeswapdex') + , ('enosys', 'Enosys', 'Direct', 'enosys_global') , ('gravity_finance', 'GravityFinance', 'Direct', 'Gravity_Finance') , ('fluid', 'Fluid DEX', 'Direct', '0xfluid') ) AS temp_table (project, name, marketplace_type, x_username) From 90f0256dba7e2415e184d10f61091589aeb14c7b Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Sun, 5 Jan 2025 01:31:43 +0800 Subject: [PATCH 41/45] Update dbt_subprojects/dex/models/trades/dex_base_trades.sql --- dbt_subprojects/dex/models/trades/dex_base_trades.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/dbt_subprojects/dex/models/trades/dex_base_trades.sql b/dbt_subprojects/dex/models/trades/dex_base_trades.sql index f39d30c5f98..6a5a68bb734 100644 --- a/dbt_subprojects/dex/models/trades/dex_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/dex_base_trades.sql @@ -33,7 +33,6 @@ , ref('dex_zkevm_base_trades') , ref('dex_zksync_base_trades') , ref('dex_zora_base_trades') - , ref('dex_flare_base_trades') ] %} with base_union as ( From e72e6988b53aad3e319a164b8aa654957026441e Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Sun, 5 Jan 2025 03:39:38 +0800 Subject: [PATCH 42/45] Update dbt_subprojects/dex/models/trades/_schema.yml --- dbt_subprojects/dex/models/trades/_schema.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt_subprojects/dex/models/trades/_schema.yml b/dbt_subprojects/dex/models/trades/_schema.yml index 450e3bf5741..cb10cfb6b1d 100644 --- a/dbt_subprojects/dex/models/trades/_schema.yml +++ b/dbt_subprojects/dex/models/trades/_schema.yml @@ -4,7 +4,7 @@ models: - name: dex_trades meta: docs_slug: /curated/trading/DEX/dex-trades - blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, kaia, optimism, polygon, scroll, zksync, linea, blast, sei, ronin, flare + blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, kaia, optimism, polygon, scroll, zksync, linea, blast, sei, ronin sector: dex short_description: The `dex.trades` table captures detailed data on trades executed via decentralized exchanges (DEXs). This table contains a detailed breakdown of trade execution containing one or many trades per transaction. contributors: 0xRob, hosuke, jeff-dude, tomfutago, viniabussafi From 9224dac6fc3b8007a1a7e45cf71b5cca8421c09f Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Mon, 6 Jan 2025 23:51:24 +0800 Subject: [PATCH 43/45] Revert "Update dbt_subprojects/dex/models/trades/dex_base_trades.sql" This reverts commit 90f0256dba7e2415e184d10f61091589aeb14c7b. --- dbt_subprojects/dex/models/trades/dex_base_trades.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/dbt_subprojects/dex/models/trades/dex_base_trades.sql b/dbt_subprojects/dex/models/trades/dex_base_trades.sql index 6a5a68bb734..f39d30c5f98 100644 --- a/dbt_subprojects/dex/models/trades/dex_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/dex_base_trades.sql @@ -33,6 +33,7 @@ , ref('dex_zkevm_base_trades') , ref('dex_zksync_base_trades') , ref('dex_zora_base_trades') + , ref('dex_flare_base_trades') ] %} with base_union as ( From e5b5a095128ad5dd7ea7b2bf5546c172117200c2 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Mon, 6 Jan 2025 23:53:47 +0800 Subject: [PATCH 44/45] feat(dex/flare): remove enosys v3 trades - Remove enosys v3 model and its references - Keep enosys v2, sparkdex v2/v3, and blazeswap in flare trades --- .../dex/models/trades/flare/_schema.yml | 15 -------------- .../trades/flare/dex_flare_base_trades.sql | 1 - .../platforms/enosys_v3_flare_base_trades.sql | 20 ------------------- 3 files changed, 36 deletions(-) delete mode 100644 dbt_subprojects/dex/models/trades/flare/platforms/enosys_v3_flare_base_trades.sql diff --git a/dbt_subprojects/dex/models/trades/flare/_schema.yml b/dbt_subprojects/dex/models/trades/flare/_schema.yml index 921ed439b2f..438345b34c8 100644 --- a/dbt_subprojects/dex/models/trades/flare/_schema.yml +++ b/dbt_subprojects/dex/models/trades/flare/_schema.yml @@ -29,21 +29,6 @@ models: - tx_hash - evt_index - - name: enosys_v3_flare_base_trades - meta: - blockchain: flare - sector: dex - project: enosys - contributors: hosuke - config: - tags: [ 'flare', 'dex', 'trades', 'enosys', 'v3' ] - description: "Enosys V3 Flare base trades" - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_hash - - evt_index - - name: sparkdex_v2_flare_base_trades meta: blockchain: flare diff --git a/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql index bece6e4f012..ba14cabcd7a 100644 --- a/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql @@ -7,7 +7,6 @@ {% set base_models = [ ref('enosys_v2_flare_base_trades') - , ref('enosys_v3_flare_base_trades') , ref('sparkdex_v2_flare_base_trades') , ref('sparkdex_v3_flare_base_trades') , ref('blazeswap_flare_base_trades') diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v3_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v3_flare_base_trades.sql deleted file mode 100644 index 0c2110dbe0d..00000000000 --- a/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v3_flare_base_trades.sql +++ /dev/null @@ -1,20 +0,0 @@ -{{ config( - schema = 'enosys_v3_flare' - , alias = 'base_trades' - , materialized = 'incremental' - , file_format = 'delta' - , incremental_strategy = 'merge' - , unique_key = ['tx_hash', 'evt_index'] - , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] - ) -}} - -{{ - uniswap_compatible_v3_trades( - blockchain = 'flare' - , project = 'enosys' - , version = '3' - , Pair_evt_Swap = source('enosys_flare', 'EnosysDexV3Pool_evt_Swap') - , Factory_evt_PoolCreated = source('enosys_flare', 'EnosysDexV3Factory_evt_PoolCreated') - ) -}} \ No newline at end of file From b5e9632d45ce4f973f0abb9e85f65c0305b29355 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Tue, 7 Jan 2025 00:42:12 +0800 Subject: [PATCH 45/45] Revert "Update dbt_subprojects/dex/models/trades/_schema.yml" This reverts commit e72e6988b53aad3e319a164b8aa654957026441e. --- dbt_subprojects/dex/models/trades/_schema.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt_subprojects/dex/models/trades/_schema.yml b/dbt_subprojects/dex/models/trades/_schema.yml index cb10cfb6b1d..450e3bf5741 100644 --- a/dbt_subprojects/dex/models/trades/_schema.yml +++ b/dbt_subprojects/dex/models/trades/_schema.yml @@ -4,7 +4,7 @@ models: - name: dex_trades meta: docs_slug: /curated/trading/DEX/dex-trades - blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, kaia, optimism, polygon, scroll, zksync, linea, blast, sei, ronin + blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, kaia, optimism, polygon, scroll, zksync, linea, blast, sei, ronin, flare sector: dex short_description: The `dex.trades` table captures detailed data on trades executed via decentralized exchanges (DEXs). This table contains a detailed breakdown of trade execution containing one or many trades per transaction. contributors: 0xRob, hosuke, jeff-dude, tomfutago, viniabussafi