diff --git a/models/balancer/arbitrum/balancer_arbitrum_schema.yml b/models/balancer/arbitrum/balancer_arbitrum_schema.yml index a5643fa0265..79e4c1573ea 100644 --- a/models/balancer/arbitrum/balancer_arbitrum_schema.yml +++ b/models/balancer/arbitrum/balancer_arbitrum_schema.yml @@ -161,7 +161,6 @@ models: - version - tx_hash - evt_index - - trace_address - check_dex_seed: blockchain: arbitrum project: balancer @@ -174,6 +173,7 @@ models: - &version name: version description: "Version of the project" + - *block_month - *block_date - *block_time - &token_bought_symbol @@ -226,9 +226,6 @@ models: - &tx_to name: tx_to description: "transaction.to" - - &trace_address - name: trace_address - description: "" - *evt_index - name: balancer_v2_arbitrum_liquidity @@ -340,7 +337,6 @@ models: - version - tx_hash - evt_index - - trace_address - check_dex_seed: blockchain: arbitrum project: balancer @@ -370,5 +366,4 @@ models: - name: tx_hash - name: tx_from - name: tx_to - - name: trace_address - name: evt_index diff --git a/models/balancer/arbitrum/balancer_arbitrum_trades.sql b/models/balancer/arbitrum/balancer_arbitrum_trades.sql index ac8ff8d06a7..0ea4ba4d3d3 100644 --- a/models/balancer/arbitrum/balancer_arbitrum_trades.sql +++ b/models/balancer/arbitrum/balancer_arbitrum_trades.sql @@ -19,6 +19,7 @@ FROM ( blockchain, project, version, + block_month, block_date, block_time, token_bought_symbol, @@ -39,7 +40,6 @@ FROM ( tx_hash, tx_from, tx_to, - trace_address, evt_index FROM {{ dex_model }} {% if not loop.last %} diff --git a/models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql b/models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql index 7512a4b5e2a..6d23d7df139 100644 --- a/models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql +++ b/models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql @@ -6,7 +6,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'], + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'], post_hook = '{{ expose_spells(\'["arbitrum"]\', "project", "balancer_v2", @@ -49,7 +49,6 @@ WITH swap.poolId AS pool_id, swap_fees.swap_fee_percentage / POWER(10, 18) AS swap_fee, swap.evt_tx_hash AS tx_hash, - '' AS trace_address, swap.evt_index FROM swap_fees @@ -140,7 +139,6 @@ SELECT dexs.tx_hash, tx."from" AS tx_from, tx.to AS tx_to, - dexs.trace_address, dexs.evt_index FROM dexs diff --git a/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml b/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml index 02a880effc7..4212f556e45 100644 --- a/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml +++ b/models/balancer/avalanche_c/balancer_avalanche_c_schema.yml @@ -20,7 +20,6 @@ models: - version - tx_hash - evt_index - - trace_address - check_dex_seed: blockchain: avalanche_c project: balancer @@ -35,6 +34,9 @@ models: - &version name: version description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" - &block_date name: block_date description: "Block date in UTC" @@ -95,9 +97,6 @@ models: - &tx_to name: tx_to description: "transaction.to" - - &trace_address - name: trace_address - description: "Trace address" - &evt_index name: evt_index description: "Event index" @@ -120,7 +119,6 @@ models: - version - tx_hash - evt_index - - trace_address - check_dex_seed: blockchain: avalanche_c project: balancer @@ -150,7 +148,6 @@ models: - name: tx_hash - name: tx_from - name: tx_to - - name: trace_address - name: evt_index - name: balancer_avalanche_c_pools_tokens_weights @@ -273,9 +270,7 @@ models: name: contract_address description: "Address of BPT being transfered" - *block_date - - &block_month - name: block_month - description: "UTC event block month" + - *block_month - *evt_index - &evt_block_time name: evt_block_time diff --git a/models/balancer/avalanche_c/balancer_avalanche_c_trades.sql b/models/balancer/avalanche_c/balancer_avalanche_c_trades.sql index bdeca05653c..e09c7456927 100644 --- a/models/balancer/avalanche_c/balancer_avalanche_c_trades.sql +++ b/models/balancer/avalanche_c/balancer_avalanche_c_trades.sql @@ -20,6 +20,7 @@ FROM ( blockchain, project, version, + block_month, block_date, block_time, token_bought_symbol, @@ -40,7 +41,6 @@ FROM ( tx_hash, tx_from, tx_to, - trace_address, evt_index FROM {{ dex_model }} {% if not loop.last %} diff --git a/models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql b/models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql index 4115200b504..335620058a5 100644 --- a/models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql +++ b/models/balancer/avalanche_c/balancer_v2_avalanche_c_trades.sql @@ -6,7 +6,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'], + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'], post_hook = '{{ expose_spells(\'["avalanche_c"]\', "project", "balancer_v2", diff --git a/models/balancer/balancer_schema.yml b/models/balancer/balancer_schema.yml index 11dcb3771e6..a3a193a2ca4 100644 --- a/models/balancer/balancer_schema.yml +++ b/models/balancer/balancer_schema.yml @@ -20,6 +20,9 @@ models: - &version name: version description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" - &block_date name: block_date description: "Block date in UTC" @@ -80,9 +83,6 @@ models: - &tx_to name: tx_to description: "transaction.to" - - &trace_address - name: trace_address - description: "" - &evt_index name: evt_index description: 'Event index' diff --git a/models/balancer/balancer_trades.sql b/models/balancer/balancer_trades.sql index abdd54d04d9..a598935e43a 100644 --- a/models/balancer/balancer_trades.sql +++ b/models/balancer/balancer_trades.sql @@ -27,6 +27,7 @@ FROM ( blockchain, project, version, + block_month, block_date, block_time, token_bought_symbol, @@ -47,7 +48,6 @@ FROM ( tx_hash, tx_from, tx_to, - trace_address, evt_index FROM {{ dex_model }} {% if not loop.last %} diff --git a/models/balancer/base/balancer_base_schema.yml b/models/balancer/base/balancer_base_schema.yml index 9d9981babf5..21931c87207 100644 --- a/models/balancer/base/balancer_base_schema.yml +++ b/models/balancer/base/balancer_base_schema.yml @@ -20,7 +20,6 @@ models: - version - tx_hash - evt_index - - trace_address - check_dex_seed: blockchain: base project: balancer @@ -35,6 +34,9 @@ models: - &version name: version description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" - &block_date name: block_date description: "Block date in UTC" @@ -95,9 +97,6 @@ models: - &tx_to name: tx_to description: "transaction.to" - - &trace_address - name: trace_address - description: "Trace address" - &evt_index name: evt_index description: "Event index" @@ -120,7 +119,6 @@ models: - version - tx_hash - evt_index - - trace_address - check_dex_seed: blockchain: base project: balancer @@ -297,9 +295,7 @@ models: - *blockchain - *contract_address - *block_date - - &block_month - name: block_month - description: "UTC event block month" + - *block_month - &evt_tx_hash name: evt_tx_hash description: 'Transaction hash of transfer event' diff --git a/models/balancer/base/balancer_base_trades.sql b/models/balancer/base/balancer_base_trades.sql index a28d987aec9..e27f11de8cc 100644 --- a/models/balancer/base/balancer_base_trades.sql +++ b/models/balancer/base/balancer_base_trades.sql @@ -20,6 +20,7 @@ FROM ( blockchain, project, version, + block_month, block_date, block_time, token_bought_symbol, @@ -40,7 +41,6 @@ FROM ( tx_hash, tx_from, tx_to, - trace_address, evt_index FROM {{ dex_model }} {% if not loop.last %} diff --git a/models/balancer/base/balancer_v2_base_trades.sql b/models/balancer/base/balancer_v2_base_trades.sql index 3403f0c0f22..cba637d81b0 100644 --- a/models/balancer/base/balancer_v2_base_trades.sql +++ b/models/balancer/base/balancer_v2_base_trades.sql @@ -6,7 +6,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'], + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'], post_hook = '{{ expose_spells(\'["base"]\', "project", "balancer_v2", @@ -49,7 +49,6 @@ WITH swap.poolId AS pool_id, swap_fees.swap_fee_percentage / POWER(10, 18) AS swap_fee, swap.evt_tx_hash AS tx_hash, - '' AS trace_address, swap.evt_index FROM swap_fees @@ -140,7 +139,6 @@ SELECT dexs.tx_hash, tx."from" AS tx_from, tx.to AS tx_to, - dexs.trace_address, dexs.evt_index FROM dexs diff --git a/models/balancer/ethereum/balancer_ethereum_schema.yml b/models/balancer/ethereum/balancer_ethereum_schema.yml index a919913d478..6c0d47dc7d4 100644 --- a/models/balancer/ethereum/balancer_ethereum_schema.yml +++ b/models/balancer/ethereum/balancer_ethereum_schema.yml @@ -267,6 +267,7 @@ models: - &version name: version description: "Version of the project" + - *block_month - *block_date - *block_time - &token_bought_symbol @@ -319,9 +320,6 @@ models: - &tx_to name: tx_to description: "transaction.to" - - &trace_address - name: trace_address - description: "" - *evt_index - name: balancer_v1_ethereum_trades @@ -347,6 +345,7 @@ models: - *blockchain - *project - *version + - *block_month - *block_date - *block_time - *token_bought_symbol @@ -367,7 +366,6 @@ models: - *tx_hash - *tx_from - *tx_to - - *trace_address - *evt_index - name: balancer_v2_ethereum_trades @@ -388,7 +386,6 @@ models: - version - tx_hash - evt_index - - trace_address - check_dex_seed: blockchain: ethereum project: balancer @@ -418,7 +415,6 @@ models: - name: tx_hash - name: tx_from - name: tx_to - - name: trace_address - name: evt_index - name: balancer_v2_ethereum_liquidity diff --git a/models/balancer/ethereum/balancer_ethereum_trades.sql b/models/balancer/ethereum/balancer_ethereum_trades.sql index 0438fc5a137..2a6e93d4e1d 100644 --- a/models/balancer/ethereum/balancer_ethereum_trades.sql +++ b/models/balancer/ethereum/balancer_ethereum_trades.sql @@ -20,6 +20,7 @@ FROM ( blockchain, project, version, + block_month, block_date, block_time, token_bought_symbol, @@ -40,7 +41,6 @@ FROM ( tx_hash, tx_from, tx_to, - trace_address, evt_index FROM {{ dex_model }} {% if not loop.last %} diff --git a/models/balancer/ethereum/balancer_v1_ethereum_trades.sql b/models/balancer/ethereum/balancer_v1_ethereum_trades.sql index 5c58b2de505..60632b96fa0 100644 --- a/models/balancer/ethereum/balancer_v1_ethereum_trades.sql +++ b/models/balancer/ethereum/balancer_v1_ethereum_trades.sql @@ -2,7 +2,7 @@ schema = 'balancer_v1_ethereum', tags = ['dunesql'], alias = alias('trades'), - partition_by = ['block_date'], + partition_by = ['block_month'], materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', @@ -49,6 +49,7 @@ select 'balancer' AS project, version, evt_block_time AS block_time, + CAST(date_trunc('month', evt_block_time) AS DATE) AS block_month, TRY_CAST(date_trunc('day', evt_block_time) AS DATE) AS block_date, erc20a.symbol AS token_bought_symbol, erc20b.symbol AS token_sold_symbol, @@ -74,8 +75,7 @@ select evt_tx_hash AS tx_hash, tx."from" AS tx_from, tx.to AS tx_to, - evt_index, - CAST(NULL AS VARCHAR(5)) AS trace_address + evt_index FROM v1 trades INNER JOIN {{ source('ethereum', 'transactions') }} tx ON trades.evt_tx_hash = tx.hash diff --git a/models/balancer/ethereum/balancer_v2_ethereum_trades.sql b/models/balancer/ethereum/balancer_v2_ethereum_trades.sql index ca2411309c8..3b35b9cc01d 100644 --- a/models/balancer/ethereum/balancer_v2_ethereum_trades.sql +++ b/models/balancer/ethereum/balancer_v2_ethereum_trades.sql @@ -6,7 +6,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'], + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'], post_hook = '{{ expose_spells(\'["ethereum"]\', "project", "balancer_v2", @@ -49,7 +49,6 @@ WITH swap.poolId AS pool_id, swap_fees.swap_fee_percentage / POWER(10, 18) AS swap_fee, swap.evt_tx_hash AS tx_hash, - '' AS trace_address, swap.evt_index FROM swap_fees @@ -140,7 +139,6 @@ SELECT dexs.tx_hash, tx."from" AS tx_from, tx.to AS tx_to, - dexs.trace_address, dexs.evt_index FROM dexs diff --git a/models/balancer/gnosis/balancer_gnosis_schema.yml b/models/balancer/gnosis/balancer_gnosis_schema.yml index 7e38189d877..62b0a7d468f 100644 --- a/models/balancer/gnosis/balancer_gnosis_schema.yml +++ b/models/balancer/gnosis/balancer_gnosis_schema.yml @@ -19,7 +19,6 @@ models: - version - tx_hash - evt_index - - trace_address - check_dex_seed: blockchain: gnosis project: balancer @@ -34,6 +33,9 @@ models: - &version name: version description: "Version of the project" + - &block_month + name: block_month + description: "Block month in UTC" - &block_date name: block_date description: "Block date in UTC" @@ -94,9 +96,6 @@ models: - &tx_to name: tx_to description: "transaction.to" - - &trace_address - name: trace_address - description: "Trace address" - &evt_index name: evt_index description: "Event index" @@ -206,7 +205,6 @@ models: - version - tx_hash - evt_index - - trace_address - check_dex_seed: blockchain: gnosis project: balancer @@ -236,7 +234,6 @@ models: - name: tx_hash - name: tx_from - name: tx_to - - name: trace_address - name: evt_index - name: balancer_v2_gnosis_liquidity diff --git a/models/balancer/gnosis/balancer_gnosis_trades.sql b/models/balancer/gnosis/balancer_gnosis_trades.sql index d6805367034..911f529270a 100644 --- a/models/balancer/gnosis/balancer_gnosis_trades.sql +++ b/models/balancer/gnosis/balancer_gnosis_trades.sql @@ -19,6 +19,7 @@ FROM ( blockchain, project, version, + block_month, block_date, block_time, token_bought_symbol, @@ -39,7 +40,6 @@ FROM ( tx_hash, tx_from, tx_to, - trace_address, evt_index FROM {{ dex_model }} {% if not loop.last %} diff --git a/models/balancer/gnosis/balancer_v2_gnosis_trades.sql b/models/balancer/gnosis/balancer_v2_gnosis_trades.sql index 98032e00a64..75e7accf7d4 100644 --- a/models/balancer/gnosis/balancer_v2_gnosis_trades.sql +++ b/models/balancer/gnosis/balancer_v2_gnosis_trades.sql @@ -6,7 +6,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'], + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'], post_hook = '{{ expose_spells(\'["gnosis"]\', "project", "balancer_v2", @@ -49,7 +49,6 @@ WITH swap.poolId AS pool_id, swap_fees.swap_fee_percentage / POWER(10, 18) AS swap_fee, swap.evt_tx_hash AS tx_hash, - '' AS trace_address, swap.evt_index FROM swap_fees @@ -140,7 +139,6 @@ SELECT dexs.tx_hash, tx."from" AS tx_from, tx.to AS tx_to, - dexs.trace_address, dexs.evt_index FROM dexs diff --git a/models/balancer/optimism/balancer_optimism_schema.yml b/models/balancer/optimism/balancer_optimism_schema.yml index 02c7cf3d6af..71989fc8045 100644 --- a/models/balancer/optimism/balancer_optimism_schema.yml +++ b/models/balancer/optimism/balancer_optimism_schema.yml @@ -161,7 +161,6 @@ models: - version - tx_hash - evt_index - - trace_address - check_dex_seed: blockchain: optimism project: balancer @@ -174,6 +173,7 @@ models: - &version name: version description: "Version of the project" + - *block_month - *block_date - *block_time - &token_bought_symbol @@ -226,9 +226,6 @@ models: - &tx_to name: tx_to description: "transaction.to" - - &trace_address - name: trace_address - description: "" - *evt_index - name: balancer_v2_optimism_liquidity @@ -373,7 +370,6 @@ models: - version - tx_hash - evt_index - - trace_address - check_dex_seed: blockchain: optimism project: balancer @@ -403,5 +399,4 @@ models: - name: tx_hash - name: tx_from - name: tx_to - - name: trace_address - name: evt_index diff --git a/models/balancer/optimism/balancer_optimism_trades.sql b/models/balancer/optimism/balancer_optimism_trades.sql index d24c73bc1e1..da09c412584 100644 --- a/models/balancer/optimism/balancer_optimism_trades.sql +++ b/models/balancer/optimism/balancer_optimism_trades.sql @@ -19,6 +19,7 @@ FROM ( blockchain, project, version, + block_month, block_date, block_time, token_bought_symbol, @@ -39,7 +40,6 @@ FROM ( tx_hash, tx_from, tx_to, - trace_address, evt_index FROM {{ dex_model }} {% if not loop.last %} diff --git a/models/balancer/optimism/balancer_v2_optimism_trades.sql b/models/balancer/optimism/balancer_v2_optimism_trades.sql index 492472b04ec..950ba720384 100644 --- a/models/balancer/optimism/balancer_v2_optimism_trades.sql +++ b/models/balancer/optimism/balancer_v2_optimism_trades.sql @@ -6,7 +6,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'], + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'], post_hook = '{{ expose_spells(\'["optimism"]\', "project", "balancer_v2", @@ -49,7 +49,6 @@ WITH swap.poolId AS pool_id, swap_fees.swap_fee_percentage / POWER(10, 18) AS swap_fee, swap.evt_tx_hash AS tx_hash, - '' AS trace_address, swap.evt_index FROM swap_fees @@ -140,7 +139,6 @@ SELECT dexs.tx_hash, tx."from" AS tx_from, tx.to AS tx_to, - dexs.trace_address, dexs.evt_index FROM dexs diff --git a/models/balancer/polygon/balancer_polygon_schema.yml b/models/balancer/polygon/balancer_polygon_schema.yml index 964d3f866b4..eb25abf4b29 100644 --- a/models/balancer/polygon/balancer_polygon_schema.yml +++ b/models/balancer/polygon/balancer_polygon_schema.yml @@ -161,7 +161,6 @@ models: - version - tx_hash - evt_index - - trace_address - check_dex_seed: blockchain: polygon project: balancer @@ -174,6 +173,7 @@ models: - &version name: version description: "Version of the project" + - *block_month - *block_date - *block_time - &token_bought_symbol @@ -226,9 +226,6 @@ models: - &tx_to name: tx_to description: "transaction.to" - - &trace_address - name: trace_address - description: "" - *evt_index - name: balancer_v2_polygon_liquidity @@ -363,7 +360,6 @@ models: - version - tx_hash - evt_index - - trace_address - check_dex_seed: blockchain: polygon project: balancer @@ -393,5 +389,4 @@ models: - name: tx_hash - name: tx_from - name: tx_to - - name: trace_address - name: evt_index diff --git a/models/balancer/polygon/balancer_polygon_trades.sql b/models/balancer/polygon/balancer_polygon_trades.sql index 274908a203f..f5ca09d3e1b 100644 --- a/models/balancer/polygon/balancer_polygon_trades.sql +++ b/models/balancer/polygon/balancer_polygon_trades.sql @@ -19,6 +19,7 @@ FROM ( blockchain, project, version, + block_month, block_date, block_time, token_bought_symbol, @@ -39,7 +40,6 @@ FROM ( tx_hash, tx_from, tx_to, - trace_address, evt_index FROM {{ dex_model }} {% if not loop.last %} diff --git a/models/balancer/polygon/balancer_v2_polygon_trades.sql b/models/balancer/polygon/balancer_v2_polygon_trades.sql index 19f6ef27d08..8dbe10c9266 100644 --- a/models/balancer/polygon/balancer_v2_polygon_trades.sql +++ b/models/balancer/polygon/balancer_v2_polygon_trades.sql @@ -6,7 +6,7 @@ materialized = 'incremental', file_format = 'delta', incremental_strategy = 'merge', - unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'], + unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'], post_hook = '{{ expose_spells(\'["polygon"]\', "project", "balancer_v2", @@ -49,7 +49,6 @@ WITH swap.poolId AS pool_id, swap_fees.swap_fee_percentage / POWER(10, 18) AS swap_fee, swap.evt_tx_hash AS tx_hash, - '' AS trace_address, swap.evt_index FROM swap_fees @@ -140,7 +139,6 @@ SELECT dexs.tx_hash, tx."from" AS tx_from, tx.to AS tx_to, - dexs.trace_address, dexs.evt_index FROM dexs diff --git a/models/dex/dex_trades_migration_beta.sql b/models/dex/dex_trades_migration_beta.sql index 26f627df1b1..3a413b60765 100644 --- a/models/dex/dex_trades_migration_beta.sql +++ b/models/dex/dex_trades_migration_beta.sql @@ -18,10 +18,8 @@ ## Models not yet migrated ,ref('curvefi_trades') ,ref('dodo_trades') -,ref('hashflow_trades') ,ref('ellipsis_finance_trades') ,ref('synthetix_spot_trades') -,ref('balancer_trades') #} {% set dex_trade_models = [ @@ -70,6 +68,9 @@ ,ref('kyberswap_trades') ,ref('zeroex_native_trades') ,ref('zipswap_trades') +,ref('balancer_trades') +,ref('hashflow_trades') + ] %} diff --git a/models/hashflow/avalanche_c/hashflow_avalanche_c_trades.sql b/models/hashflow/avalanche_c/hashflow_avalanche_c_trades.sql index c992d6231dc..9c81de17677 100644 --- a/models/hashflow/avalanche_c/hashflow_avalanche_c_trades.sql +++ b/models/hashflow/avalanche_c/hashflow_avalanche_c_trades.sql @@ -25,7 +25,7 @@ with dexs AS ( SELECT evt_block_time AS block_time, trader AS taker, - '' AS maker, + CAST(NULL as VARBINARY) AS maker, quoteTokenAmount AS token_bought_amount_raw, baseTokenAmount AS token_sold_amount_raw, CAST(NULL AS double) AS amount_usd, @@ -115,4 +115,3 @@ LEFT JOIN {{ source('prices', 'usd') }} p_sold {% if is_incremental() %} AND p_sold.minute >= date_trunc('day', now() - interval '7' day) {% endif %} - \ No newline at end of file diff --git a/models/hashflow/bnb/hashflow_bnb_trades.sql b/models/hashflow/bnb/hashflow_bnb_trades.sql index 54a57105677..0b0b9b2df96 100644 --- a/models/hashflow/bnb/hashflow_bnb_trades.sql +++ b/models/hashflow/bnb/hashflow_bnb_trades.sql @@ -25,7 +25,7 @@ with dexs AS ( SELECT evt_block_time AS block_time, trader AS taker, - '' AS maker, + CAST(NULL as VARBINARY) AS maker, quoteTokenAmount AS token_bought_amount_raw, baseTokenAmount AS token_sold_amount_raw, CAST(NULL AS double) AS amount_usd, @@ -115,4 +115,3 @@ LEFT JOIN {{ source('prices', 'usd') }} p_sold {% if is_incremental() %} AND p_sold.minute >= date_trunc('day', now() - interval '7' day) {% endif %} - \ No newline at end of file diff --git a/models/hashflow/hashflow_trades.sql b/models/hashflow/hashflow_trades.sql index 5ee2ab15f75..1cbbefac48e 100644 --- a/models/hashflow/hashflow_trades.sql +++ b/models/hashflow/hashflow_trades.sql @@ -17,7 +17,7 @@ ref('hashflow_avalanche_c_trades') , ref('hashflow_bnb_trades') ] %} - + SELECT * FROM ( {% for dex_model in hashflow_models %} @@ -25,6 +25,7 @@ FROM ( blockchain, project, version, + block_month, block_date, block_time, token_bought_symbol, diff --git a/models/hashflow/hashflow_trades_schema.yml b/models/hashflow/hashflow_trades_schema.yml index c42310d9e83..75a3545e40c 100644 --- a/models/hashflow/hashflow_trades_schema.yml +++ b/models/hashflow/hashflow_trades_schema.yml @@ -15,12 +15,15 @@ models: - &blockchain name: blockchain description: "Blockchain which the DEX is deployed" - - &project + - &project name: project - description: "Project name of the DEX" + description: "Project name of the DEX" - &version name: version - description: "Version of the contract built and deployed by the DEX project" + description: "Version of the contract built and deployed by the DEX project" + - &block_month + name: block_month + description: "UTC event block month of each DEX trade" - &block_date name: block_date description: "UTC event block date of each DEX trade" @@ -106,7 +109,7 @@ models: - *amount_usd - *token_bought_address - *token_sold_address - - &trader + - &trader name: trader description: "Address of trader who executed the trade." - *tx_hash